currently my program (emulator) do this:
-close window
-openscreen (not windowed)
-create menu totally controlled by keyboard (keyboardPushed)
returning to window mode:
-close screen
-create window
-create menu
I'm wondering if is possible instead close window, keep it opened (resizing) and catch the events and visualize the menu.
I ask this because i saw a program, that "seems" do that. Obviously the menu in that program look bigger due the change of resolution to 640x480.
Is this something posible?
The code bellow is just an ugly example, of course does not work for what i asked, because menu is always created on window (as expected).
Code: Select all
;On my computer run with Subsystem = OpenGL
;Using Windows with PB 6
hWndM=OpenWindow(0, 200, 200, 300, 300, "Test", #PB_Window_SystemMenu | #PB_Window_MinimizeGadget | #PB_Window_MaximizeGadget)
CanvasGadget(0,0,0,300,300)
Global TESTSCREEN
InitSprite()
If ExamineScreenModes()
While NextScreenMode()
If ScreenModeWidth()=640 And ScreenModeHeight()=480
TESTSCREEN=1:ExamineDesktops():TESTSCREEN=TESTSCREEN * DesktopDepth(0)
EndIf
Wend
EndIf
If TESTSCREEN = 0:End:EndIf
Procedure menu()
If Not IsMenu(0)
CreateMenu(0,WindowID(0))
MenuTitle("Full Screen")
MenuItem(10,"640 x 480 x "+Str(TESTSCREEN))
MenuItem(20,"win")
EndIf
EndProcedure
Procedure fullscr()
StopDrawing()
FreeGadget(0)
ResizeWindow(0,200,200,11,11)
OpenScreen(640,480,32,"")
HideWindow(0,1)
FreeMenu(0)
EndProcedure
Procedure window()
StopDrawing()
If WindowHeight(0) <> 300
CloseScreen()
EndIf
CanvasGadget(0,0,0,300,300)
ResizeWindow(0,200,200,300,300)
HideWindow(0,0)
EndProcedure
Procedure execute()
If WindowHeight(0) = 300
StartDrawing(CanvasOutput(0))
StopDrawing()
Else
StartDrawing(ScreenOutput())
DrawText(100,100,"MOUSEWELL = RECREATE MENU")
DrawText(100,120,"F12 = EXIT FULLSCREEN")
StopDrawing()
FlipBuffers()
EndIf
EndProcedure
Procedure Events(hWndM, uMsg, wParam, lParam)
result = #PB_ProcessPureBasicEvents
Select uMsg
Case #WM_MOUSEWHEEL
If WindowHeight(0) < 300
If Not IsMenu(0)
menu()
EndIf
EndIf
EndSelect
ProcedureReturn result
EndProcedure
menu()
SetWindowCallback(@Events())
AddKeyboardShortcut(0, #PB_Shortcut_F12, 20)
Repeat
Event = WaitWindowEvent()
If Event= #PB_Event_Menu
If EventMenu()=10
fullscr()
ElseIf EventMenu()=20
window()
EndIf
EndIf
execute()
SetActiveWindow(0)
Until Event=#PB_Event_CloseWindow