コード例 #1
0
    def __init__(self, surface):
        self.surface = surface

        self.state = PLACE_TILE

        # todo: remove this
        self.gameSurfaceRect = g.gameSurface.get_rect()
        self.gameSurfaceRect.top = 16
        self.gameSurfaceRect.left = 16

        ##############
        # PLACE TILE #
        ##############

        # selected tile
        self.selectedTileX = 0
        self.selectedTileY = 0
        self.selectedTileSurface = pygame.Surface((PIC_X, PIC_Y))
        self.selectedTileRect = pygame.Rect((632, 175, 32, 32))

        # tileset
        self.tilesetOffsetX = 0
        self.tilesetOffsetY = 0

        self.tilesetImg = pygame.image.load(g.dataPath +
                                            '/tilesets/Tiles1.png').convert()
        self.tilesetImgRect = self.tilesetImg.get_rect()

        self.tilesetSurfaceRect = pygame.Rect((540, 212, PIC_X * 6, PIC_Y * 4))

        # scroll buttons
        # - scroll buttons (place them near self.tileSurfaceRect)
        btnScrollLeft = pygUI.pygButton(
            (self.tilesetSurfaceRect.x,
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height), 32,
             32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/themes/default/hslider.left.tga')
        btnScrollRight = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width - 16),
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height), 32,
             32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/themes/default/hslider.right.tga')
        btnScrollUp = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width),
             self.tilesetSurfaceRect.y, 32, 32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/themes/default/vslider.up.tga')
        btnScrollDown = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width),
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height - 16),
             32, 32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/themes/default/vslider.down.tga')

        self.tileButtons = (btnScrollLeft, btnScrollRight, btnScrollUp,
                            btnScrollDown)
