Multitache plien ecran
Multitache plien ecran
En attendant mieux de la part de Fred
Bon avec l'aide de Keph et Cederavic j'ai enfin reussi à créer un mode 100% multitache plien ecran sous windows !
et ce sans ce prendre la tete avec des tests !
Cela fonctionne nikel , on peut tout comme en Openscreen() choisir la resolusion , la syncro , le framerate et m^m mieu redimensionner l'ecran.
on peut quant m^m remarquer quelques saccades de temps a autre relative a ce mode comparé a un plien ecran traditionnel mais vraiment pas méchant à condition de ne pas laisser trop de taches tourner en fond pour rien .
Je vous prépare un bout de code pour expliquer ce principe ---
Merci encore à Cederavic et Keph
Bon avec l'aide de Keph et Cederavic j'ai enfin reussi à créer un mode 100% multitache plien ecran sous windows !
et ce sans ce prendre la tete avec des tests !
Cela fonctionne nikel , on peut tout comme en Openscreen() choisir la resolusion , la syncro , le framerate et m^m mieu redimensionner l'ecran.
on peut quant m^m remarquer quelques saccades de temps a autre relative a ce mode comparé a un plien ecran traditionnel mais vraiment pas méchant à condition de ne pas laisser trop de taches tourner en fond pour rien .
Je vous prépare un bout de code pour expliquer ce principe ---
Merci encore à Cederavic et Keph
Code : Tout sélectionner
InitSprite()
InitKeyboard()
iiiii.b=1
pause.b=-1
OpenScreen(1024,768,32,"")
Repeat
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(255,255,255)
Locate(10,50)
DrawText("1 Plein ecran Exclusif ")
Locate(10,70)
DrawText("2 Plein ecran Windows ")
StopDrawing()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_1) Or KeyboardPushed(#PB_Key_2) Or KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Pad2) Or KeyboardPushed(#PB_Key_Pad1)
If KeyboardPushed(#PB_Key_1) Or KeyboardPushed(#PB_Key_Pad1):choix_screen =1 :EndIf
If KeyboardPushed(#PB_Key_2) Or KeyboardPushed(#PB_Key_Pad2):choix_screen =2 :EndIf
If KeyboardPushed(#PB_Key_Escape) :End :EndIf
CloseScreen()
If choix_screen=2
Global xxx.w,yyy.w,bits.b,sync.b
xxx=1024
yyy=768
bits=32
sync=75
ChangeResolution(xxx,yyy,bits,sync)
OpenWindow(0, 0 ,0,xxx,yyy , #PB_Window_ScreenCentered |#PB_Window_WindowCentered| #PB_Window_BorderLess , "") ; pour une cran dana sun fenetre
OpenWindowedScreen(WindowID(0), 0, 0,1024,768, 1, 0, 0)
SetFrameRate(sync)
ShowCursor_(#False)
ActivateWindow()
WindowEvent()
EndIf
If choix_screen=1
SetRefreshRate(75)
OpenScreen(1024,768,32,"")
SetFrameRate(75)
EndIf
Repeat
If choix_screen=2 :ActivateWindow(): EndIf
ExamineKeyboard()
If KeyboardReleased(#PB_Key_P)
iiiii=1
EndIf
If iiiii=1
If KeyboardPushed(#PB_Key_P)
pause = -pause
Delay(200)
iiiii=0
EndIf
EndIf
If pause =-1
ClearScreen(0,0,0)
;code boucle principale
StartDrawing(ScreenOutput())
DrawingMode(1)
Box(Random(900),Random(600),Random(100),Random(100),RGB(Random(255),Random(255),Random(255)))
FrontColor(255,255,255)
Locate(10,50)
DrawText("P pause ")
Locate(10,30)
DrawText("Tab + ALT pour tester le Multitache ")
Locate(10,10)
If choix_screen=2
DrawText("Plein ecran Multitache ")
EndIf
If choix_screen=1
DrawText("Plein ecran Exclusif ")
EndIf
StopDrawing()
; ------------------
If choix_screen=2: WaitForVSync():EndIf
FlipBuffers()
Else
If choix_screen=2 :ActivateWindow(): EndIf
FlipBuffers()
Delay(10)
EndIf
Until KeyboardPushed(#PB_Key_Escape)
C'est l'excellent choix pour la resolusion sous windobe creer par KephSinon, j'ai du mettre en commentaire la ligne "ChangeResolution(xxx,yyy,bits,sync)" pour l'executer. C'est quoi ?
http://103683.free.fr/purebasic/Resolution.zip (4 Ko).
Code : Tout sélectionner
InitSprite()
InitKeyboard()
iiiii.b=1
pause.b=-1
OpenScreen(1024,768,32,"")
Repeat
StartDrawing(ScreenOutput())
DrawingMode(1)
FrontColor(255,255,255)
Locate(10,50)
DrawText("1 Plein ecran Exclusif ")
Locate(10,70)
DrawText("2 Plein ecran Windows ")
StopDrawing()
FlipBuffers()
ExamineKeyboard()
Until KeyboardPushed(#PB_Key_1) Or KeyboardPushed(#PB_Key_2) Or KeyboardPushed(#PB_Key_Escape) Or KeyboardPushed(#PB_Key_Pad2) Or KeyboardPushed(#PB_Key_Pad1)
If KeyboardPushed(#PB_Key_1) Or KeyboardPushed(#PB_Key_Pad1):choix_screen =1 :EndIf
If KeyboardPushed(#PB_Key_2) Or KeyboardPushed(#PB_Key_Pad2):choix_screen =2 :EndIf
If KeyboardPushed(#PB_Key_Escape) :End :EndIf
CloseScreen()
If choix_screen=2
Global xxx.w,yyy.w,bits.b,sync.b
; xxx=1024
; yyy=768
xxx=GetSystemMetrics_(0)
yyy=GetSystemMetrics_(1)
bits=32
sync=75
ChangeResolution(xxx,yyy,bits,sync)
OpenWindow(0, 0 ,0,xxx,yyy , #PB_Window_ScreenCentered |#PB_Window_WindowCentered| #PB_Window_BorderLess , "") ; pour une cran dana sun fenetre
OpenWindowedScreen(WindowID(0), 0, 0,1024,768, 1, 0, 0)
SetFrameRate(sync)
ShowCursor_(#False)
ActivateWindow()
WindowEvent()
EndIf
If choix_screen=1
SetRefreshRate(75)
OpenScreen(1024,768,32,"")
SetFrameRate(75)
EndIf
Repeat
ExamineKeyboard()
If KeyboardReleased(#PB_Key_P)
iiiii=1
EndIf
If iiiii=1
If KeyboardPushed(#PB_Key_P)
pause = -pause
Delay(200)
iiiii=0
EndIf
EndIf
If pause =-1
ClearScreen(0,0,0)
;code boucle principale
StartDrawing(ScreenOutput())
DrawingMode(1)
Box(Random(900),Random(600),Random(100),Random(100),RGB(Random(255),Random(255),Random(255)))
FrontColor(255,255,255)
Locate(10,50)
DrawText("P pause ")
Locate(10,30)
DrawText("Tab + ALT pour tester le Multitache ")
Locate(10,10)
If choix_screen=2
DrawText("Plein ecran Multitache ")
EndIf
If choix_screen=1
DrawText("Plein ecran Exclusif ")
EndIf
StopDrawing()
; ------------------
If choix_screen=2:ActivateWindow():WindowEvent(): WaitForVSync():EndIf
FlipBuffers()
Else
If choix_screen=2 :WindowEvent() :EndIf
FlipBuffers()
Delay(10)
EndIf
Until KeyboardPushed(#PB_Key_Escape)
C'est tout simplement quand ton système execute plusieurs programmes en même temps, et que tu passe facilement de l'un à l'autre.
Un programme peut être plus ou moins favorable au multitâche: par exemple, un jeu en plein écran qui crashe dès que tu fait alt+tab n'est PAS favorable au multitâche
Ce que Marcus est en train de faire, c'est un prog plein écran qui se laisse bien réduire dans la barre des tâches, et qui reprend son cours gentiment quand on le rappelle
Un programme peut être plus ou moins favorable au multitâche: par exemple, un jeu en plein écran qui crashe dès que tu fait alt+tab n'est PAS favorable au multitâche
Ce que Marcus est en train de faire, c'est un prog plein écran qui se laisse bien réduire dans la barre des tâches, et qui reprend son cours gentiment quand on le rappelle
Le chaos l'emporte toujours sur l'ordre
parcequ'il est mieux organisé.
(Ly Tin Wheedle)
parcequ'il est mieux organisé.
(Ly Tin Wheedle)