2015-01-11 12:30:57 +00:00
|
|
|
|
|
|
|
extends Control
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
# member variables
|
2015-05-07 03:07:11 +00:00
|
|
|
var mousepos
|
|
|
|
|
2015-01-15 13:50:23 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
func _fixed_process(delta):
|
2015-01-15 13:50:23 +00:00
|
|
|
var modetext = "Mode:\n"
|
|
|
|
|
2015-03-23 04:09:12 +00:00
|
|
|
if(OS.is_window_fullscreen()):
|
2015-01-15 13:50:23 +00:00
|
|
|
modetext += "Fullscreen\n"
|
2015-01-11 12:30:57 +00:00
|
|
|
else:
|
2015-01-15 13:50:23 +00:00
|
|
|
modetext += "Windowed\n"
|
2015-12-09 07:38:23 +00:00
|
|
|
|
2015-03-23 04:09:12 +00:00
|
|
|
if(!OS.is_window_resizable()):
|
2015-01-15 13:50:23 +00:00
|
|
|
modetext += "FixedSize\n"
|
|
|
|
|
2015-03-23 04:09:12 +00:00
|
|
|
if(OS.is_window_minimized()):
|
2015-01-16 15:18:45 +00:00
|
|
|
modetext += "Minimized\n"
|
|
|
|
|
2015-03-23 04:09:12 +00:00
|
|
|
if(OS.is_window_maximized()):
|
2015-01-16 15:18:45 +00:00
|
|
|
modetext += "Maximized\n"
|
|
|
|
|
2015-01-21 20:35:39 +00:00
|
|
|
if(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED):
|
|
|
|
modetext += "MouseGrab\n"
|
2015-03-08 07:27:36 +00:00
|
|
|
get_node("Label_MouseGrab_KeyInfo").show()
|
|
|
|
else:
|
|
|
|
get_node("Label_MouseGrab_KeyInfo").hide()
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-01-15 13:50:23 +00:00
|
|
|
get_node("Label_Mode").set_text(modetext)
|
2015-01-11 12:30:57 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Position").set_text(str("Position:\n", OS.get_window_position()))
|
2015-01-11 12:30:57 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Size").set_text(str("Size:\n", OS.get_window_size()))
|
2015-01-11 12:30:57 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_MousePosition").set_text(str("Mouse Position:\n", mousepos))
|
2015-02-12 14:58:00 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Screen_Count").set_text(str("Screen_Count:\n", OS.get_screen_count()))
|
2015-01-16 15:18:45 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Screen_Current").set_text(str("Screen:\n", OS.get_current_screen()))
|
2015-01-14 04:02:59 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Screen0_Resolution").set_text(str("Screen0 Resolution:\n", OS.get_screen_size()))
|
2015-01-11 12:30:57 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Screen0_Position").set_text(str("Screen0 Position:\n", OS.get_screen_position()))
|
2015-01-13 09:25:50 +00:00
|
|
|
|
2015-01-11 12:30:57 +00:00
|
|
|
if(OS.get_screen_count() > 1):
|
2015-01-17 10:43:12 +00:00
|
|
|
get_node("Button_Screen0").show()
|
2015-01-14 04:02:59 +00:00
|
|
|
get_node("Button_Screen1").show()
|
2015-01-11 12:30:57 +00:00
|
|
|
get_node("Label_Screen1_Resolution").show()
|
2015-01-13 09:25:50 +00:00
|
|
|
get_node("Label_Screen1_Position").show()
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("Label_Screen1_Resolution").set_text(str("Screen1 Resolution:\n", OS.get_screen_size(1)))
|
|
|
|
get_node("Label_Screen1_Position").set_text(str("Screen1 Position:\n", OS.get_screen_position(1)))
|
2015-01-13 09:25:50 +00:00
|
|
|
else:
|
2015-01-17 10:43:12 +00:00
|
|
|
get_node("Button_Screen0").hide()
|
2015-01-14 04:02:59 +00:00
|
|
|
get_node("Button_Screen1").hide()
|
2015-01-13 09:25:50 +00:00
|
|
|
get_node("Label_Screen1_Resolution").hide()
|
|
|
|
get_node("Label_Screen1_Position").hide()
|
2015-12-09 07:38:23 +00:00
|
|
|
|
|
|
|
get_node("Button_Fullscreen").set_pressed(OS.is_window_fullscreen())
|
|
|
|
get_node("Button_FixedSize").set_pressed(!OS.is_window_resizable())
|
|
|
|
get_node("Button_Minimized").set_pressed(OS.is_window_minimized())
|
|
|
|
get_node("Button_Maximized").set_pressed(OS.is_window_maximized())
|
|
|
|
get_node("Button_Mouse_Grab").set_pressed(Input.get_mouse_mode() == Input.MOUSE_MODE_CAPTURED)
|
2015-01-11 12:30:57 +00:00
|
|
|
|
|
|
|
|
2015-01-21 20:35:39 +00:00
|
|
|
func check_wm_api():
|
|
|
|
var s = ""
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_screen_count")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - get_screen_count()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_current_screen")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - get_current_screen()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_current_screen")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - set_current_screen()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_screen_position")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - get_screen_position()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_screen_size")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - get_screen_size()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_window_position")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - get_window_position()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_position")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - set_window_position()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("get_window_size")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - get_window_size()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_size")):
|
2015-01-21 20:35:39 +00:00
|
|
|
s += " - set_window_size()\n"
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_fullscreen")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - set_window_fullscreen()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("is_window_fullscreen")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - is_window_fullscreen()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_resizable")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - set_window_resizable()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("is_window_resizable")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - is_window_resizable()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_minimized")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - set_window_minimized()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("is_window_minimized")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - is_window_minimized()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("set_window_maximized")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - set_window_maximized()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(!OS.has_method("is_window_maximized")):
|
2015-03-23 04:09:12 +00:00
|
|
|
s += " - is_window_maximized()\n"
|
2015-01-21 20:35:39 +00:00
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
if(s.length() == 0):
|
2015-01-21 20:35:39 +00:00
|
|
|
return true
|
|
|
|
else:
|
|
|
|
var text = get_node("ImplementationDialog/Text").get_text()
|
2015-12-09 07:38:23 +00:00
|
|
|
get_node("ImplementationDialog/Text").set_text(text + s)
|
2015-01-21 20:35:39 +00:00
|
|
|
get_node("ImplementationDialog").show()
|
|
|
|
return false
|
|
|
|
|
|
|
|
|
2015-01-17 10:43:12 +00:00
|
|
|
func _ready():
|
2015-12-09 07:38:23 +00:00
|
|
|
if(check_wm_api()):
|
2015-01-21 20:35:39 +00:00
|
|
|
set_fixed_process(true)
|
2015-05-07 03:07:11 +00:00
|
|
|
set_process_input(true)
|
|
|
|
|
|
|
|
|
2015-12-09 07:38:23 +00:00
|
|
|
func _input(event):
|
|
|
|
if (event.type == InputEvent.MOUSE_MOTION):
|
|
|
|
mousepos = event.pos
|
2015-01-11 12:30:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Button_MoveTo_pressed():
|
2015-12-09 07:38:23 +00:00
|
|
|
OS.set_window_position(Vector2(100, 100))
|
2015-01-11 12:30:57 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Button_Resize_pressed():
|
2015-12-09 07:38:23 +00:00
|
|
|
OS.set_window_size(Vector2(1024, 768))
|
2015-01-14 04:02:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Button_Screen0_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_current_screen(0)
|
2015-01-14 04:02:59 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Button_Screen1_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_current_screen(1)
|
2015-01-15 13:50:23 +00:00
|
|
|
|
|
|
|
|
2015-01-17 10:43:12 +00:00
|
|
|
func _on_Button_Fullscreen_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
if(OS.is_window_fullscreen()):
|
|
|
|
OS.set_window_fullscreen(false)
|
2015-01-17 10:43:12 +00:00
|
|
|
else:
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_window_fullscreen(true)
|
2015-01-17 10:43:12 +00:00
|
|
|
|
|
|
|
|
2015-01-15 13:50:23 +00:00
|
|
|
func _on_Button_FixedSize_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
if(OS.is_window_resizable()):
|
|
|
|
OS.set_window_resizable(false)
|
2015-01-15 13:50:23 +00:00
|
|
|
else:
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_window_resizable(true)
|
2015-01-15 13:50:23 +00:00
|
|
|
|
2015-01-16 15:18:45 +00:00
|
|
|
|
|
|
|
func _on_Button_Minimized_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
if(OS.is_window_minimized()):
|
|
|
|
OS.set_window_minimized(false)
|
2015-01-16 15:18:45 +00:00
|
|
|
else:
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_window_minimized(true)
|
2015-01-16 15:18:45 +00:00
|
|
|
|
|
|
|
|
|
|
|
func _on_Button_Maximized_pressed():
|
2015-03-22 22:00:50 +00:00
|
|
|
if(OS.is_window_maximized()):
|
|
|
|
OS.set_window_maximized(false)
|
2015-01-16 15:18:45 +00:00
|
|
|
else:
|
2015-03-22 22:00:50 +00:00
|
|
|
OS.set_window_maximized(true)
|
2015-01-17 10:43:12 +00:00
|
|
|
|
|
|
|
|
2015-01-21 16:14:50 +00:00
|
|
|
func _on_Button_Mouse_Grab_pressed():
|
|
|
|
var observer = get_node("../Observer")
|
|
|
|
observer.state = observer.STATE_GRAB
|