コード例 #2
0
	def __init__(self, surface):
		self.surface = surface

		self.state = PLACE_TILE

		# todo: remove this shit
		self.gameSurfaceRect = g.gameSurface.get_rect()
		self.gameSurfaceRect.top = 16
		self.gameSurfaceRect.left = 16

		##############
		# PLACE TILE #
		##############

		# selected tile
		self.selectedTileX = 0
		self.selectedTileY = 0
		self.selectedTileSurface = pygame.Surface((PIC_X, PIC_Y))
		self.selectedTileRect = pygame.Rect((632, 175, 32, 32))

		# tileset
		self.tilesetOffsetX = 0
		self.tilesetOffsetY = 0

		self.tilesetImg = pygame.image.load(g.dataPath + '/tilesets/Tiles1.bmp').convert_alpha()
		self.tilesetImgRect = self.tilesetImg.get_rect()

		self.tilesetSurfaceRect = pygame.Rect((540, 212, PIC_X*6, PIC_Y*4))

		#buttons
		# scroll, save, cancel, clear layer
		# - scroll buttons (place them near self.tileSurfaceRect)
		btnScrollLeft = pygUI.pygButton((self.tilesetSurfaceRect.x, (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/gui/button_left_normal.png', down=g.dataPath + '/gui/button_left_down.png', highlight=g.dataPath + '/gui/button_left_highlight.png')
		btnScrollRight = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width-32), (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/gui/button_right_normal.png', down=g.dataPath + '/gui/button_right_down.png', highlight=g.dataPath + '/gui/button_right_highlight.png')
		btnScrollUp = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width), self.tilesetSurfaceRect.y, 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/gui/button_up_normal.png', down=g.dataPath + '/gui/button_up_normal.png', highlight=g.dataPath + '/gui/button_up_highlight.png')
		btnScrollDown = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width), (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height-32), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/gui/button_down_normal.png', down=g.dataPath + '/gui/button_down_normal.png', highlight=g.dataPath + '/gui/button_down_highlight.png')

		self.tileButtons = (btnScrollLeft, btnScrollRight, btnScrollUp, btnScrollDown)

		##############
		# PLACE WARP #
		##############

		# input
		self.inpWarpMapID = pygUI.pygInputField((573, 250, 150, 20), "Map ID", 20, (255, 255, 255))
		self.inpWarpX     = pygUI.pygInputField((573, 300, 150, 20), "X", 20, (255, 255, 255))
		self.inpWarpY     = pygUI.pygInputField((573, 340, 150, 20), "Y", 20, (255, 255, 255))

		self.inpWarpMapID.restricted = '1234567890'
		self.inpWarpX.restricted = '1234567890'
		self.inpWarpY.restricted = '1234567890'

		# labels
		self.lblWarpLeftClick = pygUI.pygLabel((496, 190, 304, 10), "Left click to add warp", align=pygUI.ALIGN_CENTER)
		self.lblWarpRightClick = pygUI.pygLabel((496, 210, 304, 10), "Right click to remove warp", align=pygUI.ALIGN_CENTER)
コード例 #3
0
    def __init__(self, surface):
        self.surface = surface

        # selected item sprite
        self.selectedSpriteNum = 0
        self.selectedSpriteSurface = pygame.Surface((PIC_X, PIC_Y))
        self.selectedSpriteRect = pygame.Rect((632, 80, 32, 32))

        # scroll buttons
        # - scroll buttons (place them near self.selectedSpriteRect)
        btnScrollLeft = pygUI.pygButton((600, 88, 32, 32), normal=g.dataPath + '/themes/default/hslider.left.tga')
        btnScrollRight = pygUI.pygButton((680, 88, 32, 32), normal=g.dataPath + '/themes/default/hslider.right.tga')

        self.scrollButtons = (btnScrollLeft, btnScrollRight)
コード例 #4
0
    def __init__(self, surface):
        self.surface = surface

        # selected item sprite
        self.selectedSpriteNum = 0
        self.selectedSpriteSurface = pygame.Surface((PIC_X, PIC_Y))
        self.selectedSpriteRect = pygame.Rect((632, 80, 32, 32))

        # scroll buttons
        # - scroll buttons (place them near self.selectedSpriteRect)
        btnScrollLeft = pygUI.pygButton((600, 88, 32, 32), normal=g.dataPath + '/themes/default/hslider.left.tga')
        btnScrollRight = pygUI.pygButton((680, 88, 32, 32), normal=g.dataPath + '/themes/default/hslider.right.tga')

        self.scrollButtons = (btnScrollLeft, btnScrollRight)
コード例 #5
0
    def __init__(self, surface):
        self.surface = surface

        self.state = PLACE_TILE

        # todo: remove this
        self.gameSurfaceRect = g.gameSurface.get_rect()
        self.gameSurfaceRect.top = 16
        self.gameSurfaceRect.left = 16

        ##############
        # PLACE TILE #
        ##############

        # selected tile
        self.selectedTileX = 0
        self.selectedTileY = 0
        self.selectedTileSurface = pygame.Surface((PIC_X, PIC_Y))
        self.selectedTileRect = pygame.Rect((632, 175, 32, 32))

        # tileset
        self.tilesetOffsetX = 0
        self.tilesetOffsetY = 0

        self.tilesetImg = pygame.image.load(g.dataPath + '/tilesets/Tiles1.png').convert()
        self.tilesetImgRect = self.tilesetImg.get_rect()

        self.tilesetSurfaceRect = pygame.Rect((540, 212, PIC_X*6, PIC_Y*4))

        # scroll buttons
        # - scroll buttons (place them near self.tileSurfaceRect)
        btnScrollLeft = pygUI.pygButton((self.tilesetSurfaceRect.x, (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/themes/default/hslider.left.tga')
        btnScrollRight = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width-16), (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/themes/default/hslider.right.tga')
        btnScrollUp = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width), self.tilesetSurfaceRect.y, 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/themes/default/vslider.up.tga')
        btnScrollDown = pygUI.pygButton((self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width), (self.tilesetSurfaceRect.y+self.tilesetSurfaceRect.height-16), 32, 32), fgcolor=(255, 255, 255), normal=g.dataPath + '/themes/default/vslider.down.tga')

        self.tileButtons = (btnScrollLeft, btnScrollRight, btnScrollUp, btnScrollDown)
コード例 #6
0
    def __init__(self, surface):
        self.surface = surface

        self.state = PLACE_TILE

        # todo: remove this shit
        self.gameSurfaceRect = g.gameSurface.get_rect()
        self.gameSurfaceRect.top = 16
        self.gameSurfaceRect.left = 16

        ##############
        # PLACE TILE #
        ##############

        # selected tile
        self.selectedTileX = 0
        self.selectedTileY = 0
        self.selectedTileSurface = pygame.Surface((PIC_X, PIC_Y))
        self.selectedTileRect = pygame.Rect((632, 175, 32, 32))

        # tileset
        self.tilesetOffsetX = 0
        self.tilesetOffsetY = 0

        self.tilesetImg = pygame.image.load(
            g.dataPath + '/tilesets/Tiles1.bmp').convert_alpha()
        self.tilesetImgRect = self.tilesetImg.get_rect()

        self.tilesetSurfaceRect = pygame.Rect((540, 212, PIC_X * 6, PIC_Y * 4))

        #buttons
        # scroll, save, cancel, clear layer
        # - scroll buttons (place them near self.tileSurfaceRect)
        btnScrollLeft = pygUI.pygButton(
            (self.tilesetSurfaceRect.x,
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height), 32,
             32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/gui/button_left_normal.png',
            down=g.dataPath + '/gui/button_left_down.png',
            highlight=g.dataPath + '/gui/button_left_highlight.png')
        btnScrollRight = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width - 32),
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height), 32,
             32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/gui/button_right_normal.png',
            down=g.dataPath + '/gui/button_right_down.png',
            highlight=g.dataPath + '/gui/button_right_highlight.png')
        btnScrollUp = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width),
             self.tilesetSurfaceRect.y, 32, 32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/gui/button_up_normal.png',
            down=g.dataPath + '/gui/button_up_normal.png',
            highlight=g.dataPath + '/gui/button_up_highlight.png')
        btnScrollDown = pygUI.pygButton(
            (self.tilesetSurfaceRect.x + (self.tilesetSurfaceRect.width),
             (self.tilesetSurfaceRect.y + self.tilesetSurfaceRect.height - 32),
             32, 32),
            fgcolor=(255, 255, 255),
            normal=g.dataPath + '/gui/button_down_normal.png',
            down=g.dataPath + '/gui/button_down_normal.png',
            highlight=g.dataPath + '/gui/button_down_highlight.png')

        self.tileButtons = (btnScrollLeft, btnScrollRight, btnScrollUp,
                            btnScrollDown)

        ##############
        # PLACE WARP #
        ##############

        # input
        self.inpWarpMapID = pygUI.pygInputField((573, 250, 150, 20), "Map ID",
                                                20, (255, 255, 255))
        self.inpWarpX = pygUI.pygInputField((573, 300, 150, 20), "X", 20,
                                            (255, 255, 255))
        self.inpWarpY = pygUI.pygInputField((573, 340, 150, 20), "Y", 20,
                                            (255, 255, 255))

        self.inpWarpMapID.restricted = '1234567890'
        self.inpWarpX.restricted = '1234567890'
        self.inpWarpY.restricted = '1234567890'

        # labels
        self.lblWarpLeftClick = pygUI.pygLabel((496, 190, 304, 10),
                                               "Left click to add warp",
                                               align=pygUI.ALIGN_CENTER)
        self.lblWarpRightClick = pygUI.pygLabel((496, 210, 304, 10),
                                                "Right click to remove warp",
                                                align=pygUI.ALIGN_CENTER)