Page 1 of 1

Full screen and the Windows GUI?

Posted: Thu Jul 13, 2006 12:51 pm
by ..::Origin::..
I got a nudge from a friend that all the so called 'professionally made' games use the Windows GUI, with different images. Such as a Textox-Different font, Different background,borders etc.

My question is, In my game, how can i get a full screen window, and being able to use the Win32 gui?

Thanks,
Origin.

Posted: Thu Jul 13, 2006 1:50 pm
by Flype
hello, look at this squeleton :

Code: Select all

; DirectX Inits

If Not InitScreen() Or Not InitSprite() Or Not InitKeyboard()
  MessageRequester("Error", "DirectX Failure !")
  End
EndIf

; Examining User Desktops

nDesktop.l = ExamineDesktops()

If Not nDesktop
  MessageRequester("Error", "Desktop Failure !")
  End
EndIf

For i = 0 To nDesktop - 1
  Debug DesktopName(i)
  Debug DesktopWidth(i)
  Debug DesktopHeight(i)
  Debug DesktopDepth(i)
  Debug DesktopFrequency(i)
Next

; Create a GUI window

#DESKTOP = 0
#WINDOW  = 0
#SPRITE  = 0
#EXIT    = 0
#ABOUT   = 1

If OpenWindow(#WINDOW, 0, 0, DesktopWidth(#DESKTOP), DesktopHeight(#DESKTOP), "MyGame", #PB_Window_BorderLess)
  
  ; Create a GagdetList
  
  If CreateGadgetList(WindowID(#WINDOW))
    Frame3DGadget(#PB_Any, 5, 5, WindowWidth(#WINDOW)-10, 50, "Game Menu")
    ButtonGadget(#EXIT,  15, 22, 50, 25, "Exit")
    ButtonGadget(#ABOUT, 80, 22, 50, 25, "About")
  EndIf
  
  ; Create a windowed screen (DirectX)
  
  If OpenWindowedScreen(WindowID(#WINDOW), 0, 60, WindowWidth(#WINDOW), WindowHeight(#WINDOW)-60, 0, 0, 0)
    
    ; Create a simple sprite
    
    If CreateSprite(#SPRITE, 64, 64) And StartDrawing(SpriteOutput(#SPRITE))
      Box(0, 0, 64, 64, #Red)
      StopDrawing()
    EndIf
    
    Repeat ; Process Game Loop
      
      Repeat ; Process Window Events 
        Select WindowEvent()
          Case #PB_Event_Gadget
            Select EventGadget()
              Case #EXIT:  Exit = #True
              Case #ABOUT: MessageRequester("About", "MyGame", #MB_ICONINFORMATION)
            EndSelect
          Case #PB_Event_CloseWindow
            Exit = #True
          Case #Null
            Break
        EndSelect
      ForEver
      
      FlipBuffers() 
      ClearScreen(#Blue)
      
      If ExamineKeyboard()
        If KeyboardPushed(#PB_Key_All)
          Exit = #True
        EndIf
      EndIf
      
      DisplaySprite(#SPRITE, WindowMouseX(#WINDOW), WindowMouseY(#WINDOW)-60)
      
      Delay(1)
      
    Until Exit = #True
    
  EndIf
  
EndIf

End

Posted: Fri Jul 14, 2006 4:08 am
by ..::Origin::..
Well, i guess its as close as i'll get, thanks.

Posted: Fri Jul 14, 2006 4:25 am
by netmaestro
There was a library included in the PBOSL for PB 3.94 called "ScreenGadgets" which enabled windows GUI controls to be used in fullscreen games but so far it doesn't seem to have made the transition to the PBOSL version 4.0 libs. Can't say if it will in the future or not, possibly you could find out who authored it and contact him.

Posted: Sat Jul 15, 2006 6:56 am
by Shannara
..::Origin::.. wrote:Well, i guess its as close as i'll get, thanks.
Also, DirectX9 has a GUI class. It has been only accessable for VC++ users, but if only PB could tap into such a nice sdk :)

There is a beginnings of the DX9 sdk for PB found @ http://www.purebasic.fr/english/viewtopic.php?t=22667 ... but I did not see the DX9 GUI sample converted yet :)

Re: Full screen and the Windows GUI?

Posted: Sat Jul 15, 2006 2:41 pm
by Trond
..::Origin::.. wrote:I got a nudge from a friend that all the so called 'professionally made' games use the Windows GUI, with different images. Such as a Textox-Different font, Different background,borders etc.

My question is, In my game, how can i get a full screen window, and being able to use the Win32 gui?

Thanks,
Origin.
Actually, usually not.