I ran into another problem.
The code I put at the bottom of this text has been improved and perfected also thanks to the users of this forum who helped me.
I was interested in solving a problem with the Mode=Ask attribute that did not recognize me exactly in Window or FullScreen mode. This problem has been solved.
But now this is happening:
- If you choose Window, a window opens as in Debug but you can see that it is much smaller than it should be
- If you choose the FullScreen 800x600 mode for example, a full screen opens but the resolution is different, in this case 640x480 and obviously it is not clear if the opened screen is 80x600 or 640x5480 for example, but it is certainly a low resolution... anyway the debugging gives me as 640x480 against 800x600 selected
I am certainly wrong, but in detail this code does very little:
- declares a hidden 320x200 Display(10) convenience screen
- Closes and frees the resources of Display(1) which is usually the Hollywood one
- Reopens a new Display(1) asking what type of display he wants
- If the user chooses Window, it opens a Window of the resolution pre-established by the variables in play
- If the user chooses Full Screen opens a new screen of the chosen resolution
- writes all the values of the variables on the Debug
Changing ID from 1 to 5 for example the result does not change.
Also in the full screen mode some graphic glitches appear that I can not make disappear.
It is noted that the Windows Debug IDE has a display bug. You have to pass the mouse highlighting the area to show some Debug results otherwise hidden.
Any ideas?
bySpawnPPC
-------------------------------------------------------------
Code: Select all
@DISPLAY 10, {Width = 320, Height = 200, Hidden = True}
Global ScreenWidth, ScreenHeight; Variabili globali per la risoluzione dello schermo
Global WinWidth, WinHeight; Variabili globali per le dimensioni della finestra
Global XPos, YPos; Varibili globali per le dimensioni della finestra
Function SceltaDisplay()
SelectDisplay(10)
CloseDisplay(1)
FreeDisplay(1)
ScreenWidth = GetAttribute(#DISPLAY,Nil , #ATTRHOSTWIDTH); HOST S.O.
ScreenHeight = GetAttribute(#DISPLAY,Nil , #ATTRHOSTHEIGHT); HOST S.O.
DebugPrint(ScreenWidth, ScreenHeight)
Local Margine
Local GestioneLayout
If ScreenWidth <= 800
Margine = 10
GestioneLayout = 0
ElseIf ScreenWidth > 800 And ScreenWidth <= 1920
Margine = 100
GestioneLayout = 0
ElseIf ScreenWidth > 1920 And ScreenWidth <= 2560
Margine = 200
GestioneLayout = 0
ElseIf ScreenWidth > 2560
Margine = 300
GestioneLayout = 0
EndIf
DebugPrint (Margine, GestioneLayout)
WinWidth = ScreenWidth - (2 * Margine)
WinHeight = ScreenHeight - (2 * Margine)
XPos = (ScreenWidth - WinWidth) / 2
YPos = (ScreenHeight - WinHeight) / 2
DebugPrint(WinWidth, WinHeight)
DebugPrint(XPos, YPos)
Width = WinWidth
Height = WinHeight
X = XPos
Y = YPos
DebugPrint(Width, height)
DebugPrint(X, Y)
CreateDisplay(1, {Width, Height, X, Y, Title = "", Borderless = True, Fixed = True, Mode = "Ask",})
OpenDisplay(1)
SelectDisplay(1)
Local DisplayMode
DisplayMode = GetAttribute(#DISPLAY, 1, #ATTRMODE)
If DisplayMode = #DISPMODE_WINDOWED
DebugPrint("WINDOW")
ElseIf DisplayMode = #DISPMODE_FULLSCREEN
DebugPrint("FULLSCREEN")
EndIf
If DisplayMode = #DISPMODE_FULLSCREEN
ScreenWidth = GetAttribute(#DISPLAY, 1, #ATTRWIDTH)
ScreenHeight = GetAttribute(#DISPLAY, 1, #ATTRHEIGHT)
WinWidth = ScreenWidth
WinHeight = ScreenHeight
EndIf
DebugPrint(ScreenWidth, ScreenHeight)
DebugPrint(WinWidth, WinHeight)
Wait(5, #SECONDS)
End
EndFunction
Function Main()
SceltaDisplay()
; Attesa dell'evento (interazione con l'utente)
Repeat
WaitEvent
Forever
EndFunction
; Avvio del programma principale
Main()