Exemplo n.º 1
0
 def __init__(self, width, height, title):
     """
     Set up the application.
     """
     self.time = 0
     super().__init__(width, height, title)
     self.color_program = self.ctx.program(vertex_shader="""
         #version 330
         in vec2 in_vert;
         void main() {
             gl_Position = vec4(in_vert, 0.0, 1.0);
         }
         """,
                                           fragment_shader="""
         #version 330
         uniform vec4 color;
         out vec4 out_color;
         void main() {
             out_color = color;
         }
         """)
     self.uv_program = self.ctx.program(vertex_shader="""
         #version 330
         in vec2 in_vert;
         in vec2 in_uv;
         out vec2 v_uv;
         void main() {
             gl_Position = vec4(in_vert, 0.0, 1.0);
             v_uv = in_uv;
         }
         """,
                                        fragment_shader="""
         #version 330
         in vec2 v_uv;
         out vec4 out_color;
         void main() {
             out_color = vec4(v_uv, 0.0, 1.0);
         }
         """)
     self.quad_1 = geometry.quad_2d(pos=(-0.5, 0.5))
     self.quad_2 = geometry.quad_2d(pos=(0.5, 0.5))
Exemplo n.º 2
0
    def setup(self):
        """ Set up the game and initialize the variables. """

        # Offscreen stuff
        self.program = self.ctx.load_program(
            vertex_shader=arcade.resources.shaders.vertex.default_projection,
            fragment_shader=arcade.resources.shaders.fragment.texture)
        self.color_attachment = self.ctx.texture((SCREEN_WIDTH, SCREEN_HEIGHT),
                                                 components=4)
        self.offscreen = self.ctx.framebuffer(
            color_attachments=[self.color_attachment])
        self.quad_fs = geometry.quad_2d_fs()
        self.mini_map_quad = geometry.quad_2d(size=(0.5, 0.5),
                                              pos=(0.75, 0.75))

        # Sprite lists
        self.player_list = arcade.SpriteList()
        self.coin_list = arcade.SpriteList()

        # Score
        self.score = 0

        # Set up the player
        # Character image from kenney.nl
        self.player_sprite = arcade.Sprite(
            ":resources:images/animated_characters/female_person/femalePerson_idle.png",
            SPRITE_SCALING_PLAYER)
        self.player_sprite.center_x = 50
        self.player_sprite.center_y = 50
        self.player_list.append(self.player_sprite)

        # Create the coins
        for i in range(COIN_COUNT):

            # Create the coin instance
            # Coin image from kenney.nl
            coin = arcade.Sprite(":resources:images/items/coinGold.png",
                                 SPRITE_SCALING_COIN)

            # Position the coin
            coin.center_x = random.randrange(SCREEN_WIDTH)
            coin.center_y = random.randrange(SCREEN_HEIGHT)

            # Add the coin to the lists
            self.coin_list.append(coin)
Exemplo n.º 3
0
    def setup(self):
        """LOOK機能、character_screen画面, level_up画面、ノーマルstate時のUIの初期化を行う
        ミニマップ作成の情報もここで渡す
        """
        self.engine.setup()
        viewport(self.engine.player.center_x, self.engine.player.center_y)

        # ここでminimapの作成を行う
        # ------------------------------------------------------------------------------

        # ミニマップの描画位置指定
        screen_size = (SCREEN_WIDTH, SCREEN_HEIGHT)
        self.program = self.ctx.load_program(
            vertex_shader=arcade.resources.shaders.vertex.default_projection,
            fragment_shader=arcade.resources.shaders.fragment.texture)

        # ピクセルの色を保存するために色の添付ファイルを追加します
        self.color_attachment = self.ctx.texture((screen_size), components=4,
                                                 filter=(gl.GL_NEAREST, gl.GL_NEAREST))

        # 必要な色を添付したフレームバッファを作成する
        self.offscreen = self.ctx.framebuffer(
            color_attachments=[self.color_attachment])
        self.quad_fs = geometry.quad_2d_fs()
        self.mini_map_quad = geometry.quad_2d(
            size=(0.31, .31), pos=(.824, -.8))
        # -------------------------------------------------------------------------------

        # Lコマンドで呼び出すlook機能
        self.select_UI = SelectUI(engine=self.engine)
        
        self.character_UI = CharacterScreenUI(engine=self.engine)


        self.level_up_window = LevelupUI()
        self.level_up_flower = LevelUpFlower(self.engine)
        self.normal_UI = NormalUI(self.engine)
Exemplo n.º 4
0
def test_quad_2d(ctx):
    geometry.quad_2d()