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)
Example #2
0
	def __init__(self, graphicsEngine):
		self.graphicsEngine = graphicsEngine
		self.state = GUI_STATS

		self.background = pygame.image.load(g.dataPath + '/gui/game_background.png')
		g.guiSurface.blit(self.background, (0, 0))

		# events
		self.pressedKeys = []

		# game GUIs
		self.mapEditorGUI = MapEditorGUI(g.guiSurface)

		# input fields (TODO: dont hardcode placement)
		self.inpChat = pygUI.pygInputField((16, 384, 480, 20), "", 40, (255, 255, 255))
		self.inpChat.restricted = '\'abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789!"#$%&\\\'()*+,-./:;<=>[email protected][\]^_`{|}~\''
		self.listLog = pygUI.pygList((16, 420, 480, 164), (255, 255, 255))

		# TEMPORARY: MAP EDITOR
		self.label1 = pygUI.pygLabel((544, 150, 20, 20), "Selected tile:")


		# GUI
		self.app = gui.App()

		self.guiContainer = GUIContainer(self, align=-1, valign=-1)
		self.guiContainer.updateEngines()

		self.app.init(self.guiContainer)

		# dialogs
		self.quitDialog = QuitDialog()