예제 #1
0
파일: test2.py 프로젝트: namuol/lite
    def init(self):
        SFMLApp.init(self)
        self.textures = SFMLTextureLib()
        self.textures.load("hell.png")
        self.sprite = Sprite(self.drawTarget(),self.textures.get("hell.png"))
        self.textures.load("font.png")
        self.font = TextureGrid(self.textures.get("font.png"),
            FONT_WIDTH,FONT_HEIGHT)

        self.text_string = SineText(self.drawTarget(), self.font,
                        "This is a simple test.", 0,1, Vector2(80,64))

        self.text_string2 = HypnoText(self.drawTarget(), self.font,
                        "This is a HYPNOTIC test!", 0,1, Vector2(64,228))

        self.text_string_shadow = StaticShadowText(self.text_string,1,1)
        self.text_string2_shadow = ShadowText(self.text_string2,1,1)

        self.text_string.time = 0
        self.text_string_shadow.time = 0

        self.text_string2.time = 0
        self.text_string2_shadow.time = 0

        self.drawTarget().add_drawable(self.text_string_shadow)
        self.drawTarget().add_drawable(self.text_string)

        self.drawTarget().add_drawable(self.text_string2_shadow)
        self.drawTarget().add_drawable(self.text_string2)
        self.input().mapKey(lite.K_ESCAPE, "quit");
        self.input().mapKey(lite.K_q, "quit");
예제 #2
0
파일: test2.py 프로젝트: namuol/lite
 def update(self, *args):
     SFMLApp.update(self,*args)
     if(self.input().button("quit").was_just_pressed()):
         self.quit()
     self.text_string.time += 1.0*args[0]
     self.text_string_shadow.time += 1.0*args[0]
     self.text_string2.time += 1.0*args[0]
     self.text_string2_shadow.time += 1.0*args[0]
예제 #3
0
파일: test.py 프로젝트: namuol/lite
    def __init__(self, *args):
        SFMLApp.__init__(self,*args)
        self.textures = SFMLTextureLib()
        self.textures.load("hell.png")
        self.textures.load("edges.png")
        self.texgrid = TextureGrid(self.textures.get("hell.png"), TILE_WIDTH, TILE_HEIGHT)
        self.edgegrid = TextureGrid(self.textures.get("edges.png"), TILE_WIDTH, TILE_HEIGHT)

        self.tileMap = TileMap(TM_WIDTH, TM_HEIGHT, 
                              TILE_WIDTH, TILE_HEIGHT,
                              LAYER_COUNT, SUBLAYER_COUNT)
        self.cam = Camera(Vector2(0,0),SCR_W,SCR_H)
예제 #4
0
파일: test.py 프로젝트: namuol/lite
    def init(self):
        SFMLApp.init(self)

        self.input().mapKey(lite.K_ESCAPE, "quit")
        self.input().mapKey(lite.K_q, "quit")

        self.input().mapKey(lite.K_LEFT, "left")
        self.input().mapKey(lite.K_a, "left")

        self.input().mapKey(lite.K_RIGHT, "right")
        self.input().mapKey(lite.K_d, "right")

        self.input().mapKey(lite.K_UP, "up")
        self.input().mapKey(lite.K_w, "up")

        self.input().mapKey(lite.K_DOWN, "down")
        self.input().mapKey(lite.K_s, "down")

        self.input().mapKey(lite.K_e, "toggle_edges")
        self.input().mapKey(lite.K_1, "toggle_front")
        self.input().mapKey(lite.K_2, "toggle_back")

        self.input().mapKey(lite.K_m, "toggle_filtermode")
        
        textures = TileTexArray([None for x in range(LAYER_COUNT*SUBLAYER_COUNT)])
        for x in range(TM_WIDTH):
            for y in range(TM_HEIGHT):
                if randint(0,3) % 3:
                    for i in range(LAYER_COUNT*SUBLAYER_COUNT):
                        textures[i] = self.texgrid[randint(0,self.texgrid.size()-1)]
                    self.tileMap.set(x,y, Tile(LAYER_COUNT,SUBLAYER_COUNT,textures))


        self.back = TileMapLayer(self.drawTarget(), self.tileMap, self.cam, 0, -0.5, .5,Color(.3,.3,.3))
        self.front = TileMapLayer(self.drawTarget(), self.tileMap, self.cam, 1, 1, 1)
        self.edges = EdgeMap(self.tileMap, self.edgegrid[0],self.edgegrid[1],self.edgegrid[2],self.edgegrid[3])
        self.edgesLayer = TileMapLayer(self.drawTarget(), self.edges, self.cam,0,2.,1.,
                                        Color(1.,1.,1.,.75))

        self.drawTarget().add_drawable(self.front)
        self.drawTarget().add_drawable(self.back)
        self.drawTarget().add_drawable(self.edgesLayer)
예제 #5
0
파일: test.py 프로젝트: namuol/lite
    def update(self, *args):
        SFMLApp.update(self,*args)

        if(self.input().button("quit").was_just_pressed()):
            self.quit()

        if( self.input().button("toggle_edges").was_just_pressed() ):
            self.edgesLayer.visible(not self.edgesLayer.visible())

        if( self.input().button("toggle_front").was_just_pressed() ):
            self.front.visible(not self.front.visible())

        if( self.input().button("toggle_back").was_just_pressed() ):
            self.back.visible(not self.back.visible())

        if( self.input().button("toggle_filtermode").was_just_pressed() ):
            current = self.drawTarget().filterMode()
            if(current is NEAREST):
                self.drawTarget().filterMode(LINEAR)
            else:
                self.drawTarget().filterMode(NEAREST)


        cam_velocity = Vector2()

        if( self.input().button("left").is_pressed() ):
            cam_velocity.x = CAM_SPEED
        elif( self.input().button("right").is_pressed() ):
            cam_velocity.x = -CAM_SPEED

        if( self.input().button("up").is_pressed() ):
            cam_velocity.y = CAM_SPEED
        elif( self.input().button("down").is_pressed() ):
            cam_velocity.y = -CAM_SPEED
             
        self.cam.position(self.cam.realPosition() + cam_velocity)
예제 #6
0
파일: test2.py 프로젝트: namuol/lite
 def __init__(self, *args):
     SFMLApp.__init__(self,*args)
예제 #7
0
파일: test2.py 프로젝트: namuol/lite
 def run(self):
     SFMLApp.run(self)