Full screen and the Windows GUI?

Advanced game related topics
..::Origin::..
Enthusiast
Enthusiast
Posts: 125
Joined: Sat Jun 17, 2006 3:15 pm

Full screen and the Windows GUI?

Post 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.
User avatar
Flype
Addict
Addict
Posts: 1542
Joined: Tue Jul 22, 2003 5:02 pm
Location: In a long distant galaxy

Post 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
No programming language is perfect. There is not even a single best language.
There are only languages well suited or perhaps poorly suited for particular purposes. Herbert Mayer
..::Origin::..
Enthusiast
Enthusiast
Posts: 125
Joined: Sat Jun 17, 2006 3:15 pm

Post by ..::Origin::.. »

Well, i guess its as close as i'll get, thanks.
User avatar
netmaestro
PureBasic Bullfrog
PureBasic Bullfrog
Posts: 8452
Joined: Wed Jul 06, 2005 5:42 am
Location: Fort Nelson, BC, Canada

Post 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.
BERESHEIT
Shannara
Addict
Addict
Posts: 1808
Joined: Thu Oct 30, 2003 11:19 pm
Location: Emerald Cove, Unformed

Post 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 :)
Trond
Always Here
Always Here
Posts: 7446
Joined: Mon Sep 22, 2003 6:45 pm
Location: Norway

Re: Full screen and the Windows GUI?

Post 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.
Post Reply