* Cleanup for PR
* Demo shows a Dialog with not implemented methods at startup
This commit is contained in:
parent
2204914abf
commit
03c453ac7d
21
README.md
21
README.md
@ -1,24 +1,3 @@
|
||||
### x11-window-management branch
|
||||
|
||||
#### New GDScript Methods for the OS Class:
|
||||
* int OS.get_screen_count()
|
||||
* int OS.get_screen()
|
||||
* void OS.set_screen(int screen)
|
||||
* Vector2 OS.get_screen_position(int screen=0)
|
||||
* Vector2 OS.get_screen_size(int screen=0)
|
||||
* Vector2 OS.get_window_position()
|
||||
* void OS.set_window_position(Vector2 position)
|
||||
* Vector2 OS.get_window_size()
|
||||
* void OS.set_window_size(Vector2 size)
|
||||
* void OS.set_fullscreen(bool enabled)
|
||||
* bool OS.is_fullscreen()
|
||||
|
||||
#### Demo
|
||||
A demo/test is available at "demos/misc/window-management"
|
||||
|
||||
#### Scons Commandline
|
||||
'''scons p=x11 experimental_wm_api=yes'''
|
||||
|
||||
![GODOT](/logo.png)
|
||||
|
||||
### The Engine
|
||||
|
@ -19,6 +19,9 @@ func _fixed_process(delta):
|
||||
if(OS.is_maximized()):
|
||||
modetext += "Maximized\n"
|
||||
|
||||
if(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED):
|
||||
modetext += "MouseGrab\n"
|
||||
|
||||
get_node("Label_Mode").set_text(modetext)
|
||||
|
||||
get_node("Label_Position").set_text( str("Position:\n", OS.get_window_position() ) )
|
||||
@ -65,8 +68,71 @@ func _fixed_process(delta):
|
||||
get_node("Button_Mouse_Grab").set_pressed( Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED )
|
||||
|
||||
|
||||
func check_wm_api():
|
||||
var s = ""
|
||||
if( !OS.has_method("get_screen_count") ):
|
||||
s += " - get_screen_count()\n"
|
||||
|
||||
if( !OS.has_method("get_screen") ):
|
||||
s += " - get_screen()\n"
|
||||
|
||||
if( !OS.has_method("set_screen") ):
|
||||
s += " - set_screen()\n"
|
||||
|
||||
if( !OS.has_method("get_screen_position") ):
|
||||
s += " - get_screen_position()\n"
|
||||
|
||||
if( !OS.has_method("get_screen_size") ):
|
||||
s += " - get_screen_size()\n"
|
||||
|
||||
if( !OS.has_method("get_window_position") ):
|
||||
s += " - get_window_position()\n"
|
||||
|
||||
if( !OS.has_method("set_window_position") ):
|
||||
s += " - set_window_position()\n"
|
||||
|
||||
if( !OS.has_method("get_window_size") ):
|
||||
s += " - get_window_size()\n"
|
||||
|
||||
if( !OS.has_method("set_window_size") ):
|
||||
s += " - set_window_size()\n"
|
||||
|
||||
if( !OS.has_method("set_fullscreen") ):
|
||||
s += " - set_fullscreen()\n"
|
||||
|
||||
if( !OS.has_method("is_fullscreen") ):
|
||||
s += " - is_fullscreen()\n"
|
||||
|
||||
if( !OS.has_method("set_resizable") ):
|
||||
s += " - set_resizable()\n"
|
||||
|
||||
if( !OS.has_method("is_resizable") ):
|
||||
s += " - is_resizable()\n"
|
||||
|
||||
if( !OS.has_method("set_minimized") ):
|
||||
s += " - set_minimized()\n"
|
||||
|
||||
if( !OS.has_method("is_minimized") ):
|
||||
s += " - is_minimized()\n"
|
||||
|
||||
if( !OS.has_method("set_maximized") ):
|
||||
s += " - set_maximized()\n"
|
||||
|
||||
if( !OS.has_method("is_maximized") ):
|
||||
s += " - is_maximized()\n"
|
||||
|
||||
if( s.length() == 0 ):
|
||||
return true
|
||||
else:
|
||||
var text = get_node("ImplementationDialog/Text").get_text()
|
||||
get_node("ImplementationDialog/Text").set_text( text + s )
|
||||
get_node("ImplementationDialog").show()
|
||||
return false
|
||||
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
if( check_wm_api() ):
|
||||
set_fixed_process(true)
|
||||
|
||||
|
||||
func _on_Button_MoveTo_pressed():
|
||||
|
@ -76,3 +76,4 @@ func _ready():
|
||||
set_process_input(true)
|
||||
|
||||
state = STATE_MENU
|
||||
|
||||
|
@ -1,98 +0,0 @@
|
||||
var parent
|
||||
|
||||
func printdebug():
|
||||
|
||||
var s
|
||||
|
||||
if(parent.state == parent.STATE_GAME):
|
||||
s = str( "TIME_FPS: ", Performance.get_monitor(Performance.TIME_FPS), "\n")
|
||||
s += str("OBJECT_COUNT: ", Performance.get_monitor(Performance.OBJECT_COUNT), "\n")
|
||||
s += str("OBJECT_RESOURCE_COUNT : ", Performance.get_monitor(Performance.OBJECT_RESOURCE_COUNT), "\n")
|
||||
s += str("OBJECT_NODE_COUNT : ", Performance.get_monitor(Performance.OBJECT_NODE_COUNT), "\n")
|
||||
s += str("RENDER_OBJECTS_IN_FRAME : ", Performance.get_monitor(Performance.RENDER_OBJECTS_IN_FRAME), "\n")
|
||||
s += str("RENDER_VERTICES_IN_FRAME : ", Performance.get_monitor(Performance.RENDER_VERTICES_IN_FRAME), "\n")
|
||||
s += str("RENDER_DRAW_CALLS_IN_FRAME : ", Performance.get_monitor(Performance.RENDER_DRAW_CALLS_IN_FRAME), "\n")
|
||||
s += str("RENDER_VERTICES_IN_FRAME : ", Performance.get_monitor(Performance.RENDER_VERTICES_IN_FRAME), "\n")
|
||||
# s += str("RENDER_USAGE_VIDEO_MEM_TOTAL : ", Performance.get_monitor(Performance.RENDER_USAGE_VIDEO_MEM_TOTAL), "\n")
|
||||
# s += str("RENDER_VIDEO_MEM_USED : ", Performance.get_monitor(Performance.RENDER_VIDEO_MEM_USED), "\n")
|
||||
# s += str("RENDER_TEXTURE_MEM_USED : ", Performance.get_monitor(Performance.RENDER_TEXTURE_MEM_USED), "\n")
|
||||
# s += str("RENDER_VERTEX_MEM_USED : ", Performance.get_monitor(Performance.RENDER_VERTEX_MEM_USED), "\n")
|
||||
s += str("CUBES: ", get_node("/root/World").world.size(), "\n")
|
||||
else:
|
||||
s = ""
|
||||
|
||||
get_node("Label_Debug").set_text(s)
|
||||
|
||||
|
||||
func _fixed_process(delta):
|
||||
parent = get_parent()
|
||||
|
||||
printdebug()
|
||||
|
||||
if( parent.state == parent.STATE_MENU ):
|
||||
get_node("Menu").show()
|
||||
else:
|
||||
get_node("Menu").hide()
|
||||
|
||||
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
|
||||
|
||||
func _on_Fullscreen_toggled( pressed ):
|
||||
if( pressed ):
|
||||
OS.set_fullscreen(true)
|
||||
else:
|
||||
OS.set_fullscreen(false)
|
||||
|
||||
|
||||
func _on_DebugInfo_toggled( pressed ):
|
||||
if( pressed ):
|
||||
get_node("Label_Debug").show()
|
||||
else:
|
||||
get_node("Label_Debug").hide()
|
||||
|
||||
|
||||
func _on_Save_pressed():
|
||||
var file_dialog = get_node("Menu/SaveDialog")
|
||||
file_dialog.clear_filters()
|
||||
file_dialog.add_filter("*.json")
|
||||
file_dialog.set_mode(3)
|
||||
file_dialog.show()
|
||||
file_dialog._update_file_list()
|
||||
|
||||
|
||||
func _on_SaveDialog_file_selected( path ):
|
||||
get_node("/root/World").save_world( path )
|
||||
|
||||
|
||||
func _on_Load_pressed():
|
||||
var file_dialog = get_node("Menu/LoadDialog")
|
||||
file_dialog.clear_filters()
|
||||
file_dialog.add_filter("*.json")
|
||||
file_dialog.set_mode(0)
|
||||
file_dialog.show()
|
||||
file_dialog._update_file_list()
|
||||
|
||||
|
||||
func _on_LoadDialog_file_selected( path ):
|
||||
get_node("/root/World").load_world( path )
|
||||
|
||||
|
||||
func _on_Server_toggled( pressed ):
|
||||
if pressed:
|
||||
get_node("/root/World/Server").start()
|
||||
get_node("Menu/Client").hide()
|
||||
else:
|
||||
get_node("/root/World/Server").stop()
|
||||
get_node("Menu/Client").show()
|
||||
|
||||
|
||||
func _on_Client_toggled( pressed ):
|
||||
if pressed:
|
||||
get_node("/root/World/Client").start()
|
||||
get_node("Menu/Server").hide()
|
||||
else:
|
||||
get_node("/root/World/Client").stop()
|
||||
get_node("Menu/Server").show()
|
Binary file not shown.
@ -627,6 +627,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
GLOBAL_DEF("display/width",video_mode.width);
|
||||
GLOBAL_DEF("display/height",video_mode.height);
|
||||
GLOBAL_DEF("display/fullscreen",video_mode.fullscreen);
|
||||
|
Loading…
Reference in New Issue
Block a user