Many improvements (see commit description)
Added more things to roadmap, removed autoload singleton check, added support for Godot 4.1, all startup messages now use Logger.diag() instead of Logger.info() (making them disappear but can be shown if needed), removed autoload.gd, fixes syntax.
This commit is contained in:
parent
e4094e1aa1
commit
b57d00e9cd
10 changed files with 119 additions and 101 deletions
46
README.md
46
README.md
|
@ -13,9 +13,53 @@ CORE is under heavy development and can be very unstable. Please do not use CORE
|
||||||
- Better documentation (docs4everything)
|
- Better documentation (docs4everything)
|
||||||
- Everything commented and explained
|
- Everything commented and explained
|
||||||
- Documentation page explaining what does what (for CORE noobies)
|
- Documentation page explaining what does what (for CORE noobies)
|
||||||
- Autoload singleton check removal
|
- ~~Autoload singleton check removal~~
|
||||||
- More wmgr functions
|
- More wmgr functions
|
||||||
- Website
|
- Website
|
||||||
|
- ~~Silencing startup messages (info -> diag)~~
|
||||||
|
- ~~Remove autoload component~~
|
||||||
|
- ~~Fix syntax (set return types missing)~~
|
||||||
|
- Implement preprocessor placeholders
|
||||||
|
- Clipboard content
|
||||||
|
- CORE version
|
||||||
|
- Dark mode
|
||||||
|
- Dark mode support
|
||||||
|
- Delta
|
||||||
|
- Device hardware
|
||||||
|
- Device model
|
||||||
|
- CPU name
|
||||||
|
- CPU count
|
||||||
|
- FPS
|
||||||
|
- Game process
|
||||||
|
- Executable
|
||||||
|
- Command line options
|
||||||
|
- PID
|
||||||
|
- Debug build
|
||||||
|
- Language
|
||||||
|
- Operating system
|
||||||
|
- Operating system name
|
||||||
|
- Operating system version
|
||||||
|
- Distribution name
|
||||||
|
- Project name
|
||||||
|
- Project description
|
||||||
|
- Rendertime
|
||||||
|
- Window
|
||||||
|
- Size
|
||||||
|
- Size with decorations
|
||||||
|
- Position
|
||||||
|
- Title
|
||||||
|
- Mode
|
||||||
|
- Minimal size
|
||||||
|
- Maximal size
|
||||||
|
- Vsync status
|
||||||
|
- Screen
|
||||||
|
- Size
|
||||||
|
- ID (main window)
|
||||||
|
- Count
|
||||||
|
- DPI
|
||||||
|
- Orientation
|
||||||
|
- Refresh rate
|
||||||
|
- Scale
|
||||||
|
|
||||||
# Documentaton
|
# Documentaton
|
||||||
[You can access the documentation by clicking this text](https://git.staropensource.de/StarOpenSource/core/wiki)[.](https://takeb1nzyto.space)
|
[You can access the documentation by clicking this text](https://git.staropensource.de/StarOpenSource/core/wiki)[.](https://takeb1nzyto.space)
|
||||||
|
|
21
core.gd
21
core.gd
|
@ -14,7 +14,6 @@ var config = null
|
||||||
var wmgr = null
|
var wmgr = null
|
||||||
var smgr = null
|
var smgr = null
|
||||||
var resmgr = null
|
var resmgr = null
|
||||||
var autoload = null
|
|
||||||
var events = null
|
var events = null
|
||||||
var splash = null
|
var splash = null
|
||||||
|
|
||||||
|
@ -28,20 +27,12 @@ func attach(type:String,component,do_setup:bool = true) -> void:
|
||||||
comp.name = type
|
comp.name = type
|
||||||
comp.set_script(component)
|
comp.set_script(component)
|
||||||
match(type):
|
match(type):
|
||||||
"config":
|
"config": config = comp
|
||||||
config = comp
|
"wmgr": wmgr = comp
|
||||||
"wmgr":
|
"smgr": smgr = comp
|
||||||
wmgr = comp
|
"resmgr": resmgr = comp
|
||||||
"smgr":
|
"events": events = comp
|
||||||
smgr = comp
|
"splash": splash = comp
|
||||||
"resmgr":
|
|
||||||
resmgr = comp
|
|
||||||
"autoload":
|
|
||||||
autoload = comp
|
|
||||||
"events":
|
|
||||||
events = comp
|
|
||||||
"splash":
|
|
||||||
splash = comp
|
|
||||||
_:
|
_:
|
||||||
Logger.error("core","Failed attaching " + type + " to CORE: Invalid component")
|
Logger.error("core","Failed attaching " + type + " to CORE: Invalid component")
|
||||||
comp.free()
|
comp.free()
|
||||||
|
|
19
coreinit.gd
19
coreinit.gd
|
@ -9,15 +9,15 @@ extends Node
|
||||||
@onready
|
@onready
|
||||||
var engine_version = Engine.get_version_info()
|
var engine_version = Engine.get_version_info()
|
||||||
|
|
||||||
func _ready():
|
func _ready() -> void:
|
||||||
print("coreinit -> Checking CORE requirements")
|
print("coreinit -> Checking CORE requirements")
|
||||||
if engine_version["major"] != 4:
|
if engine_version["major"] != 4:
|
||||||
print("coreinit -> CORE only supports Godot 4.x.x. Please upgrade/downgrade your Godot Project to Godot 4.")
|
print("coreinit -> CORE only supports Godot 4. Please upgrade/downgrade your Godot Project to Godot 4.")
|
||||||
await get_tree().create_timer(0.1).timeout
|
await get_tree().create_timer(0.1).timeout
|
||||||
get_tree().quit(141)
|
get_tree().quit(141)
|
||||||
return
|
return
|
||||||
if engine_version["minor"] != 0:
|
if engine_version["minor"] != 0 and engine_version["minor"] != 1:
|
||||||
print("coreinit -> CORE only supports Godot 4.0.x. Please upgrade/downgrade your Godot Project to Godot 4.0.")
|
print("coreinit -> CORE only supports Godot 4.0 and 4.1. Please upgrade/downgrade your Godot Project to Godot 4.0 or 4.1.")
|
||||||
await get_tree().create_timer(0.1).timeout
|
await get_tree().create_timer(0.1).timeout
|
||||||
get_tree().quit(142)
|
get_tree().quit(142)
|
||||||
return
|
return
|
||||||
|
@ -36,17 +36,6 @@ func _ready():
|
||||||
await get_tree().create_timer(0.1).timeout
|
await get_tree().create_timer(0.1).timeout
|
||||||
get_tree().quit(145)
|
get_tree().quit(145)
|
||||||
return
|
return
|
||||||
if get_tree().root.get_children().size() != 3:
|
|
||||||
print("coreinit -> CORE only supports projects without autoload singletons (excluding CORE). Please remove them from your project settings and register them using core.autoloader in your init script.")
|
|
||||||
await get_tree().create_timer(0.1).timeout
|
|
||||||
get_tree().quit(146)
|
|
||||||
return
|
|
||||||
for i in get_tree().root.get_children():
|
|
||||||
if i.name != "coreinit" and i.name != "Logger" and i.name != "Preprocessor":
|
|
||||||
print("coreinit -> CORE only supports projects without autoload singletons (excluding CORE). Please remove them from your project settings and register them using core.autoloader in your init script.")
|
|
||||||
await get_tree().create_timer(0.1).timeout
|
|
||||||
get_tree().quit(147)
|
|
||||||
return
|
|
||||||
print("coreinit -> Constructing coreloader")
|
print("coreinit -> Constructing coreloader")
|
||||||
var coreloader = Control.new()
|
var coreloader = Control.new()
|
||||||
coreloader.name = "coreloader"
|
coreloader.name = "coreloader"
|
||||||
|
|
|
@ -8,50 +8,47 @@ extends Node
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
await get_tree().create_timer(1.5).timeout
|
await get_tree().create_timer(1.5).timeout
|
||||||
Logger.info("coreloader","Starting initialization")
|
Logger.diag("coreloader","Starting initialization")
|
||||||
Logger.info("coreloader","Loading configuration file")
|
Logger.diag("coreloader","Loading configuration file")
|
||||||
var scr_config = ResourceLoader.load("res://CORE/config.gd")
|
var scr_config = ResourceLoader.load("res://CORE/config.gd")
|
||||||
Logger.info("coreloader","Preloading core scripts")
|
Logger.diag("coreloader","Preloading core scripts")
|
||||||
var scr_core = ResourceLoader.load("res://CORE/core.gd")
|
var scr_core = ResourceLoader.load("res://CORE/core.gd")
|
||||||
var scr_wmgr = ResourceLoader.load("res://CORE/wmgr.gd")
|
var scr_wmgr = ResourceLoader.load("res://CORE/wmgr.gd")
|
||||||
var scr_smgr = ResourceLoader.load("res://CORE/smgr.gd")
|
var scr_smgr = ResourceLoader.load("res://CORE/smgr.gd")
|
||||||
var scr_resmgr = ResourceLoader.load("res://CORE/resmgr.gd")
|
var scr_resmgr = ResourceLoader.load("res://CORE/resmgr.gd")
|
||||||
var scr_autoload = ResourceLoader.load("res://CORE/autoload.gd")
|
|
||||||
var scr_events = ResourceLoader.load("res://CORE/events.gd")
|
var scr_events = ResourceLoader.load("res://CORE/events.gd")
|
||||||
var scr_splash = ResourceLoader.load("res://CORE/splash.tscn").instantiate()
|
var scr_splash = ResourceLoader.load("res://CORE/splash.tscn").instantiate()
|
||||||
Logger.info("coreloader","Constructing CORE")
|
Logger.diag("coreloader","Constructing CORE")
|
||||||
var core = Control.new()
|
var core = Control.new()
|
||||||
core.name = "core"
|
core.name = "core"
|
||||||
core.script = scr_core
|
core.script = scr_core
|
||||||
Logger.info("coreloader","Attaching CORE to /root/")
|
Logger.diag("coreloader","Attaching CORE to /root/")
|
||||||
get_tree().root.add_child(core)
|
get_tree().root.add_child(core)
|
||||||
Logger.info("coreloader","Attaching configuration file to CORE")
|
Logger.diag("coreloader","Attaching configuration file to CORE")
|
||||||
core.attach("config",scr_config)
|
core.attach("config",scr_config)
|
||||||
Logger.info("coreloader","Attaching wmgr to CORE")
|
Logger.diag("coreloader","Attaching wmgr to CORE")
|
||||||
core.attach("wmgr",scr_wmgr)
|
core.attach("wmgr",scr_wmgr)
|
||||||
Logger.info("coreloader","Attaching smgr to CORE")
|
Logger.diag("coreloader","Attaching smgr to CORE")
|
||||||
core.attach("smgr",scr_smgr)
|
core.attach("smgr",scr_smgr)
|
||||||
Logger.info("coreloader","Attaching resmgr to CORE")
|
Logger.diag("coreloader","Attaching resmgr to CORE")
|
||||||
core.attach("resmgr",scr_resmgr)
|
core.attach("resmgr",scr_resmgr)
|
||||||
Logger.info("coreloader","Attaching autoload to CORE")
|
Logger.diag("coreloader","Attaching events to CORE")
|
||||||
core.attach("autoload",scr_autoload)
|
|
||||||
Logger.info("coreloader","Attaching events to CORE")
|
|
||||||
core.attach("events",scr_events)
|
core.attach("events",scr_events)
|
||||||
Logger.info("coreloader","Attaching splash to CORE")
|
Logger.diag("coreloader","Attaching splash to CORE")
|
||||||
core.attach("splash",scr_splash,false)
|
core.attach("splash",scr_splash,false)
|
||||||
Logger.info("coreloader","Locking CORE")
|
Logger.diag("coreloader","Locking CORE")
|
||||||
core.lock()
|
core.lock()
|
||||||
Logger.info("coreloader","Waiting for CORE to fully initialize")
|
Logger.diag("coreloader","Waiting for CORE to fully initialize")
|
||||||
while !core.readylized:
|
while !core.readylized:
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
Logger.info("coreloader","CORE has been initialized and is ready.")
|
Logger.diag("coreloader","CORE has been initialized and is ready.")
|
||||||
Logger.info("coreloader","Preloading project init script")
|
Logger.diag("coreloader","Preloading project init script")
|
||||||
var initscr = ResourceLoader.load(core.config.core_startscript)
|
var initscr = ResourceLoader.load(core.config.core_startscript)
|
||||||
Logger.info("coreloader","Constructing project init script")
|
Logger.diag("coreloader","Constructing project init script")
|
||||||
var initscr_obj = Control.new()
|
var initscr_obj = Control.new()
|
||||||
initscr_obj.name = "ProjectInitScript"
|
initscr_obj.name = "ProjectInitScript"
|
||||||
initscr_obj.set_script(initscr)
|
initscr_obj.set_script(initscr)
|
||||||
Logger.info("coreloader","Adding project init script to /root/")
|
Logger.diag("coreloader","Adding project init script to /root/")
|
||||||
get_tree().root.add_child(initscr_obj)
|
get_tree().root.add_child(initscr_obj)
|
||||||
Logger.info("coreloader","Removing coreloader")
|
Logger.diag("coreloader","Removing coreloader")
|
||||||
queue_free()
|
queue_free()
|
||||||
|
|
|
@ -6,11 +6,10 @@
|
||||||
# Licensed under GNU GPLv3
|
# Licensed under GNU GPLv3
|
||||||
extends RichTextLabel
|
extends RichTextLabel
|
||||||
|
|
||||||
var log_first = true
|
|
||||||
var log_prefix = ""
|
var log_prefix = ""
|
||||||
var log_suffix = ""
|
var log_suffix = ""
|
||||||
|
|
||||||
func _ready():
|
func _ready() -> void:
|
||||||
# Enable recieving of log messages
|
# Enable recieving of log messages
|
||||||
Logger.connect("logevent",Callable(self,"logevent"))
|
Logger.connect("logevent",Callable(self,"logevent"))
|
||||||
# Disable VScrollBar functionality & visibility
|
# Disable VScrollBar functionality & visibility
|
||||||
|
@ -24,7 +23,7 @@ func _ready():
|
||||||
# Make RichTextLabel ignore all mouse events (to disable scrolling)
|
# Make RichTextLabel ignore all mouse events (to disable scrolling)
|
||||||
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
mouse_filter = Control.MOUSE_FILTER_IGNORE
|
||||||
|
|
||||||
func _process(_delta):
|
func _process(_delta) -> void:
|
||||||
var windowsize = DisplayServer.window_get_size()
|
var windowsize = DisplayServer.window_get_size()
|
||||||
$".".size = windowsize
|
$".".size = windowsize
|
||||||
get_parent().size = windowsize
|
get_parent().size = windowsize
|
||||||
|
@ -32,10 +31,6 @@ func _process(_delta):
|
||||||
|
|
||||||
func logevent(_type:String,_script:String,_message:String,logcomp:String) -> void:
|
func logevent(_type:String,_script:String,_message:String,logcomp:String) -> void:
|
||||||
# Appends log to RichTextLabel
|
# Appends log to RichTextLabel
|
||||||
if log_first:
|
|
||||||
log_first = false
|
|
||||||
text = text + log_prefix + logcomp + log_suffix
|
|
||||||
else:
|
|
||||||
text = text + "\n" + log_prefix + logcomp + log_suffix
|
text = text + "\n" + log_prefix + logcomp + log_suffix
|
||||||
|
|
||||||
func rmconnect() -> void:
|
func rmconnect() -> void:
|
||||||
|
|
|
@ -26,7 +26,7 @@ func _ready() -> void:
|
||||||
print("logger -> Preprocessor is not loaded. Shutting application down...")
|
print("logger -> Preprocessor is not loaded. Shutting application down...")
|
||||||
get_tree().quit(1)
|
get_tree().quit(1)
|
||||||
await get_tree().create_timer(1).timeout
|
await get_tree().create_timer(1).timeout
|
||||||
info("Logger","Logger is ready.")
|
diag("Logger","Logger is ready.")
|
||||||
|
|
||||||
func diag(script:String,message:String,preproc:bool = false) -> void:
|
func diag(script:String,message:String,preproc:bool = false) -> void:
|
||||||
if enable and enable_diag:
|
if enable and enable_diag:
|
||||||
|
|
|
@ -48,23 +48,23 @@ func _ready() -> void:
|
||||||
await get_tree().create_timer(0.05).timeout
|
await get_tree().create_timer(0.05).timeout
|
||||||
do_tests(false)
|
do_tests(false)
|
||||||
if enabled:
|
if enabled:
|
||||||
logger.info("Preprocessor","Preprocessor ready.",false)
|
logger.diag("Preprocessor","Preprocessor ready.",false)
|
||||||
else:
|
else:
|
||||||
logger.info("Preprocessor","Preprocessor disabled.",false)
|
logger.diag("Preprocessor","Preprocessor disabled.",false)
|
||||||
|
|
||||||
# Performs tests on all Preprocessor features to help catch bugs while debugging.
|
# Performs tests on all Preprocessor features to help catch bugs while debugging.
|
||||||
# Recommended to leave enabled because log output might look weird if the a faulty commit is installed.
|
# Recommended to leave enabled because log output might look weird if the a faulty commit is installed.
|
||||||
# Use tests_executed to check if the tests have been executed, use tests_log for the test log and
|
# Use tests_executed to check if the tests have been executed, use tests_log for the test log and
|
||||||
# read tests_success if you want the number of successful tests.
|
# read tests_success if you want the number of successful tests.
|
||||||
func do_tests(ignore_flag:bool = false) -> void:
|
func do_tests(ignore_flag:bool = false) -> void:
|
||||||
logger.info("Preprocessor","Testing preprocessor...",false)
|
logger.diag("Preprocessor","Testing preprocessor...",false)
|
||||||
# If tests are disaled and ignore_flag is false return
|
# If tests are disaled and ignore_flag is false return
|
||||||
if !tests_enabled and !ignore_flag:
|
if !tests_enabled and !ignore_flag:
|
||||||
logger.info("Preprocessor","Testing failed: Tests are disabled.",false)
|
logger.diag("Preprocessor","Testing failed: Tests are disabled.",false)
|
||||||
return
|
return
|
||||||
# If the Preprocessor is not enabled return
|
# If the Preprocessor is not enabled return
|
||||||
if !enabled:
|
if !enabled:
|
||||||
logger.info("Preprocessor","Testing failed: Preprocessor is disabled.",false)
|
logger.diag("Preprocessor","Testing failed: Preprocessor is disabled.",false)
|
||||||
return
|
return
|
||||||
# Expected test resulsts
|
# Expected test resulsts
|
||||||
var tests_newlines = "test_prefix_Line 1.\n _Line 2.\n _Line 3."
|
var tests_newlines = "test_prefix_Line 1.\n _Line 2.\n _Line 3."
|
||||||
|
@ -161,14 +161,14 @@ func do_tests(ignore_flag:bool = false) -> void:
|
||||||
# Checks if all tests were successful. If not disable the Preprocessor and print log.
|
# Checks if all tests were successful. If not disable the Preprocessor and print log.
|
||||||
if tests_success == 12:
|
if tests_success == 12:
|
||||||
enabled = true
|
enabled = true
|
||||||
logger.info("Preprocessor","Testing complete: All preprocessor features are working as intended.",false)
|
logger.diag("Preprocessor","Testing complete: All preprocessor features are working as intended.",false)
|
||||||
if tests_level == 2:
|
if tests_level == 2:
|
||||||
logger.info("Preprocessor","Log:\n" + tests_log)
|
logger.diag("Preprocessor","Log:\n" + tests_log)
|
||||||
else:
|
else:
|
||||||
enabled = false
|
enabled = false
|
||||||
logger.info("Preprocessor","Testing failed: Preprocessor is malfunctioning and is now disabled.",false)
|
logger.error("Preprocessor","Testing failed: Preprocessor is malfunctioning and is now disabled.",false)
|
||||||
if tests_level >= 1:
|
if tests_level >= 1:
|
||||||
logger.info("Preprocessor","Log:\n" + tests_log)
|
logger.error("Preprocessor","Log:\n" + tests_log)
|
||||||
|
|
||||||
# Processes <nl> tags
|
# Processes <nl> tags
|
||||||
func _newline(msg:String,prefix:String,pre_msg:String,post_msg:String,exclusion_filter:Array) -> String:
|
func _newline(msg:String,prefix:String,pre_msg:String,post_msg:String,exclusion_filter:Array) -> String:
|
||||||
|
|
|
@ -37,6 +37,7 @@ func unloadbatch(batch:Array) -> void:
|
||||||
for i in batch:
|
for i in batch:
|
||||||
unloadres(i)
|
unloadres(i)
|
||||||
|
|
||||||
|
# No set return type here as it can return literally everything.
|
||||||
func getres(resname:String):
|
func getres(resname:String):
|
||||||
if !resources.has(resname):
|
if !resources.has(resname):
|
||||||
return null
|
return null
|
||||||
|
|
51
smgr.gd
51
smgr.gd
|
@ -19,7 +19,7 @@ var ccr_debug = null
|
||||||
var ccr_debug_names = []
|
var ccr_debug_names = []
|
||||||
|
|
||||||
func add_game(resname:String) -> bool:
|
func add_game(resname:String) -> bool:
|
||||||
Logger.info("smgr","Adding game scene")
|
Logger.diag("smgr","Adding game scene")
|
||||||
if ccr_game_inuse:
|
if ccr_game_inuse:
|
||||||
Logger.error("smgr","Failed adding game scene: Only one game scene is allowed")
|
Logger.error("smgr","Failed adding game scene: Only one game scene is allowed")
|
||||||
return false
|
return false
|
||||||
|
@ -29,21 +29,21 @@ func add_game(resname:String) -> bool:
|
||||||
return false
|
return false
|
||||||
ccr_game.add_child(res.instantiate())
|
ccr_game.add_child(res.instantiate())
|
||||||
ccr_game_inuse = true
|
ccr_game_inuse = true
|
||||||
Logger.info("smgr","Added game scene")
|
Logger.diag("smgr","Added game scene")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_game() -> bool:
|
func remove_game() -> bool:
|
||||||
Logger.info("smgr","Removing game scene")
|
Logger.diag("smgr","Removing game scene")
|
||||||
if !ccr_game_inuse:
|
if !ccr_game_inuse:
|
||||||
Logger.error("smgr","Failed removing game scene: No game scene is active")
|
Logger.error("smgr","Failed removing game scene: No game scene is active")
|
||||||
return false
|
return false
|
||||||
ccr_game.remove_child(ccr_game.get_child(0))
|
ccr_game.remove_child(ccr_game.get_child(0))
|
||||||
ccr_game_inuse = false
|
ccr_game_inuse = false
|
||||||
Logger.info("smgr","Removed game scene")
|
Logger.diag("smgr","Removed game scene")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func add_menu(resname:String) -> bool:
|
func add_menu(resname:String) -> bool:
|
||||||
Logger.info("smgr","Adding menu scene \"" + resname + "\"")
|
Logger.diag("smgr","Adding menu scene \"" + resname + "\"")
|
||||||
if ccr_menu_names.has(resname):
|
if ccr_menu_names.has(resname):
|
||||||
Logger.error("smgr","Failed adding menu scene: Menu scene with name \"" + resname + "\" already exists")
|
Logger.error("smgr","Failed adding menu scene: Menu scene with name \"" + resname + "\" already exists")
|
||||||
return false
|
return false
|
||||||
|
@ -53,11 +53,11 @@ func add_menu(resname:String) -> bool:
|
||||||
return false
|
return false
|
||||||
ccr_menu.add_child(res.instantiate())
|
ccr_menu.add_child(res.instantiate())
|
||||||
ccr_menu_names.append(resname)
|
ccr_menu_names.append(resname)
|
||||||
Logger.info("smgr","Added menu scene \"" + resname + "\"")
|
Logger.diag("smgr","Added menu scene \"" + resname + "\"")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_menu(scene_name:String) -> bool:
|
func remove_menu(scene_name:String) -> bool:
|
||||||
Logger.info("smgr","Removing menu scene \"" + scene_name + "\"")
|
Logger.diag("smgr","Removing menu scene \"" + scene_name + "\"")
|
||||||
if !ccr_menu_names.has(scene_name):
|
if !ccr_menu_names.has(scene_name):
|
||||||
Logger.error("smgr","Failed removing menu scene: Menu scene with name \"" + scene_name + "\" does not exist")
|
Logger.error("smgr","Failed removing menu scene: Menu scene with name \"" + scene_name + "\" does not exist")
|
||||||
return false
|
return false
|
||||||
|
@ -66,10 +66,11 @@ func remove_menu(scene_name:String) -> bool:
|
||||||
ccr_menu.remove_child(i)
|
ccr_menu.remove_child(i)
|
||||||
break
|
break
|
||||||
ccr_menu_names.erase(scene_name)
|
ccr_menu_names.erase(scene_name)
|
||||||
|
Logger.diag("smgr","Removed menu scene \"" + scene_name + "\"")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func add_cutscene(resname:String) -> bool:
|
func add_cutscene(resname:String) -> bool:
|
||||||
Logger.info("smgr","Adding cutscene scene")
|
Logger.diag("smgr","Adding cutscene scene")
|
||||||
if ccr_cutscene_inuse:
|
if ccr_cutscene_inuse:
|
||||||
Logger.error("smgr","Failed adding cutscene scene: Only one cutscene scene is allowed")
|
Logger.error("smgr","Failed adding cutscene scene: Only one cutscene scene is allowed")
|
||||||
return false
|
return false
|
||||||
|
@ -79,21 +80,21 @@ func add_cutscene(resname:String) -> bool:
|
||||||
return false
|
return false
|
||||||
ccr_cutscene.add_child(res.instantiate())
|
ccr_cutscene.add_child(res.instantiate())
|
||||||
ccr_cutscene_inuse = true
|
ccr_cutscene_inuse = true
|
||||||
Logger.info("smgr","Added cutscene scene")
|
Logger.diag("smgr","Added cutscene scene")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_cutscene() -> bool:
|
func remove_cutscene() -> bool:
|
||||||
Logger.info("smgr","Removing cutscene scene")
|
Logger.diag("smgr","Removing cutscene scene")
|
||||||
if !ccr_cutscene_inuse:
|
if !ccr_cutscene_inuse:
|
||||||
Logger.error("smgr","Failed removing cutscene scene: No cutscene scene is active")
|
Logger.error("smgr","Failed removing cutscene scene: No cutscene scene is active")
|
||||||
return false
|
return false
|
||||||
ccr_cutscene.remove_child(ccr_cutscene.get_child(0))
|
ccr_cutscene.remove_child(ccr_cutscene.get_child(0))
|
||||||
ccr_cutscene_inuse = false
|
ccr_cutscene_inuse = false
|
||||||
Logger.info("smgr","Removed cutscene scene")
|
Logger.diag("smgr","Removed cutscene scene")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func add_debug(resname:String) -> bool:
|
func add_debug(resname:String) -> bool:
|
||||||
Logger.info("smgr","Adding debug scene \"" + resname + "\"")
|
Logger.diag("smgr","Adding debug scene \"" + resname + "\"")
|
||||||
if ccr_debug_names.has(resname):
|
if ccr_debug_names.has(resname):
|
||||||
Logger.error("smgr","Failed adding debug scene: Debug scene with name \"" + resname + "\" already exists")
|
Logger.error("smgr","Failed adding debug scene: Debug scene with name \"" + resname + "\" already exists")
|
||||||
return false
|
return false
|
||||||
|
@ -103,11 +104,11 @@ func add_debug(resname:String) -> bool:
|
||||||
return false
|
return false
|
||||||
ccr_debug.add_child(res.instantiate())
|
ccr_debug.add_child(res.instantiate())
|
||||||
ccr_debug_names.append(resname)
|
ccr_debug_names.append(resname)
|
||||||
Logger.info("smgr","Added debug scene \"" + resname + "\"")
|
Logger.diag("smgr","Added debug scene \"" + resname + "\"")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func remove_debug(scene_name:String) -> bool:
|
func remove_debug(scene_name:String) -> bool:
|
||||||
Logger.info("smgr","Removing debug scene \"" + scene_name + "\"")
|
Logger.diag("smgr","Removing debug scene \"" + scene_name + "\"")
|
||||||
if !ccr_menu_names.has(scene_name):
|
if !ccr_menu_names.has(scene_name):
|
||||||
Logger.error("smgr","Failed removing debug scene: Debug scene with name \"" + scene_name + "\" does not exist")
|
Logger.error("smgr","Failed removing debug scene: Debug scene with name \"" + scene_name + "\" does not exist")
|
||||||
return false
|
return false
|
||||||
|
@ -116,43 +117,43 @@ func remove_debug(scene_name:String) -> bool:
|
||||||
ccr_debug.remove_child(i)
|
ccr_debug.remove_child(i)
|
||||||
break
|
break
|
||||||
ccr_debug_names.erase(scene_name)
|
ccr_debug_names.erase(scene_name)
|
||||||
|
Logger.diag("smgr","Removed debug scene \"" + scene_name + "\"")
|
||||||
return true
|
return true
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Logger.info("smgr","Constructing CORE Scene Root (CCR)")
|
Logger.diag("smgr","Constructing CORE Scene Root (CCR)")
|
||||||
ccr = Control.new()
|
ccr = Control.new()
|
||||||
ccr.name = "ccr"
|
ccr.name = "ccr"
|
||||||
Logger.info("smgr","Adding CCR to /root/")
|
Logger.diag("smgr","Adding CCR to /root/")
|
||||||
get_tree().root.add_child(ccr)
|
get_tree().root.add_child(ccr)
|
||||||
Logger.info("smgr","Migrating COREBackground to CCR")
|
Logger.diag("smgr","Migrating COREBackground to CCR")
|
||||||
var corebg = get_tree().current_scene
|
var corebg = get_tree().current_scene
|
||||||
Logger.info("smgr","Reconstructing COREBackground to CCR")
|
Logger.diag("smgr","Reconstructing COREBackground to CCR")
|
||||||
var corebg_log = corebg.get_node(NodePath("Background/Log")).text
|
var corebg_log = corebg.get_node(NodePath("Background/Log")).text
|
||||||
corebg.get_node(NodePath("Background/Log")).rmconnect()
|
corebg.get_node(NodePath("Background/Log")).rmconnect()
|
||||||
get_tree().current_scene.queue_free()
|
get_tree().current_scene.queue_free()
|
||||||
var corebg_new = ResourceLoader.load("res://CORE/background.tscn").instantiate()
|
var corebg_new = ResourceLoader.load("res://CORE/background.tscn").instantiate()
|
||||||
ccr.add_child(corebg_new)
|
ccr.add_child(corebg_new)
|
||||||
corebg_new.get_node(NodePath("Background/Log")).text = corebg_log
|
corebg_new.get_node(NodePath("Background/Log")).text = corebg_log
|
||||||
corebg_new.get_node(NodePath("Background/Log")).log_first = false
|
Logger.diag("smgr","COREBackground migration complete.")
|
||||||
Logger.info("smgr","COREBackground migration complete.")
|
Logger.diag("smgr","Adding overlays")
|
||||||
Logger.info("smgr","Adding overlays")
|
|
||||||
add_overlays()
|
add_overlays()
|
||||||
core.setready()
|
core.setready()
|
||||||
|
|
||||||
func add_overlays() -> void:
|
func add_overlays() -> void:
|
||||||
Logger.info("smgr","Adding game overlay")
|
Logger.diag("smgr","Adding game overlay")
|
||||||
ccr_game = Control.new()
|
ccr_game = Control.new()
|
||||||
ccr_game.name = "GameOverlay"
|
ccr_game.name = "GameOverlay"
|
||||||
ccr.add_child(ccr_game)
|
ccr.add_child(ccr_game)
|
||||||
Logger.info("smgr","Adding menu overlay")
|
Logger.diag("smgr","Adding menu overlay")
|
||||||
ccr_menu = Control.new()
|
ccr_menu = Control.new()
|
||||||
ccr_menu.name = "MenuOverlay"
|
ccr_menu.name = "MenuOverlay"
|
||||||
ccr.add_child(ccr_menu)
|
ccr.add_child(ccr_menu)
|
||||||
Logger.info("smgr","Adding cutscene overlay")
|
Logger.diag("smgr","Adding cutscene overlay")
|
||||||
ccr_cutscene = Control.new()
|
ccr_cutscene = Control.new()
|
||||||
ccr_cutscene.name = "CutsceneOverlay"
|
ccr_cutscene.name = "CutsceneOverlay"
|
||||||
ccr.add_child(ccr_cutscene)
|
ccr.add_child(ccr_cutscene)
|
||||||
Logger.info("smgr","Adding debug overlay")
|
Logger.diag("smgr","Adding debug overlay")
|
||||||
ccr_debug = Control.new()
|
ccr_debug = Control.new()
|
||||||
ccr_debug.name = "DebugOverlay"
|
ccr_debug.name = "DebugOverlay"
|
||||||
ccr.add_child(ccr_debug)
|
ccr.add_child(ccr_debug)
|
||||||
|
|
10
wmgr.gd
10
wmgr.gd
|
@ -23,20 +23,20 @@ func _process(deltap) -> void:
|
||||||
delta = deltap
|
delta = deltap
|
||||||
|
|
||||||
func set_size(x:int,y:int) -> void:
|
func set_size(x:int,y:int) -> void:
|
||||||
Logger.info("wmgr","Applying new window size (" + str(x) + "x" + str(y) + ")")
|
Logger.diag("wmgr","Applying new window size (" + str(x) + "x" + str(y) + ")")
|
||||||
DisplayServer.window_set_size(Vector2i(x,y))
|
DisplayServer.window_set_size(Vector2i(x,y))
|
||||||
|
|
||||||
func set_position(x:int,y:int) -> void:
|
func set_position(x:int,y:int) -> void:
|
||||||
Logger.info("wmgr","Applying new window position (X" + str(x) + " Y" + str(y) + ")")
|
Logger.diag("wmgr","Applying new window position (X" + str(x) + " Y" + str(y) + ")")
|
||||||
DisplayServer.window_set_position(Vector2i(x,y))
|
DisplayServer.window_set_position(Vector2i(x,y))
|
||||||
|
|
||||||
func set_title(title:String) -> void:
|
func set_title(title:String) -> void:
|
||||||
Logger.info("wmgr","Applying new window title (" + title + ")")
|
Logger.diag("wmgr","Applying new window title (" + title + ")")
|
||||||
DisplayServer.window_set_title(title)
|
DisplayServer.window_set_title(title)
|
||||||
window_title = title
|
window_title = title
|
||||||
|
|
||||||
func set_mode(mode:String) -> bool:
|
func set_mode(mode:String) -> bool:
|
||||||
Logger.info("wmgr","Applying new window mode (" + mode + ")")
|
Logger.diag("wmgr","Applying new window mode (" + mode + ")")
|
||||||
match(mode):
|
match(mode):
|
||||||
"WINDOWED": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
"WINDOWED": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_WINDOWED)
|
||||||
"MINIMIZED": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MINIMIZED)
|
"MINIMIZED": DisplayServer.window_set_mode(DisplayServer.WINDOW_MODE_MINIMIZED)
|
||||||
|
@ -81,7 +81,7 @@ func get_delta() -> float:
|
||||||
return delta
|
return delta
|
||||||
|
|
||||||
func _ready() -> void:
|
func _ready() -> void:
|
||||||
Logger.info("wmgr","Configuring window")
|
Logger.diag("wmgr","Configuring window")
|
||||||
DisplayServer.window_set_size(Vector2i(window_size_x,window_size_y))
|
DisplayServer.window_set_size(Vector2i(window_size_x,window_size_y))
|
||||||
DisplayServer.window_set_min_size(Vector2i(960,540))
|
DisplayServer.window_set_min_size(Vector2i(960,540))
|
||||||
DisplayServer.window_set_title(window_title)
|
DisplayServer.window_set_title(window_title)
|
||||||
|
|
Loading…
Reference in a new issue