summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhurikhan <m4r10.5ch14ck@gmail.com>2015-01-22 05:35:39 +0900
committerhurikhan <m4r10.5ch14ck@gmail.com>2015-01-22 05:35:39 +0900
commit03c453ac7dc2b22bfb864e563b7f3b8424bbcff4 (patch)
treeb48dcc99e82ec2129ea7230315633ae382a6b32b
parent2204914abfc939e16cc595a6b175ff74b6552a6c (diff)
* Cleanup for PR
* Demo shows a Dialog with not implemented methods at startup
-rw-r--r--README.md21
-rw-r--r--demos/misc/window_management/control.gd68
-rw-r--r--demos/misc/window_management/observer/observer.gd1
-rw-r--r--demos/misc/window_management/observer/observer_hud.gd98
-rw-r--r--demos/misc/window_management/window_management.scnbin4268 -> 4744 bytes
-rw-r--r--main/main.cpp1
6 files changed, 69 insertions, 120 deletions
diff --git a/README.md b/README.md
index 35841c8b29..3456290f74 100644
--- a/README.md
+++ b/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
diff --git a/demos/misc/window_management/control.gd b/demos/misc/window_management/control.gd
index 6dc9282149..d329237aed 100644
--- a/demos/misc/window_management/control.gd
+++ b/demos/misc/window_management/control.gd
@@ -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():
diff --git a/demos/misc/window_management/observer/observer.gd b/demos/misc/window_management/observer/observer.gd
index 7bec0f5301..d27912a670 100644
--- a/demos/misc/window_management/observer/observer.gd
+++ b/demos/misc/window_management/observer/observer.gd
@@ -76,3 +76,4 @@ func _ready():
set_process_input(true)
state = STATE_MENU
+
diff --git a/demos/misc/window_management/observer/observer_hud.gd b/demos/misc/window_management/observer/observer_hud.gd
deleted file mode 100644
index 24e81b02ba..0000000000
--- a/demos/misc/window_management/observer/observer_hud.gd
+++ /dev/null
@@ -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() \ No newline at end of file
diff --git a/demos/misc/window_management/window_management.scn b/demos/misc/window_management/window_management.scn
index 40e6e64cef..bf7a0871e7 100644
--- a/demos/misc/window_management/window_management.scn
+++ b/demos/misc/window_management/window_management.scn
Binary files differ
diff --git a/main/main.cpp b/main/main.cpp
index 27d7d97e85..f0e376a045 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -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);