Added the book poster to the launcher
This commit is contained in:
parent
c78f3bd7a7
commit
0701482a40
@ -1,7 +1,7 @@
|
||||
#NoTrayIcon
|
||||
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
#AutoIt3Wrapper_Icon=enderal.ico
|
||||
#AutoIt3Wrapper_Res_File_Add=background.jpg, RT_RCDATA, BACKGROUND
|
||||
#AutoIt3Wrapper_Res_File_Add=background_poster.jpg, RT_RCDATA, BACKGROUND
|
||||
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
|
||||
|
||||
#include <GUIConstantsEx.au3>
|
||||
@ -28,14 +28,24 @@
|
||||
; ============================================
|
||||
; Constants and Global Variables
|
||||
; ============================================
|
||||
Global Const $LAUNCHER_WIDTH = 945
|
||||
; The window keeps the aspect ratio of the background artwork, which is shown without a crop
|
||||
Global Const $LAUNCHER_WIDTH = 1030
|
||||
Global Const $LAUNCHER_HEIGHT = 578
|
||||
; Distance of the poster and of the button menu from the window edges
|
||||
Global Const $SIDE_MARGIN = 60
|
||||
Global Const $POSTER_WIDTH = 250
|
||||
Global Const $POSTER_HEIGHT = 440
|
||||
Global Const $POSTER_URL = "https://twelfthworld.store/"
|
||||
Global Const $SETTINGS_MARGIN = 50
|
||||
Global Const $SETTINGS_WIDTH = $LAUNCHER_WIDTH - ($SETTINGS_MARGIN * 2)
|
||||
Global Const $SETTINGS_HEIGHT = $LAUNCHER_HEIGHT - ($SETTINGS_MARGIN * 2)
|
||||
Global Const $TAB_LEFT_MARGIN = 42
|
||||
Global Const $TAB_TOP_MARGIN = 74
|
||||
Global Const $TAB_ROW_HEIGHT = 42
|
||||
; Two equal columns fill the width of the settings window
|
||||
Global Const $TAB_COLUMN_GAP = 40
|
||||
Global Const $TAB_COLUMN_WIDTH = ($SETTINGS_WIDTH - $TAB_LEFT_MARGIN * 2 - $TAB_COLUMN_GAP) / 2
|
||||
Global Const $TAB_RIGHT_COLUMN_X = $TAB_LEFT_MARGIN + $TAB_COLUMN_WIDTH + $TAB_COLUMN_GAP
|
||||
Global Const $LOCALAPPDATA = EnvGet("LOCALAPPDATA")
|
||||
Global Const $REG_KEY = "HKEY_CURRENT_USER\Software\SureAI\EnderalSE"
|
||||
Global Const $REG_INSTALL_PATH = "Install_Path"
|
||||
@ -75,6 +85,7 @@ Global $lblCredits, $lblWiki, $lblSupport, $lblChangelog
|
||||
Global $lblMinimizeShadow, $lblCloseShadow
|
||||
Global $lblCreditsShadow, $lblWikiShadow, $lblSupportShadow, $lblChangelogShadow
|
||||
Global $hBackgroundPic = 0
|
||||
Global $picPoster = -1
|
||||
|
||||
; Settings controls
|
||||
Global $tabSettings
|
||||
@ -740,10 +751,6 @@ Func StartupChecks()
|
||||
CheckPluginsFile()
|
||||
CheckINIFiles()
|
||||
CheckSaveDirectory()
|
||||
|
||||
If $bPendingBranchUpdate Then
|
||||
MsgBox(48, "Enderal Special Edition", "Enderal Special Edition is scheduled for update to version 2.1+ which requires starting a new game. If you have an ongoing savegame, please switch to the 2.0.12.4 branch.")
|
||||
EndIf
|
||||
EndFunc
|
||||
|
||||
Func CheckRegistryPaths()
|
||||
@ -964,6 +971,9 @@ Func CreateMainWindow()
|
||||
; Set background image
|
||||
SetBackgroundImage()
|
||||
|
||||
; Poster link, created before the labels, so that they stay on top of it
|
||||
CreatePosterLink()
|
||||
|
||||
; Create top link bar on the left
|
||||
Local $linkBarY = 10
|
||||
Local $linkSpacing = 80
|
||||
@ -1022,14 +1032,19 @@ Func CreateMainWindow()
|
||||
GUICtrlSetCursor(-1, 0)
|
||||
|
||||
; Create close and minimize buttons at top right
|
||||
; Em dash: the underscore glyph falls below the label and is not painted.
|
||||
; The dash sits low in the line box, so the label starts above the close label.
|
||||
Local $sMinimize = ChrW(0x2014)
|
||||
Local $minimizeY = 2
|
||||
|
||||
; Minimize - shadow first, then main label
|
||||
$lblMinimizeShadow = GUICtrlCreateLabel("_", $LAUNCHER_WIDTH - 60 + 1, 5 + 1, 25, 25, $SS_CENTER)
|
||||
$lblMinimizeShadow = GUICtrlCreateLabel($sMinimize, $LAUNCHER_WIDTH - 60 + 1, $minimizeY + 1, 25, 25, $SS_CENTER)
|
||||
GUICtrlSetFont(-1, 14, 700)
|
||||
GUICtrlSetColor(-1, 0x000000)
|
||||
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
|
||||
GUICtrlSetCursor(-1, 0)
|
||||
|
||||
$btnMinimize = GUICtrlCreateLabel("_", $LAUNCHER_WIDTH - 60, 5, 25, 25, $SS_CENTER)
|
||||
$btnMinimize = GUICtrlCreateLabel($sMinimize, $LAUNCHER_WIDTH - 60, $minimizeY, 25, 25, $SS_CENTER)
|
||||
GUICtrlSetFont(-1, 14, 700)
|
||||
GUICtrlSetColor(-1, 0xFFFFFF)
|
||||
GUICtrlSetBkColor(-1, $GUI_BKCOLOR_TRANSPARENT)
|
||||
@ -1054,7 +1069,7 @@ Func CreateMainWindow()
|
||||
|
||||
Local $btnWidth = 200
|
||||
Local $btnHeight = 82
|
||||
Local $btnX = $LAUNCHER_WIDTH - $btnWidth - 60
|
||||
Local $btnX = $LAUNCHER_WIDTH - $btnWidth - $SIDE_MARGIN
|
||||
Local $btnStartY = $LAUNCHER_HEIGHT - 420
|
||||
|
||||
Local $sDestinationFile = $sTempDir & "play.bmp"
|
||||
@ -1123,8 +1138,8 @@ Func SetBackgroundImage()
|
||||
; Extract background from embedded resource to temp
|
||||
Local $sTempDir = @TempDir & "\EnderalLauncher\"
|
||||
DirCreate($sTempDir)
|
||||
Local $bgFile = $sTempDir & "background.jpg"
|
||||
FileInstall("background.jpg", $bgFile, 1)
|
||||
Local $bgFile = $sTempDir & "background_poster.jpg"
|
||||
FileInstall("background_poster.jpg", $bgFile, 1)
|
||||
|
||||
If FileExists($bgFile) Then
|
||||
Local $hImage = _GDIPlus_ImageLoadFromFile($bgFile)
|
||||
@ -1167,6 +1182,35 @@ Func SetBackgroundImage()
|
||||
EndIf
|
||||
EndFunc
|
||||
|
||||
Func CreatePosterLink()
|
||||
; Poster on the left, symmetrical to the button menu on the right
|
||||
Local $sTempDir = @TempDir & "\EnderalLauncher\"
|
||||
DirCreate($sTempDir)
|
||||
Local $posterFile = $sTempDir & "poster.jpg"
|
||||
FileInstall("poster.jpg", $posterFile, 1)
|
||||
If Not FileExists($posterFile) Then Return
|
||||
|
||||
Local $hImage = _GDIPlus_ImageLoadFromFile($posterFile)
|
||||
If Not $hImage Then Return
|
||||
|
||||
Local $hGraphic = _GDIPlus_GraphicsCreateFromHWND($hMainGUI)
|
||||
Local $hBitmap = _GDIPlus_BitmapCreateFromGraphics($POSTER_WIDTH, $POSTER_HEIGHT, $hGraphic)
|
||||
Local $hBuffer = _GDIPlus_ImageGetGraphicsContext($hBitmap)
|
||||
_GDIPlus_GraphicsSetInterpolationMode($hBuffer, $GDIP_INTERPOLATIONMODE_HIGHQUALITYBICUBIC)
|
||||
_GDIPlus_GraphicsDrawImageRect($hBuffer, $hImage, 0, 0, $POSTER_WIDTH, $POSTER_HEIGHT)
|
||||
|
||||
Local $hGDIBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBitmap)
|
||||
$picPoster = GUICtrlCreatePic("", $SIDE_MARGIN, ($LAUNCHER_HEIGHT - $POSTER_HEIGHT) / 2, $POSTER_WIDTH, $POSTER_HEIGHT)
|
||||
_SetBitmapToCtrl($picPoster, $hGDIBitmap)
|
||||
GUICtrlSetCursor($picPoster, 0)
|
||||
|
||||
_WinAPI_DeleteObject($hGDIBitmap)
|
||||
_GDIPlus_GraphicsDispose($hBuffer)
|
||||
_GDIPlus_BitmapDispose($hBitmap)
|
||||
_GDIPlus_GraphicsDispose($hGraphic)
|
||||
_GDIPlus_ImageDispose($hImage)
|
||||
EndFunc
|
||||
|
||||
Func _SetBitmapToCtrl($idPic, $hBitmap)
|
||||
Local $hWnd = GUICtrlGetHandle($idPic)
|
||||
_SendMessage($hWnd, 0x0172, 0, $hBitmap)
|
||||
@ -1230,15 +1274,17 @@ Func CreateDisplayControls()
|
||||
$chkWindowed = GUICtrlCreateCheckbox("Windowed Mode", $leftMargin, $topMargin + $rowHeight * 2, 150, 20)
|
||||
|
||||
; Detail group
|
||||
Local $columnWidth = 370
|
||||
Local $columnWidth = $TAB_COLUMN_WIDTH
|
||||
GUICtrlCreateGroup("Detail Presets", $leftMargin, $topMargin + $rowHeight * 3, $columnWidth, 80)
|
||||
Local $detailBtnY = $topMargin + $rowHeight * 3 + 30
|
||||
Local $detailBtnWidth = 85
|
||||
; Four buttons fill the group, with an inset of 8 and gaps of 2
|
||||
Local $detailBtnWidth = Int(($columnWidth - 22) / 4)
|
||||
Local $detailBtnPitch = $detailBtnWidth + 2
|
||||
Local $detailBtnHeight = 32
|
||||
$btnLow = GUICtrlCreateButton("Low", $leftMargin + 8, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnMedium = GUICtrlCreateButton("Medium", $leftMargin + 95, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnHigh = GUICtrlCreateButton("High", $leftMargin + 182, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnUltra = GUICtrlCreateButton("Ultra", $leftMargin + 269, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnMedium = GUICtrlCreateButton("Medium", $leftMargin + 8 + $detailBtnPitch, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnHigh = GUICtrlCreateButton("High", $leftMargin + 8 + $detailBtnPitch * 2, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
$btnUltra = GUICtrlCreateButton("Ultra", $leftMargin + 8 + $detailBtnPitch * 3, $detailBtnY, $detailBtnWidth, $detailBtnHeight)
|
||||
GUICtrlCreateGroup("", -99, -99, 1, 1)
|
||||
|
||||
; SSE Display Tweaks group
|
||||
@ -1247,18 +1293,18 @@ Func CreateDisplayControls()
|
||||
$chkSSEDisplayTweaks = GUICtrlCreateCheckbox("Enable", $leftMargin + 10, $sseGroupY + 25, 200, 20)
|
||||
GUICtrlSetTip(-1, "Enables support for refresh rates higher than 60 Hz.")
|
||||
$lblFramerateLimit = GUICtrlCreateLabel("Framerate limit:", $leftMargin + 10, $sseGroupY + 55, 110, 20)
|
||||
$sldFramerateLimit = GUICtrlCreateSlider($leftMargin + 130, $sseGroupY + 50, 185, 25)
|
||||
$sldFramerateLimit = GUICtrlCreateSlider($leftMargin + 130, $sseGroupY + 50, $columnWidth - 185, 25)
|
||||
GUICtrlSetLimit($sldFramerateLimit, @DesktopRefresh, 30)
|
||||
$lblFramerateLimitValue = GUICtrlCreateLabel("60", $leftMargin + 320, $sseGroupY + 55, 35, 20)
|
||||
$lblFramerateLimitValue = GUICtrlCreateLabel("60", $leftMargin + $columnWidth - 50, $sseGroupY + 55, 35, 20)
|
||||
GUICtrlCreateGroup("", -99, -99, 1, 1)
|
||||
EndFunc
|
||||
|
||||
Func CreateRenderingControls()
|
||||
; Position on right side of Display tab
|
||||
Local $leftMargin = $TAB_LEFT_MARGIN + 370 + 40
|
||||
Local $leftMargin = $TAB_RIGHT_COLUMN_X
|
||||
Local $topMargin = $TAB_TOP_MARGIN
|
||||
Local $rowHeight = $TAB_ROW_HEIGHT
|
||||
Local $columnWidth = 370
|
||||
Local $columnWidth = $TAB_COLUMN_WIDTH
|
||||
|
||||
$chk64bitRT = GUICtrlCreateCheckbox("64-bit RenderTarget", $leftMargin, $topMargin, $columnWidth - 20, 20)
|
||||
GUICtrlSetTip(-1, "Uses 64-bit precision for HDR rendering instead of 32-bit." & @CRLF & "Reduces color banding in skies and gradients. Uses more VRAM.")
|
||||
@ -1277,8 +1323,8 @@ Func CreateControlsControls()
|
||||
Local $leftMargin = $TAB_LEFT_MARGIN
|
||||
Local $topMargin = $TAB_TOP_MARGIN
|
||||
Local $rowHeight = $TAB_ROW_HEIGHT
|
||||
Local $columnWidth = 370
|
||||
Local $rightMargin = $leftMargin + $columnWidth + 20
|
||||
Local $columnWidth = $TAB_COLUMN_WIDTH
|
||||
Local $rightMargin = $TAB_RIGHT_COLUMN_X
|
||||
|
||||
; Controls group
|
||||
GUICtrlCreateGroup("Controls", $leftMargin, $topMargin, $columnWidth, 80)
|
||||
@ -1310,17 +1356,17 @@ EndFunc
|
||||
Func CreatePluginsControls()
|
||||
Local $leftMargin = $TAB_LEFT_MARGIN
|
||||
Local $topMargin = 58
|
||||
Local $listWidth = 560
|
||||
Local $sideWidth = 198
|
||||
Local $listWidth = $SETTINGS_WIDTH - $TAB_LEFT_MARGIN * 2 - 20 - $sideWidth
|
||||
Local $listHeight = 340
|
||||
Local $sideX = $leftMargin + $listWidth + 20
|
||||
Local $sideWidth = 198
|
||||
Local $btnHeight = 32
|
||||
|
||||
$lvPlugins = GUICtrlCreateListView("Plugin|Type", $leftMargin, $topMargin, $listWidth, $listHeight, _
|
||||
BitOR($LVS_REPORT, $LVS_SINGLESEL, $LVS_SHOWSELALWAYS, $LVS_NOSORTHEADER), _
|
||||
BitOR($LVS_EX_CHECKBOXES, $LVS_EX_FULLROWSELECT, $LVS_EX_DOUBLEBUFFER))
|
||||
$hLvPlugins = GUICtrlGetHandle($lvPlugins)
|
||||
_GUICtrlListView_SetColumnWidth($hLvPlugins, 0, 420)
|
||||
_GUICtrlListView_SetColumnWidth($hLvPlugins, 0, $listWidth - 124)
|
||||
_GUICtrlListView_SetColumnWidth($hLvPlugins, 1, 120)
|
||||
CreatePluginStateImages()
|
||||
|
||||
@ -1960,6 +2006,9 @@ Func MainLoop()
|
||||
Case $lblChangelog, $lblChangelogShadow
|
||||
ShellExecute("https://mod.pub/enderal-se/38/changelogs")
|
||||
|
||||
Case $picPoster
|
||||
ShellExecute($POSTER_URL)
|
||||
|
||||
Case $btnSave
|
||||
SaveSettings()
|
||||
HideSettings()
|
||||
@ -2282,7 +2331,7 @@ Func LaunchGame()
|
||||
; Create launching modal (aligned with main buttons)
|
||||
Local $modalWidth = 200
|
||||
Local $modalHeight = 70
|
||||
Local $modalX = $LAUNCHER_WIDTH - $modalWidth - 60
|
||||
Local $modalX = $LAUNCHER_WIDTH - $modalWidth - $SIDE_MARGIN
|
||||
Local $modalY = ($LAUNCHER_HEIGHT - $modalHeight) / 2
|
||||
Local $hLaunchingGUI = GUICreate("", $modalWidth, $modalHeight, $modalX, $modalY, $WS_POPUP, $WS_EX_MDICHILD, $hMainGUI)
|
||||
GUISetBkColor(0x1A1A1A, $hLaunchingGUI)
|
||||
|
||||
BIN
source/Launcher/background_poster.jpg
(Stored with Git LFS)
Normal file
BIN
source/Launcher/background_poster.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
source/Launcher/background_poster.xcf
(Stored with Git LFS)
Normal file
BIN
source/Launcher/background_poster.xcf
(Stored with Git LFS)
Normal file
Binary file not shown.
BIN
source/Launcher/poster.jpg
(Stored with Git LFS)
Normal file
BIN
source/Launcher/poster.jpg
(Stored with Git LFS)
Normal file
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user