def Initialize(): global OptionsScreen_DebugModeEnabled global OptionsScreen_RandomWindowTitle global OptionsScreen_NumberFormatting OptionsScreen_DebugModeEnabled = gameObjs.UpDownButton(0,0,14) OptionsScreen_RandomWindowTitle = gameObjs.UpDownButton(0,0,14) OptionsScreen_NumberFormatting = gameObjs.UpDownButton(0,0,14)
def Initialize(): global WindowObject global BuyButton global DrawnSurface global ListItems WindowObject = gameObjs.Window(pygame.Rect(100,100,430,285), gameMain.DefaultCnt.Get_RegKey("/strings/window/store/window_title"), True) WindowObject.Minimizable = False BuyButton = gameObjs.Button(pygame.Rect(20, 20, 50, 50), gameMain.DefaultCnt.Get_RegKey("/strings/window/store/buy_button"), 14) BuyButton.CustomColisionRectangle = True DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2], WindowObject.WindowSurface_Rect[3]), pygame.SRCALPHA) ListItems = gameObjs.VerticalListWithDescription(pygame.Rect(0, 0, 350, 250))
def Initialize(DISPLAY): global WindowObj global WindowObj_RefreshButton WindowObj = gameObjs.Window( pygame.Rect(350, 50, 550, 200), gameMain.DefaultCnt.Get_RegKey( "/strings/main_menu/message_window/window_title"), True) WindowObj_RefreshButton = gameObjs.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey( "/strings/main_menu/message_window/next_button"), 18) WindowObj_RefreshButton.CustomColisionRectangle = True
def ReloadItemsList(): global ListItems global SelectedItemLevel global LastClickedItem global SelectedItemPrice global SelectedItemID ListItems = gameObjs.VerticalListWithDescription( pygame.Rect(0, 0, 350, 250)) ListItems.ClearItems() print("ReloadItemsList : Add Store Items") for x in range(gameMain.DefaultCnt.Get_RegKey("/ItemData/minimum", int), gameMain.DefaultCnt.Get_RegKey("/ItemData/all", int) + 1): # -- Check if item is Visible -- # if gameMain.DefaultCnt.Get_RegKey("/ItemData/" + str(x) + "/is_upgradeable"): # -- Reg Keys Locations -- # CurrentItemRoot = "/ItemData/upgrade/" + str(x) + "_" CurrentItemLevel = gameItems.GetItemLevel_ByID(x) + 1 CurrentItemSprite = gameItems.GetItemSprite_ByID(x) CurrentItemDescription = CurrentItemRoot + "description_" + str( CurrentItemLevel) CurrentItemName = CurrentItemRoot + "name_" + str(CurrentItemLevel) print("ReloadItemsList : CurrentItem[" + CurrentItemRoot + "]") ListItems.AddItem( gameMain.DefaultCnt.Get_RegKey(CurrentItemName), gameMain.DefaultCnt.Get_RegKey(CurrentItemDescription), gameMain.DefaultCnt.Get_RegKey(CurrentItemSprite)) print("ReloadItemsList : Add Store Items") RestartAnimation()
def GameDraw(DISPLAY): global PlayButton global SettingsButton global CommonScreenObj global ControlsInitialized global IntroSpriteButton CommonScreenObj = DISPLAY if ControlsInitialized: gameObjs.Draw_Panel(DISPLAY, (Animation_Value, 0, 300, DISPLAY.get_height())) gameMain.DefaultCnt.FontRender( DISPLAY, "/PressStart2P.ttf", 18, gameMain.DefaultCnt.Get_RegKey("/strings/main_menu/game_title"), (240, 250, 250), Animation_Value + 15, 20, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) PlayButton.Render(DISPLAY) SettingsButton.Render(DISPLAY) IntroSpriteButton.Render(DISPLAY) gameMain.DefaultCnt.FontRender( DISPLAY, "/PressStart2P.ttf", 10, gameMain.DefaultCnt.Get_RegKey("/strings/main_menu/about"), (240, 250, 250), IntroSpriteButton.Rectangle[0] + IntroSpriteButton.Rectangle[2] + 5, IntroSpriteButton.Rectangle[1] + 3, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) tipsWindow.Draw(DISPLAY)
def GameDraw(DISPLAY): global Current_Category global ElementsY global ElementsX global OptionsScreen_UpDownCategory global CurrentCategoryUpdate # -- Draw the Background -- # gameObjs.Draw_Panel(DISPLAY, (ElementsX, ElementsY, 558, 258)) # -- Render the Title Text -- # gameMain.shape.Shape_Rectangle(DISPLAY, (1, 22, 39), (ElementsX, ElementsY, 558, 22)) gameMain.DefaultCnt.FontRender( DISPLAY, "/PressStart2P.ttf", 15, gameMain.DefaultCnt.Get_RegKey("/strings/settings/category/{0}".format( str(Current_Category))), (246, 247, 248), ElementsX + 5, ElementsY + 4, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) # -- Render Close Button -- # OptionsScreen_CloseButton.Render(DISPLAY) # -- Render UpDown Button -- # OptionsScreen_UpDownCategory.Render(DISPLAY) # -- Render Categorys -- # CurrentCategoryUpdate.Render(DISPLAY)
def Initialize(): global ReceiveLog_CloseButton global ResultSurface ResultSurface = pygame.Surface((350, 350), pygame.SRCALPHA) ReceiveLog_CloseButton = gameObjs.Button( pygame.rect.Rect(320, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/down_arrow"), 16)
def Initialize(DISPLAY): global PlayButton global SettingsButton global IntroSpriteButton PlayButton = gameObjs.Button( pygame.Rect(50, 50, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/main_menu/play_button"), 18) SettingsButton = gameObjs.Button( pygame.Rect(50, 50, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/main_menu/settings_button"), 18) gameMainObj.ClearColor = (1, 20, 30) IntroSpriteButton = gameObjs.SpriteButton(pygame.Rect( 0, 0, 47, 45), ("/icon.png", "/icon.png", "/icon.png")) print("GameMenu : Initialize") tipsWindow.Initialize(DISPLAY)
def Initialize(): global OptionsScreen_CloseButton global OptionsScreen_UpDownCategory global Current_Category OptionsScreen_CloseButton = gameObjs.Button( pygame.rect.Rect(0, 5, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/settings/back_button"), 14) OptionsScreen_UpDownCategory = gameObjs.UpDownButton(5, 5, 14) gameMain.ClearColor = (1, 24, 32) Category0.Initialize() Category1.Initialize() Category2.Initialize() Set_Category(Current_Category)
def __init__(self, Text, Value, ValueType, ID): self.Text = str(Text) self.Value = str(Value) self.ValueType = ValueType self.Ypos = 0 self.Index = 0 self.ChangeButton = gameObjs.Button((0, 0, 0, 0), "Toggle", 8) self.Xoffset = 0 self.Yoffset = 0 self.Response = -1002 self.ID = ID # -- Set the Button Type -- # if ValueType == int or float: self.ChangeButton = gameObjs.UpDownButton(5, 5, 8) self.ChangeButton.UpButton.CustomColisionRectangle = True self.ChangeButton.DownButton.CustomColisionRectangle = True self.ChangeButton.CustomColisionRectangle = True
def Initialize(DISPLAY): # -- Set Buttons -- # global SaveButton global GameOptionsButton global GrindButton global BackToMainMenuButton global OpenStoreButton global ItemsView global OpenInfosWindowButton global OpenExperienceWindowButton global HUD_Surface # -- Initialize Buttons -- # GrindButton = gameObjs.Button(pygame.rect.Rect(15, 115, 130, 150), "Lorem", 18) GrindButton.WhiteButton = True GameOptionsButton = gameObjs.Button( pygame.rect.Rect(DISPLAY.get_width() - 120, 5, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/options"), 12) SaveButton = gameObjs.Button( pygame.rect.Rect(DISPLAY.get_width() - 120, 20, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/save"), 12) BackToMainMenuButton = gameObjs.Button( pygame.Rect(DISPLAY.get_width() - 120, 35, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/main_menu"), 12) OpenStoreButton = gameObjs.Button( pygame.Rect(5, DISPLAY.get_height() - 25, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/store"), 14) OpenInfosWindowButton = gameObjs.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/button/game/infos"), 14) OpenExperienceWindowButton = gameObjs.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey( "/strings/button/game/experience_store"), 14) ItemsView = gameObjs.GameItemsView(pygame.Rect(5, 500, 430, 100)) IncomingLog.Initialize() # -- Initialize Objects -- # storeWindow.Initialize() expStoreWindow.Initialize() infosWindow.Initialize() gameMain.ClearColor = (5, 20, 14) # -- Initialize the Screen -- # HUD_Surface = pygame.Surface((DISPLAY.get_width(), DISPLAY.get_height())) # # -- Load the Save Game -- # LoadGame()
def Initialize(): global WindowObject global BuyButton global DrawnSurface global ListItems global BuyAmout global PreviousButton global NextButton WindowObject = gameObjs.Window(pygame.Rect(100,100,gameMain.DefaultCnt.Get_RegKey("/props/window/infos/last_w", int),gameMain.DefaultCnt.Get_RegKey("/props/window/infos/last_h", int)), gameMain.DefaultCnt.Get_RegKey("/strings/window/infos/window_title"),True) NextButton = gameObjs.Button(pygame.Rect(0,0,0,0), ">", 12) PreviousButton = gameObjs.Button(pygame.Rect(0,0,0,0), "<", 12) NextButton.CustomColisionRectangle = True PreviousButton.CustomColisionRectangle = True WindowObject.Minimizable = False DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2], WindowObject.WindowSurface_Rect[3]), pygame.SRCALPHA) category_0.Initialize() category_1.Initialize() category_2.Initialize() Set_Category(0)
def Draw(DISPLAY): global ResultSurface global TextGrind_Text # -- Set Position -- # IncomingLogPos = (DISPLAY.get_width() - 355, ReceiveLog_Y_Offset + DISPLAY.get_height() - 355) # -- Update the Surface -- # ResultSurface = pygame.Surface((350, 350), pygame.SRCALPHA) # -- Render the Background -- # gameObjs.Draw_Panel( DISPLAY, (IncomingLogPos[0], IncomingLogPos[1], ResultSurface.get_width(), ResultSurface.get_height())) # -- Draw the Texts -- # for x, TextGrind_TxT in enumerate(TextGrind_Text): # -- Render Object -- # ObjOpacity = TextGrind_Y[x] * 2 gameMain.DefaultCnt.FontRender( ResultSurface, "/PressStart2P.ttf", TextGrind_FontSize[x], TextGrind_TxT, TextGrind_TextColor[x], TextGrind_X[x], TextGrind_Y[x], Opacity=ObjOpacity, antialias=gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) if gameMain.DefaultCnt.Get_RegKey("/OPTIONS/scanline_effect"): for y in range(0, 175): gameMain.shape.Shape_Line(ResultSurface, (0, 0, 0), 3, 4 + y * 2, ResultSurface.get_width() - 3, 4 + y * 2, 1) gameMain.shape.Shape_Rectangle(ResultSurface, (0, 0, 0), (0, 24, ResultSurface.get_width(), ResultSurface.get_height() - 24), 5, 8) # -- Render the Container Title -- # gameMain.shape.Shape_Rectangle(ResultSurface, (0, 12, 30), (0, 0, 350, 24)) gameMain.DefaultCnt.FontRender( ResultSurface, "/PressStart2P.ttf", 18, gameMain.DefaultCnt.Get_RegKey("/strings/game/receiving_log"), (250, 250, 255), 3, 3) # -- Blit everthing to screen -- # DISPLAY.blit(ResultSurface, IncomingLogPos) ReceiveLog_CloseButton.Render(DISPLAY)
def Draw(HUD_Surface): global SecondsText global DateText global ClockBoxPos global ClockBox global CommonSurface if CommonSurface == None: CommonSurface = HUD_Surface return CommonSurface = HUD_Surface # -- Render Background -- # gtk.Draw_Panel(ClockBox, (0, 0, ClockBoxPos[2] - 2, ClockBoxPos[3] - 2), True) # -- Locations -- # TimeTextY = 7 DayTextY = 22 # -- Time -- # gameMain.DefaultCnt.FontRender( ClockBox, "/PressStart2P.ttf", 10, SecondsText, (0, 0, 0), ClockBox.get_width() / 2 - gameMain.DefaultCnt.GetFont_width( "/PressStart2P.ttf", 10, SecondsText) / 2 + 2, TimeTextY - 2, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) gameMain.DefaultCnt.FontRender( ClockBox, "/PressStart2P.ttf", 10, SecondsText, (230, 230, 230), ClockBox.get_width() / 2 - gameMain.DefaultCnt.GetFont_width( "/PressStart2P.ttf", 10, SecondsText) / 2, TimeTextY, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) # -- Day -- # gameMain.DefaultCnt.FontRender( ClockBox, "/PressStart2P.ttf", 10, DateText, (0, 0, 0), ClockBox.get_width() / 2 - gameMain.DefaultCnt.GetFont_width("/PressStart2P.ttf", 10, DateText) / 2 + 2, DayTextY - 2, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) gameMain.DefaultCnt.FontRender( ClockBox, "/PressStart2P.ttf", 10, DateText, (230, 230, 230), ClockBox.get_width() / 2 - gameMain.DefaultCnt.GetFont_width("/PressStart2P.ttf", 10, DateText) / 2, DayTextY, gameMain.DefaultCnt.Get_RegKey("/OPTIONS/font_aa")) gameMain.shape.Shape_Rectangle(ClockBox, (0, 0, 0), (0, 0, ClockBoxPos[2], ClockBoxPos[3]), 3, 5) HUD_Surface.blit(ClockBox, (ClockBoxPos[0], ClockBoxPos[1]))
def Initialize(): global Yes_Button global No_Button global InputBox global OK_Button Yes_Button = gtk.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/dialog/yes_button"), 18) Yes_Button.CustomColisionRectangle = True No_Button = gtk.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/dialog/no_button"), 18) No_Button.CustomColisionRectangle = True OK_Button = gtk.Button( pygame.Rect(0, 0, 0, 0), gameMain.DefaultCnt.Get_RegKey("/strings/dialog/ok_button"), 18) OK_Button.CustomColisionRectangle = True InputBox = gtk.InputBox(0, 0, 0, 0, "Default", 20) InputBox.CustomColision = True
def Initialize(): global WindowObject global BuyButton global DrawnSurface global ListItems global BuyAmout WindowObject = gameObjs.Window( pygame.Rect( 100, 100, gameMain.DefaultCnt.Get_RegKey( "/props/window/expecience_store/last_w", int), gameMain.DefaultCnt.Get_RegKey( "/props/window/expecience_store/last_h", int)), gameMain.DefaultCnt.Get_RegKey( "/strings/window/expecience_store/window_title"), True) WindowObject.Minimizable = False BuyButton = gameObjs.Button( pygame.Rect(20, 20, 50, 50), gameMain.DefaultCnt.Get_RegKey( "/strings/window/expecience_store/buy_button"), 14) BuyButton.CustomColisionRectangle = True DrawnSurface = pygame.Surface((WindowObject.WindowSurface_Rect[2], WindowObject.WindowSurface_Rect[3]), pygame.SRCALPHA)
def Initialize(): global OptionsScreen_UI_Blur_Enabled global OptionsScreen_UI_Blur_Ammount global OptionsScreen_UI_Blur_Contrast global OptionsScreen_UI_PixalizateInstedOfBlur global OptionsScreen_Windows_Transitions global OptionsScreen_Window_Indicator global OptionsScreen_Scanline_Effect OptionsScreen_UI_Blur_Enabled = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_UI_Blur_Ammount = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_UI_Blur_Contrast = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_UI_PixalizateInstedOfBlur = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_Windows_Transitions = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_Window_Indicator = gameObjs.UpDownButton(0, 0, 14) OptionsScreen_Scanline_Effect = gameObjs.UpDownButton(0, 0, 14)
def Draw(Display): global DialogRectangle global CommonDisplay global CommonDisplayInitialized global CommonDisplayScreenPos global DialogOpctAnim_AnimNumb global MessageTitle global BGDarkSurfaceCreated global BGDarkSurface # -- Draw the Copy of Screen -- # Draw_ScreenshotOfGameScreen(Display) if CommonDisplayInitialized: # -- Draw the Background -- # gtk.Draw_Panel(CommonDisplay, DialogRectangle) # -- Draw the Titlebar -- # gameMain.shape.Shape_Rectangle(CommonDisplay, (10, 32, 49), (0, 0, DialogRectangle[2], 25)) gameMain.DefaultCnt.FontRender( CommonDisplay, "/PressStart2P.ttf", 18, MessageTitle, (240, 240, 240), DialogRectangle[2] / 2 - gameMain.DefaultCnt.GetFont_width( "/PressStart2P.ttf", 18, MessageTitle) / 2, 4) if Subscreen == 1: subscreen1.Draw(CommonDisplay) CommonDisplayScreenPos = (Display.get_width() / 2 - 395 / 2, Display.get_height() / 2 - 150 / 2 - DialogOpctAnim_AnimNumb * 2.5 / 3.10) if not BGDarkSurfaceCreated: BGDarkSurfaceCreated = True BGDarkSurface = pygame.Surface( (Display.get_width(), Display.get_height())) BGDarkSurface.set_alpha(DialogOpctAnim_AnimOpacity) Display.blit(BGDarkSurface, (0, 0)) Display.blit(CommonDisplay, CommonDisplayScreenPos)
def GameDraw(DISPLAY): # -- Engine Required Function global DefaultDisplay global LastErrorText global LastErrorTextDeltaTime global LastErrorTextEnabled global DefaultDisplay global CursorW global CursorH global ClearColor global ErrorMessageEnabled global ErrorMessage global ErrorMessageDelay global OverlayDialogEnabled global ScreenLastFrame global CurrentUpdate global DefaultCnt # -- Clear the Surface -- # DefaultDisplay = DISPLAY DISPLAY.fill(ClearColor) if not DefaultCnt.Get_RegKey("/OPTIONS/debug_enabled", bool): try: if not OverlayDialogEnabled: CurrentUpdate.GameDraw(DefaultDisplay) ScreenLastFrame = DefaultDisplay.copy() else: dialog.Draw(DISPLAY) except Exception as ex: WriteErrorLog(ex, "GameDraw", False) else: if not OverlayDialogEnabled: CurrentUpdate.GameDraw(DefaultDisplay) ScreenLastFrame = DefaultDisplay.copy() else: dialog.Draw(DISPLAY) # -- Render the Error Message -- # if ErrorMessageEnabled: ErrorMessageDelay += 1 gameObjs.Draw_Panel(DISPLAY, (0, 5, DISPLAY.get_width(), gameMain.DefaultCnt.GetFont_height("/PressStart2P.ttf", gameMain.DefaultCnt.Get_RegKey("/props/error_message_text_size"), ErrorMessage))) SPRITE.FontRender(DISPLAY, "/PressStart2P.ttf", gameMain.DefaultCnt.Get_RegKey("/props/error_message_text_size", int), ErrorMessage, (150, 50, 50), 0, 5, False) if ErrorMessageDelay >= gameMain.DefaultCnt.Get_RegKey("/props/error_message_delay_max", int): ErrorMessageDelay = 0 ErrorMessageEnabled = False # -- Render Cursor -- # gameMain.DefaultCnt.ImageRender(DefaultDisplay, "/cursors/{0}.png".format(str(Cursor_CurrentLevel)), Cursor_Position[0], Cursor_Position[1]) # -- Render the Transition -- # transition.Render(DefaultDisplay) if DefaultCnt.Get_RegKey("/OPTIONS/debug_enabled", bool): gameMain.DefaultCnt.FontRender(DefaultDisplay, "/PressStart2P.ttf", 10, "FPS: {0}".format(utils.FormatNumber(MAIN.clock.get_fps())), (240, 240, 240), 5, 5, backgroundColor=(5, 8, 13)) # -- Render the Error Overlay -- # if LastErrorTextEnabled: LastErrorTextDeltaTime += 1 gameMain.DefaultCnt.FontRender(DISPLAY, "/PressStart2P.ttf", 9, LastErrorText, (200, 0, 0), 5, 5, False, (10, 20, 27)) if LastErrorTextDeltaTime >= 1500: LastErrorTextDeltaTime = 0 LastErrorTextEnabled = False LastErrorText = ""
def Initialize(): global ValuesViewer ValuesViewer = gameObjs.ValuesView(pygame.Rect(0, 25, 5, 5), True) UpdateValues()
def Initialize(): global PlanetAnimation global InfosList InfosList = gameObjs.ValuesView(pygame.Rect(0, 0, 320, 200), "ceira") PlanetAnimation = utils.AnimationController(1.2)