debug DesktopScaledX(100) ; ceci renvoi '125' sur un ecran a 125% , cela signifie que la position 100 sur un ecran a 125% c'est en fait 125 !
; il faut te servir de cette fonction pour avoir une position x correcte quelque soit l'ecran
; si tu voulais positionner un texte a la colonne 50 ligne 100 quelques soit l'ecran
; il faudrai faire ceci :
Code : Tout sélectionner
; ATTENTION NE PAS OUBLIER DE COCHER LA CASE DPI dans les options de compilation
initsprite()
If OpenWindow(0, 0, 0, 200, 200, "DrawText Exemple", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(windowID(0),1,1,200,200,1,0,0)
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent)
DrawText( DesktopScaledX(50), DesktopScaledY(100), "Hello World!", RGB(255, 255, 0))
StopDrawing()
FlipBuffers()
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf

sinon ceci teste en quel pourcentage est l'ecran
Code : Tout sélectionner
if DesktopResolutionX() = 1.25 ; on test si l'ecran est en 125%
MessageRequester("Attention" , "le jeux ne supporte pas trop le zoom a 125% de votre bureau"+chr(10)+"preferez remettre a 100% dans les option d'affichage de Windows")
Endif



ou encore utiliser ce que renvoi la fonction DesktopResolutionX()
comme offset multiplicateur
si on est en 100% ça renvoi 1 donc on multiplie X et y par 1 ça ne changera donc rien
Si on est en 120% ça renvoi 1.25 ,on multiplie X et Y par 1.25 ce qui sera bon pour ce type de resolution

Code : Tout sélectionner
offsetX = DesktopResolutionX() ; on recupere le decalage qui sera de 1 pour 100% et de 1.25 pour 125%
offsetY = DesktopResolutionY()
; et on multiplie nos X et y par ce decalage
; pour afficher le Text en 50 , 100 on fera donc :
initsprite()
If OpenWindow(0, 0, 0, 200, 200, "DrawText Exemple", #PB_Window_SystemMenu | #PB_Window_ScreenCentered)
OpenWindowedScreen(windowID(0),1,1,200,200,1,0,0)
StartDrawing(ScreenOutput())
DrawingMode(#PB_2DDrawing_Transparent)
DrawText( 50 * offsetX, 100 * offsetY, "Hello World!", RGB(255, 255, 0))
StopDrawing()
FlipBuffers()
Repeat
Event = WaitWindowEvent()
Until Event = #PB_Event_CloseWindow
EndIf
vous passez votre ordinateur en 125%
vous coder votre truc sous cette resolution ..
forcement sur les ordis a 100% ça va rentrer ....
alors que l'inverse n'est pas vrais
