summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
Diffstat (limited to 'main')
-rw-r--r--main/SCsub11
-rw-r--r--main/input_default.cpp67
-rw-r--r--main/input_default.h4
-rw-r--r--main/main.cpp415
-rw-r--r--main/main.h5
-rw-r--r--main/performance.cpp64
-rw-r--r--main/performance.h2
-rw-r--r--main/tests/test_containers.cpp92
-rw-r--r--main/tests/test_containers.h43
-rw-r--r--main/tests/test_gdscript.cpp24
-rw-r--r--main/tests/test_gdscript.h2
-rw-r--r--main/tests/test_gui.cpp108
-rw-r--r--main/tests/test_gui.h2
-rw-r--r--main/tests/test_image.cpp2
-rw-r--r--main/tests/test_image.h2
-rw-r--r--main/tests/test_io.cpp62
-rw-r--r--main/tests/test_io.h2
-rw-r--r--main/tests/test_main.cpp23
-rw-r--r--main/tests/test_main.h2
-rw-r--r--main/tests/test_math.cpp151
-rw-r--r--main/tests/test_math.h2
-rw-r--r--main/tests/test_physics.cpp157
-rw-r--r--main/tests/test_physics.h2
-rw-r--r--main/tests/test_physics_2d.cpp2
-rw-r--r--main/tests/test_physics_2d.h2
-rw-r--r--main/tests/test_render.cpp2
-rw-r--r--main/tests/test_render.h2
-rw-r--r--main/tests/test_shader_lang.cpp10
-rw-r--r--main/tests/test_shader_lang.h2
-rw-r--r--main/tests/test_sound.cpp99
-rw-r--r--main/tests/test_sound.h40
-rw-r--r--main/tests/test_string.cpp5
-rw-r--r--main/tests/test_string.h2
33 files changed, 294 insertions, 1116 deletions
diff --git a/main/SCsub b/main/SCsub
index 1675a6e6ab..1f97cd1be0 100644
--- a/main/SCsub
+++ b/main/SCsub
@@ -1,6 +1,7 @@
#!/usr/bin/env python
Import('env')
+from compat import byte_to_str
def make_splash(target, source, env):
@@ -8,17 +9,17 @@ def make_splash(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
f = open(src, "rb")
- g = open(dst, "wb")
+ g = open(dst, "w")
buf = f.read()
g.write("/* THIS FILE IS GENERATED DO NOT EDIT */\n")
g.write("#ifndef BOOT_SPLASH_H\n")
g.write("#define BOOT_SPLASH_H\n")
- g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n");
+ g.write("static const Color boot_splash_bg_color = Color(1,1,1,1);\n")
g.write("static const unsigned char boot_splash_png[] = {\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i])) + ",\n")
+ g.write(byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
@@ -28,7 +29,7 @@ def make_app_icon(target, source, env):
src = source[0].srcnode().abspath
dst = target[0].srcnode().abspath
f = open(src, "rb")
- g = open(dst, "wb")
+ g = open(dst, "w")
buf = f.read()
@@ -37,7 +38,7 @@ def make_app_icon(target, source, env):
g.write("#define APP_ICON_H\n")
g.write("static const unsigned char app_icon_png[] = {\n")
for i in range(len(buf)):
- g.write(str(ord(buf[i])) + ",\n")
+ g.write(byte_to_str(buf[i]) + ",\n")
g.write("};\n")
g.write("#endif")
diff --git a/main/input_default.cpp b/main/input_default.cpp
index 4e2fd6f9d4..b4c9a6207f 100644
--- a/main/input_default.cpp
+++ b/main/input_default.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "input_default.h"
+
#include "input_map.h"
#include "os/os.h"
#include "scene/resources/texture.h"
@@ -96,58 +97,6 @@ bool InputDefault::is_joy_button_pressed(int p_device, int p_button) const {
bool InputDefault::is_action_pressed(const StringName &p_action) const {
return action_state.has(p_action) && action_state[p_action].pressed;
-#if 0
- if (custom_action_press.has(p_action))
- return true; //simpler
-
- const List<InputEvent> *alist = InputMap::get_singleton()->get_action_list(p_action);
- if (!alist)
- return false;
-
-
- for (const List<InputEvent>::Element *E=alist->front();E;E=E->next()) {
-
-
- int device=E->get().device;
-
- switch(E->get().type) {
-
- case InputEvent::KEY: {
-
- const InputEventKey &iek=E->get().key;
- if ((keys_pressed.has(iek->get_scancode())))
- return true;
- } break;
- case InputEvent::MOUSE_BUTTON: {
-
- const InputEventMouseButton &iemb=E->get().mouse_button;
- if(mouse_button_mask&(1<<iemb->get_button_index()))
- return true;
- } break;
- case InputEvent::JOYPAD_BUTTON: {
-
- const InputEventJoypadButton &iejb=E->get().joy_button;
- int c = _combine_device(iejb->get_button_index(),device);
- if (joy_buttons_pressed.has(c))
- return true;
- } break;
- case InputEvent::JOYPAD_MOTION: {
-
- const InputEventJoypadMotion &iejm=E->get().joy_motion;
- int c = _combine_device(iejm.axis,device);
- if (_joy_axis.has(c)) {
- if (iejm.axis_value < 0) {
- if (_joy_axis[c] < -0.5f) return true;
- }
- else
- if (_joy_axis[c] > 0.5f) return true;
- }
- } break;
- }
- }
-
- return false;
-#endif
}
bool InputDefault::is_action_just_pressed(const StringName &p_action) const {
@@ -775,7 +724,7 @@ static const char *s_ControllerMappings[] = {
"4e564944494120436f72706f72617469,NVIDIA Controller,a:b0,b:b1,dpdown:h0.4,dpleft:h0.8,dpright:h0.2,dpup:h0.1,leftshoulder:b9,leftstick:b7,lefttrigger:a4,leftx:a0,lefty:a1,rightshoulder:b10,rightstick:b8,righttrigger:a5,rightx:a2,righty:a3,start:b6,x:b2,y:b3,",
"532e542e442e20496e74657261637420,3dfx InterAct HammerHead FX,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b25,rightshoulder:b27,rightx:a2,start:b31,righty:a3,dpleft:h0.8,lefttrigger:b28,x:b20,dpup:h0.1,back:b30,leftstick:b22,leftshoulder:b26,y:b21,a:b23,dpright:h0.2,righttrigger:b29,b:b24,",
"506572666f726d616e63652044657369,PDP Rock Candy Wireless Controller for PS3,leftx:a0,lefty:a1,dpdown:h0.4,rightstick:b6,rightshoulder:b18,rightx:a2,start:b16,righty:a3,dpleft:h0.8,lefttrigger:b9,x:b0,dpup:h0.1,back:h0.2,leftstick:b4,leftshoulder:b3,y:b2,a:b1,dpright:h0.2,righttrigger:b10,b:b17,",
- "4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a0,lefty:a1,dpdown:b9,rightstick:b7,rightshoulder:b5,rightx:a3,start:b16,righty:a4,dpleft:b10,lefttrigger:b12,x:b1,dpup:b8,back:b14,leftstick:b6,leftshoulder:b4,y:b2,a:b0,dpright:b11,righttrigger:b13,b:b3,",
+ "4f5559412047616d6520436f6e74726f,OUYA Game Controller,leftx:a1,lefty:a3,dpdown:b12,rightstick:b8,rightshoulder:b10,rightx:a6,start:b-86,righty:a7,dpleft:b13,lefttrigger:b15,x:b2,dpup:b11,leftstick:b7,leftshoulder:b9,y:b3,a:b0,dpright:b14,righttrigger:b16,b:b1,",
#endif
#ifdef JAVASCRIPT_ENABLED
@@ -899,8 +848,14 @@ void InputDefault::joy_axis(int p_device, int p_axis, const JoyAxis &p_value) {
return;
}
- if (ABS(joy.last_axis[p_axis]) > 0.5 && joy.last_axis[p_axis] * p_value.value < 0) {
- //changed direction quickly, insert fake event to release pending inputmap actions
+ //when changing direction quickly, insert fake event to release pending inputmap actions
+ float last = joy.last_axis[p_axis];
+ if (p_value.min == 0 && (last < 0.25 || last > 0.75) && (last - 0.5) * (p_value.value - 0.5) < 0) {
+ JoyAxis jx;
+ jx.min = p_value.min;
+ jx.value = p_value.value < 0.5 ? 0.6 : 0.4;
+ joy_axis(p_device, p_axis, jx);
+ } else if (ABS(last) > 0.5 && last * p_value.value < 0) {
JoyAxis jx;
jx.min = p_value.min;
jx.value = p_value.value < 0 ? 0.1 : -0.1;
diff --git a/main/input_default.h b/main/input_default.h
index 35e841a488..345c34c55e 100644
--- a/main/input_default.h
+++ b/main/input_default.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -214,7 +214,7 @@ public:
virtual void start_joy_vibration(int p_device, float p_weak_magnitude, float p_strong_magnitude, float p_duration = 0);
virtual void stop_joy_vibration(int p_device);
- void set_main_loop(MainLoop *main_loop);
+ void set_main_loop(MainLoop *p_main_loop);
void set_mouse_position(const Point2 &p_posf);
void action_press(const StringName &p_action);
diff --git a/main/main.cpp b/main/main.cpp
index f23da57185..c4cc30e602 100644
--- a/main/main.cpp
+++ b/main/main.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -28,6 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "main.h"
+
#include "app_icon.gen.h"
#include "core/register_core_types.h"
#include "drivers/register_driver_types.h"
@@ -68,7 +69,6 @@
#include "core/io/file_access_zip.h"
#include "core/io/stream_peer_ssl.h"
#include "core/io/stream_peer_tcp.h"
-#include "core/os/thread.h"
#include "main/input_default.h"
#include "performance.h"
#include "translation.h"
@@ -110,6 +110,11 @@ static bool force_lowdpi = false;
static int init_screen = -1;
static bool use_vsync = true;
static bool editor = false;
+static bool show_help = false;
+static bool disable_render_loop = false;
+static int fixed_fps = -1;
+
+static OS::ProcessID allow_focus_steal_pid = 0;
static String unescape_cmdline(const String &p_str) {
@@ -126,63 +131,90 @@ static String unescape_cmdline(const String &p_str) {
void Main::print_help(const char *p_binary) {
- OS::get_singleton()->print(VERSION_FULL_NAME " (c) 2008-2017 Juan Linietsky, Ariel Manzur.\n");
- OS::get_singleton()->print("Usage: %s [options] [scene]\n", p_binary);
- OS::get_singleton()->print("Options:\n");
- OS::get_singleton()->print("\t-path [dir] : Path to a game, containing project.godot\n");
-#ifdef TOOLS_ENABLED
- OS::get_singleton()->print("\t-e,-editor : Bring up the editor instead of running the scene.\n");
-#endif
- OS::get_singleton()->print("\t-test [test] : Run a test.\n");
- OS::get_singleton()->print("\t\t(");
- const char **test_names = tests_get_names();
- const char *coma = "";
- while (*test_names) {
+ OS::get_singleton()->print(VERSION_FULL_NAME " - https://godotengine.org\n");
+ OS::get_singleton()->print("(c) 2007-2017 Juan Linietsky, Ariel Manzur.\n");
+ OS::get_singleton()->print("(c) 2014-2017 Godot Engine contributors.\n");
+ OS::get_singleton()->print("\n");
+ OS::get_singleton()->print("Usage: %s [options] [path to scene or 'project.godot' file]\n", p_binary);
+ OS::get_singleton()->print("\n");
- OS::get_singleton()->print("%s%s", coma, *test_names);
- test_names++;
- coma = ", ";
- }
- OS::get_singleton()->print(")\n");
-
- OS::get_singleton()->print("\t-r WIDTHxHEIGHT\t : Request Window Resolution\n");
- OS::get_singleton()->print("\t-p XxY\t : Request Window Position\n");
- OS::get_singleton()->print("\t-f\t\t : Request Fullscreen\n");
- OS::get_singleton()->print("\t-mx\t\t Request Maximized\n");
- OS::get_singleton()->print("\t-w\t\t Request Windowed\n");
- OS::get_singleton()->print("\t-vd DRIVER\t : Video Driver (");
- for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
+ OS::get_singleton()->print("General options:\n");
+ OS::get_singleton()->print(" -h, --help Display this help message.\n");
+ OS::get_singleton()->print(" -v, --verbose Use verbose stdout mode.\n");
+ OS::get_singleton()->print(" --quiet Quiet mode, silences stdout messages. Errors are still displayed.\n");
+ OS::get_singleton()->print("\n");
+ OS::get_singleton()->print("Run options:\n");
+#ifdef TOOLS_ENABLED
+ OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n");
+ OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n");
+#endif
+ OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n");
+ OS::get_singleton()->print(" --path <directory> Path to a project (<directory> must contain a 'project.godot' file).\n");
+ OS::get_singleton()->print(" --main-pack <file> Path to a pack (.pck) file to load.\n");
+ OS::get_singleton()->print(" --render-thread <mode> Render thread mode ('unsafe', 'safe', 'separate').\n");
+ OS::get_singleton()->print(" --remote-fs <address> Remote filesystem (<host/IP>[:<port>] address).\n");
+ OS::get_singleton()->print(" --remote-fs-password <password> Password for remote filesystem.\n");
+ OS::get_singleton()->print(" --audio-driver <driver> Audio driver (");
+ for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (i != 0)
OS::get_singleton()->print(", ");
- OS::get_singleton()->print("%s", OS::get_singleton()->get_video_driver_name(i));
+ OS::get_singleton()->print("'%s'", OS::get_singleton()->get_audio_driver_name(i));
}
- OS::get_singleton()->print(")\n");
- OS::get_singleton()->print("\t-ldpi\t : Force low-dpi mode (OSX Only)\n");
-
- OS::get_singleton()->print("\t-ad DRIVER\t : Audio Driver (");
- for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
-
+ OS::get_singleton()->print(").\n");
+ OS::get_singleton()->print(" --video-driver <driver> Video driver (");
+ for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
if (i != 0)
OS::get_singleton()->print(", ");
- OS::get_singleton()->print("%s", OS::get_singleton()->get_audio_driver_name(i));
+ OS::get_singleton()->print("'%s'", OS::get_singleton()->get_video_driver_name(i));
}
- OS::get_singleton()->print(")\n");
- OS::get_singleton()->print("\t-rthread <mode>\t : Render Thread Mode ('unsafe', 'safe', 'separate').\n");
- OS::get_singleton()->print("\t-s,-script [script] : Run a script.\n");
- OS::get_singleton()->print("\t-d,-debug : Debug (local stdout debugger).\n");
- OS::get_singleton()->print("\t-rdebug ADDRESS : Remote debug (<ip>:<port> host address).\n");
- OS::get_singleton()->print("\t-fdelay [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
- OS::get_singleton()->print("\t-timescale [msec]: Simulate high CPU load (delay each frame by [msec]).\n");
- OS::get_singleton()->print("\t-bp : breakpoint list as source::line comma separated pairs, no spaces (%%20,%%2C,etc instead).\n");
- OS::get_singleton()->print("\t-v : Verbose stdout mode\n");
- OS::get_singleton()->print("\t-lang [locale]: Use a specific locale\n");
- OS::get_singleton()->print("\t-rfs <host/ip>[:<port>] : Remote FileSystem.\n");
- OS::get_singleton()->print("\t-rfs_pass <password> : Password for Remote FileSystem.\n");
+ OS::get_singleton()->print(").\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Display options:\n");
+ OS::get_singleton()->print(" -f, --fullscreen Request fullscreen mode.\n");
+ OS::get_singleton()->print(" -m, --maximized Request a maximized window.\n");
+ OS::get_singleton()->print(" -w, --windowed Request windowed mode.\n");
+ OS::get_singleton()->print(" --resolution <W>x<H> Request window resolution.\n");
+ OS::get_singleton()->print(" --position <X>,<Y> Request window position.\n");
+ OS::get_singleton()->print(" --low-dpi Force low-DPI mode (macOS only).\n");
+ OS::get_singleton()->print(" --no-window Disable window creation (Windows only). Useful together with --script.\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Debug options:\n");
+ OS::get_singleton()->print(" -d, --debug Debug (local stdout debugger).\n");
+ OS::get_singleton()->print(" -b, --breakpoints Breakpoint list as source::line comma-separated pairs, no spaces (use %%20 instead).\n");
+ OS::get_singleton()->print(" --profiling Enable profiling in the script debugger.\n");
+ OS::get_singleton()->print(" --remote-debug <address> Remote debug (<host/IP>:<port> address).\n");
+#ifdef DEBUG_ENABLED
+ OS::get_singleton()->print(" --debug-collisions Show collisions shapes when running the scene.\n");
+ OS::get_singleton()->print(" --debug-navigation Show navigation polygons when running the scene.\n");
+#endif
+ OS::get_singleton()->print(" --frame-delay <ms> Simulate high CPU load (delay each frame by <ms> milliseconds).\n");
+ OS::get_singleton()->print(" --time-scale <scale> Force time scale (higher values are faster, 1.0 is normal speed).\n");
+ OS::get_singleton()->print(" --disable-render-loop Disable render loop so rendering only occurs when called explicitly from script.\n");
+ OS::get_singleton()->print(" --fixed-fps <fps> Forces a fixed ratio between process and fixed_process timing, for use when precision is required, or when rendering to video files. Setting this will disable real-time syncronization, so that run speed is only capped by performance\n");
+ OS::get_singleton()->print("\n");
+
+ OS::get_singleton()->print("Standalone tools:\n");
+ OS::get_singleton()->print(" -s, --script <script> Run a script.\n");
#ifdef TOOLS_ENABLED
- OS::get_singleton()->print("\t-doctool FILE: Dump the whole engine api to FILE in XML format. If FILE exists, it will be merged.\n");
- OS::get_singleton()->print("\t-nodocbase: Disallow dump the base types (used with -doctool).\n");
- OS::get_singleton()->print("\t-export [target] Export the project using given export target.\n");
+ OS::get_singleton()->print(" --export <target> Export the project using the given export target.\n");
+ OS::get_singleton()->print(" --export-debug Use together with --export, enables debug mode for the template.\n");
+ OS::get_singleton()->print(" --doctool <file> Dump the whole engine API to <file> in XML format. If <file> exists, it will be merged.\n");
+ OS::get_singleton()->print(" --no-docbase Disallow dumping the base types (used with --doctool).\n");
+#ifdef DEBUG_METHODS_ENABLED
+ OS::get_singleton()->print(" --gdnative-generate-json-api Generate JSON dump of the Godot API for GDNative bindings.\n");
+#endif
+ OS::get_singleton()->print(" --test <test> Run a unit test (");
+ const char **test_names = tests_get_names();
+ const char *comma = "";
+ while (*test_names) {
+ OS::get_singleton()->print("%s'%s'", comma, *test_names);
+ test_names++;
+ comma = ", ";
+ }
+ OS::get_singleton()->print(").\n");
#endif
}
@@ -252,15 +284,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
String remotefs;
String remotefs_pass;
- String screen = "";
-
- List<String> pack_list;
Vector<String> breakpoints;
bool use_custom_res = true;
bool force_res = false;
- I = args.front();
-
packed_data = PackedData::get_singleton();
if (!packed_data)
packed_data = memnew(PackedData);
@@ -277,18 +304,17 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
packed_data->add_pack_source(zip_packed_data);
#endif
+ I = args.front();
while (I) {
List<String>::Element *N = I->next();
- if (I->get() == "-noop") {
-
- // no op
- } else if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // resolution
+ if (I->get() == "-h" || I->get() == "--help" || I->get() == "/?") { // display help
+ show_help = true;
goto error;
- } else if (I->get() == "-r") { // resolution
+ } else if (I->get() == "--resolution") { // force resolution
if (I->next()) {
@@ -296,16 +322,16 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
if (vm.find("x") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid -r argument: %s\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid resolution '%s', it should be e.g. '1280x720'.\n", vm.utf8().get_data());
goto error;
}
int w = vm.get_slice("x", 0).to_int();
int h = vm.get_slice("x", 1).to_int();
- if (w == 0 || h == 0) {
+ if (w <= 0 || h <= 0) {
- OS::get_singleton()->print("Invalid -r resolution, x and y must be >0\n");
+ OS::get_singleton()->print("Invalid resolution '%s', width and height must be above 0.\n", vm.utf8().get_data());
goto error;
}
@@ -315,84 +341,86 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -p argument, needs resolution\n");
+ OS::get_singleton()->print("Missing resolution argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-p") { // position
+ } else if (I->get() == "--position") { // set window position
if (I->next()) {
String vm = I->next()->get();
- if (vm.find("x") == -1) { // invalid parameter format
+ if (vm.find(",") == -1) { // invalid parameter format
- OS::get_singleton()->print("Invalid -p argument: %s\n", vm.utf8().get_data());
+ OS::get_singleton()->print("Invalid position '%s', it should be e.g. '80,128'.\n", vm.utf8().get_data());
goto error;
}
- int x = vm.get_slice("x", 0).to_int();
- int y = vm.get_slice("x", 1).to_int();
+ int x = vm.get_slice(",", 0).to_int();
+ int y = vm.get_slice(",", 1).to_int();
init_custom_pos = Point2(x, y);
init_use_custom_pos = true;
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -r argument, needs position\n");
+ OS::get_singleton()->print("Missing position argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-mx") { // video driver
+ } else if (I->get() == "-m" || I->get() == "--maximized") { // force maximized window
init_maximized = true;
- } else if (I->get() == "-w") { // video driver
+ } else if (I->get() == "-w" || I->get() == "--windowed") { // force windowed window
init_windowed = true;
- } else if (I->get() == "-profile") { // video driver
+ } else if (I->get() == "--profiling") { // enable profiling
use_debug_profiler = true;
- } else if (I->get() == "-vd") { // video driver
+ } else if (I->get() == "--video-driver") { // force video driver
if (I->next()) {
video_driver = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -cd argument, needs driver name\n");
+ OS::get_singleton()->print("Missing video driver argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-lang") { // language
+ } else if (I->get() == "-l" || I->get() == "--language") { // language
if (I->next()) {
locale = I->next()->get();
N = I->next()->next();
} else {
- OS::get_singleton()->print("Invalid -lang argument, needs language code\n");
+ OS::get_singleton()->print("Missing language argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-ldpi") { // language
+ } else if (I->get() == "--low-dpi") { // force low DPI (macOS only)
force_lowdpi = true;
- } else if (I->get() == "-rfs") { // language
+ } else if (I->get() == "--remote-fs") { // remote filesystem
if (I->next()) {
remotefs = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote filesystem address, aborting.\n");
goto error;
}
- } else if (I->get() == "-rfs_pass") { // language
+ } else if (I->get() == "--remote-fs-password") { // remote filesystem password
if (I->next()) {
remotefs_pass = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote filesystem password, aborting.\n");
goto error;
}
- } else if (I->get() == "-rthread") { // language
+ } else if (I->get() == "--render-thread") { // render thread mode
if (I->next()) {
@@ -405,35 +433,37 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing render thread mode argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-ad") { // video driver
+ } else if (I->get() == "--audio-driver") { // audio driver
if (I->next()) {
audio_driver = I->next()->get();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing audio driver argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-f") { // fullscreen
+ } else if (I->get() == "-f" || I->get() == "--fullscreen") { // force fullscreen
//video_mode.fullscreen=false;
init_fullscreen = true;
- } else if (I->get() == "-e" || I->get() == "-editor") { // fonud editor
+ } else if (I->get() == "-e" || I->get() == "--editor") { // starts editor
editor = true;
- } else if (I->get() == "-nowindow") { // fullscreen
+ } else if (I->get() == "--no-window") { // disable window creation, Windows only
OS::get_singleton()->set_no_window_mode(true);
- } else if (I->get() == "-quiet") { // fullscreen
+ } else if (I->get() == "--quiet") { // quieter output
quiet_stdout = true;
- } else if (I->get() == "-v") { // fullscreen
+ } else if (I->get() == "-v" || I->get() == "--verbose") { // verbose output
OS::get_singleton()->_verbose_stdout = true;
- } else if (I->get() == "-path") { // resolution
+ } else if (I->get() == "--path") { // set path of project to start or edit
if (I->next()) {
@@ -445,6 +475,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
}
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing relative or absolute path, aborting.\n");
goto error;
}
} else if (I->get().ends_with("project.godot")) {
@@ -464,7 +495,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = true;
#endif
- } else if (I->get() == "-bp") { // /breakpoints
+ } else if (I->get() == "-b" || I->get() == "--breakpoints") { // add breakpoints
if (I->next()) {
@@ -472,88 +503,82 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
breakpoints = bplist.split(",");
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing list of breakpoints, aborting.\n");
goto error;
}
- } else if (I->get() == "-fdelay") { // resolution
+ } else if (I->get() == "--frame-delay") { // force frame delay
if (I->next()) {
frame_delay = I->next()->get().to_int();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing frame delay argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-timescale") { // resolution
+ } else if (I->get() == "--time-scale") { // force time scale
if (I->next()) {
Engine::get_singleton()->set_time_scale(I->next()->get().to_double());
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing time scale argument, aborting.\n");
goto error;
}
- } else if (I->get() == "-pack") {
-
- if (I->next()) {
-
- pack_list.push_back(I->next()->get());
- N = I->next()->next();
- } else {
-
- goto error;
- };
-
- } else if (I->get() == "-main_pack") {
+ } else if (I->get() == "--main-pack") {
if (I->next()) {
main_pack = I->next()->get();
N = I->next()->next();
} else {
-
+ OS::get_singleton()->print("Missing path to main pack file, aborting.\n");
goto error;
};
- } else if (I->get() == "-debug" || I->get() == "-d") {
+ } else if (I->get() == "-d" || I->get() == "--debug") {
debug_mode = "local";
#ifdef DEBUG_ENABLED
- } else if (I->get() == "-debugcol" || I->get() == "-dc") {
+ } else if (I->get() == "--debug-collisions") {
debug_collisions = true;
- } else if (I->get() == "-debugnav" || I->get() == "-dn") {
+ } else if (I->get() == "--debug-navigation") {
debug_navigation = true;
#endif
- } else if (I->get() == "-editor_scene") {
-
- if (I->next()) {
-
- ProjectSettings::get_singleton()->set("editor_scene", game_path = I->next()->get());
- } else {
- goto error;
- }
-
- } else if (I->get() == "-rdebug") {
+ } else if (I->get() == "--remote-debug") {
if (I->next()) {
debug_mode = "remote";
debug_host = I->next()->get();
- if (debug_host.find(":") == -1) { //wrong host
- OS::get_singleton()->print("Invalid debug host string\n");
+ if (debug_host.find(":") == -1) { // wrong address
+ OS::get_singleton()->print("Invalid debug host address, it should be of the form <host/IP>:<port>.\n");
goto error;
}
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing remote debug host address, aborting.\n");
goto error;
}
- } else if (I->get() == "-epid") {
+ } else if (I->get() == "--allow_focus_steal_pid") { // not exposed to user
if (I->next()) {
- int editor_pid = I->next()->get().to_int();
- ProjectSettings::get_singleton()->set("editor_pid", editor_pid);
+ allow_focus_steal_pid = I->next()->get().to_int64();
N = I->next()->next();
} else {
+ OS::get_singleton()->print("Missing editor PID argument, aborting.\n");
+ goto error;
+ }
+ } else if (I->get() == "--disable-render-loop") {
+ disable_render_loop = true;
+ } else if (I->get() == "--fixed-fps") {
+ if (I->next()) {
+ fixed_fps = I->next()->get().to_int();
+ N = I->next()->next();
+ } else {
+ OS::get_singleton()->print("Missing fixed-fps argument, aborting.\n");
goto error;
}
} else {
@@ -617,7 +642,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
Error err = file_access_network_client->connect(remotefs, port, remotefs_pass);
if (err) {
- OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i\n", remotefs.utf8().get_data(), port);
+ OS::get_singleton()->printerr("Could not connect to remotefs: %s:%i.\n", remotefs.utf8().get_data(), port);
goto error;
}
@@ -653,14 +678,15 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
#ifdef TOOLS_ENABLED
editor = false;
#else
- OS::get_singleton()->print("error: Couldn't load game path '%s'\n", game_path.ascii().get_data());
+ OS::get_singleton()->print("Error: Could not load game path '%s'.\n", game_path.ascii().get_data());
goto error;
#endif
}
if (editor) {
- main_args.push_back("-editor");
+ Engine::get_singleton()->set_editor_hint(true);
+ main_args.push_back("--editor");
init_maximized = true;
use_custom_res = false;
}
@@ -742,11 +768,7 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
OS::get_singleton()->_render_thread_mode = OS::RenderThreadMode(rtm);
}
- /* Determine Video Driver */
-
- if (audio_driver == "") { // specified in project.godot
- audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
- }
+ /* Determine audio and video drivers */
for (int i = 0; i < OS::get_singleton()->get_video_driver_count(); i++) {
@@ -764,6 +786,10 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
//goto error;
}
+ if (audio_driver == "") { // specified in project.godot
+ audio_driver = GLOBAL_DEF("audio/driver", OS::get_singleton()->get_audio_driver_name(0));
+ }
+
for (int i = 0; i < OS::get_singleton()->get_audio_driver_count(); i++) {
if (audio_driver == OS::get_singleton()->get_audio_driver_name(i)) {
@@ -831,7 +857,8 @@ error:
args.clear();
main_args.clear();
- print_help(execpath);
+ if (show_help)
+ print_help(execpath);
if (performance)
memdelete(performance);
@@ -872,7 +899,11 @@ error:
return ERR_INVALID_PARAMETER;
}
-Error Main::setup2() {
+Error Main::setup2(Thread::ID p_main_tid_override) {
+
+ if (p_main_tid_override) {
+ Thread::_main_thread_id = p_main_tid_override;
+ }
OS::get_singleton()->initialize(video_mode, video_driver_idx, audio_driver_idx);
if (init_use_custom_pos) {
@@ -890,9 +921,10 @@ Error Main::setup2() {
MAIN_PRINT("Main: Setup Logo");
- bool show_logo = true;
#ifdef JAVASCRIPT_ENABLED
- show_logo = false;
+ bool show_logo = false;
+#else
+ bool show_logo = true;
#endif
if (init_screen != -1) {
@@ -966,7 +998,7 @@ Error Main::setup2() {
if (bool(GLOBAL_DEF("display/window/handheld/emulate_touchscreen", false))) {
if (!OS::get_singleton()->has_touchscreen_ui_hint() && Input::get_singleton() && !editor) {
//only if no touchscreen ui hint, set emulation
- InputDefault *id = Input::get_singleton()->cast_to<InputDefault>();
+ InputDefault *id = Object::cast_to<InputDefault>(Input::get_singleton());
if (id)
id->set_emulate_touch(true);
}
@@ -1000,6 +1032,10 @@ Error Main::setup2() {
#endif
+ if (allow_focus_steal_pid) {
+ OS::get_singleton()->enable_for_stealing_focus(allow_focus_steal_pid);
+ }
+
MAIN_PRINT("Main: Load Scripts, Modules, Drivers");
register_module_types();
@@ -1047,23 +1083,18 @@ bool Main::start() {
String game_path;
String script;
String test;
- String screen;
- String _export_platform;
- String _import;
- String _import_script;
- bool noquit = false;
+ String _export_preset;
bool export_debug = false;
bool project_manager_request = false;
+
List<String> args = OS::get_singleton()->get_cmdline_args();
for (int i = 0; i < args.size(); i++) {
//parameters that do not have an argument to the right
- if (args[i] == "-nodocbase") {
+ if (args[i] == "--no-docbase") {
doc_base = false;
- } else if (args[i] == "-noquit") {
- noquit = true;
- } else if (args[i] == "-editor" || args[i] == "-e") {
+ } else if (args[i] == "-e" || args[i] == "--editor") {
editor = true;
- } else if (args[i] == "-pm" || args[i] == "-project_manager") {
+ } else if (args[i] == "-p" || args[i] == "--project-manager") {
project_manager_request = true;
} else if (args[i].length() && args[i][0] != '-' && game_path == "") {
game_path = args[i];
@@ -1071,29 +1102,21 @@ bool Main::start() {
//parameters that have an argument to the right
else if (i < (args.size() - 1)) {
bool parsed_pair = true;
- if (args[i] == "-doctool") {
+ if (args[i] == "--doctool") {
doc_tool = args[i + 1];
for (int j = i + 2; j < args.size(); j++)
removal_docs.push_back(args[j]);
- } else if (args[i] == "-script" || args[i] == "-s") {
+ } else if (args[i] == "-s" || args[i] == "--script") {
script = args[i + 1];
- } else if (args[i] == "-level" || args[i] == "-l") {
- Engine::get_singleton()->_custom_level = args[i + 1];
- } else if (args[i] == "-test") {
+ } else if (args[i] == "--test") {
test = args[i + 1];
- } else if (args[i] == "-export") {
+ } else if (args[i] == "--export") {
editor = true; //needs editor
- _export_platform = args[i + 1];
- } else if (args[i] == "-export_debug") {
+ _export_preset = args[i + 1];
+ } else if (args[i] == "--export-debug") {
editor = true; //needs editor
- _export_platform = args[i + 1];
+ _export_preset = args[i + 1];
export_debug = true;
- } else if (args[i] == "-import") {
- editor = true; //needs editor
- _import = args[i + 1];
- } else if (args[i] == "-import_script") {
- editor = true; //needs editor
- _import_script = args[i + 1];
} else {
// The parameter does not match anything known, don't skip the next argument
parsed_pair = false;
@@ -1136,10 +1159,10 @@ bool Main::start() {
#endif
- if (_export_platform != "") {
+ if (_export_preset != "") {
if (game_path == "") {
String err = "Command line param ";
- err += export_debug ? "-export_debug" : "-export";
+ err += export_debug ? "--export-debug" : "--export";
err += " passed but no destination path given.\n";
err += "Please specify the binary's file path to export to. Aborting export.";
ERR_PRINT(err.utf8().get_data());
@@ -1175,7 +1198,7 @@ bool Main::start() {
StringName instance_type = script_res->get_instance_base_type();
Object *obj = ClassDB::instance(instance_type);
- MainLoop *script_loop = obj ? obj->cast_to<MainLoop>() : NULL;
+ MainLoop *script_loop = Object::cast_to<MainLoop>(obj);
if (!script_loop) {
if (obj)
memdelete(obj);
@@ -1199,7 +1222,7 @@ bool Main::start() {
if (!main_loop) {
if (!ClassDB::class_exists(main_loop_type)) {
- OS::get_singleton()->alert("godot: error: MainLoop type doesn't exist: " + main_loop_type);
+ OS::get_singleton()->alert("Error: MainLoop type doesn't exist: " + main_loop_type);
return false;
} else {
@@ -1209,7 +1232,7 @@ bool Main::start() {
ERR_FAIL_V(false);
}
- main_loop = ml->cast_to<MainLoop>();
+ main_loop = Object::cast_to<MainLoop>(ml);
if (!main_loop) {
memdelete(ml);
@@ -1221,7 +1244,7 @@ bool Main::start() {
if (main_loop->is_class("SceneTree")) {
- SceneTree *sml = main_loop->cast_to<SceneTree>();
+ SceneTree *sml = Object::cast_to<SceneTree>(main_loop);
#ifdef DEBUG_ENABLED
if (debug_collisions) {
@@ -1243,9 +1266,9 @@ bool Main::start() {
//root_node->set_editor(editor);
//startup editor
- if (_export_platform != "") {
+ if (_export_preset != "") {
- editor_node->export_platform(_export_platform, game_path, export_debug, "", true);
+ editor_node->export_preset(_export_preset, game_path, export_debug, "", true);
game_path = ""; //no load anything
}
}
@@ -1349,19 +1372,8 @@ bool Main::start() {
#ifdef TOOLS_ENABLED
if (editor) {
- if (_import != "") {
-
- //editor_node->import_scene(_import,local_game_path,_import_script);
- if (!noquit)
- sml->quit();
- game_path = ""; //no load anything
- } else {
-
- Error serr = editor_node->load_scene(local_game_path);
- }
+ Error serr = editor_node->load_scene(local_game_path);
OS::get_singleton()->set_context(OS::CONTEXT_EDITOR);
-
- //editor_node->set_edited_scene(game);
}
#endif
}
@@ -1426,7 +1438,7 @@ bool Main::start() {
ERR_EXPLAIN("Cannot instance script for autoload, expected 'Node' inheritance, got: " + String(ibt));
ERR_CONTINUE(obj == NULL);
- n = obj->cast_to<Node>();
+ n = Object::cast_to<Node>(obj);
n->set_script(s.get_ref_ptr());
}
@@ -1435,7 +1447,6 @@ bool Main::start() {
n->set_name(name);
//defer so references are all valid on _ready()
- //sml->get_root()->add_child(n);
to_add.push_back(n);
if (global_var) {
@@ -1460,12 +1471,12 @@ bool Main::start() {
ERR_EXPLAIN("Failed loading scene: " + local_game_path);
ERR_FAIL_COND_V(!scene, false)
- //sml->get_root()->add_child(scene);
sml->add_current_scene(scene);
String iconpath = GLOBAL_DEF("application/config/icon", "Variant()");
if (iconpath != "") {
Ref<Image> icon;
+ icon.instance();
if (icon->load(iconpath) == OK)
OS::get_singleton()->set_icon(icon);
}
@@ -1473,27 +1484,6 @@ bool Main::start() {
}
#ifdef TOOLS_ENABLED
-
- /*if (_export_platform!="") {
-
- sml->quit();
- }*/
-
- /*
- if (sml->get_root_node()) {
-
- Console *console = memnew( Console );
-
- sml->get_root_node()->cast_to<RootNode>()->set_console(console);
- if (GLOBAL_DEF("console/visible_default",false).operator bool()) {
-
- console->show();
- } else {P
-
- console->hide();
- };
- }
-*/
if (project_manager_request || (script == "" && test == "" && game_path == "" && !editor)) {
ProjectManager *pmanager = memnew(ProjectManager);
@@ -1502,7 +1492,6 @@ bool Main::start() {
sml->get_root()->add_child(pmanager);
OS::get_singleton()->set_context(OS::CONTEXT_PROJECTMAN);
}
-
#endif
}
@@ -1530,6 +1519,9 @@ bool Main::iteration() {
uint64_t ticks_elapsed = ticks - last_ticks;
double step = (double)ticks_elapsed / 1000000.0;
+ if (fixed_fps != -1)
+ step = 1.0 / fixed_fps;
+
float frame_slice = 1.0 / Engine::get_singleton()->get_iterations_per_second();
Engine::get_singleton()->_frame_step = step;
@@ -1546,7 +1538,7 @@ bool Main::iteration() {
last_ticks = ticks;
- if (step > frame_slice * 8)
+ if (fixed_fps == -1 && step > frame_slice * 8)
step = frame_slice * 8;
time_accum += step;
@@ -1583,10 +1575,6 @@ bool Main::iteration() {
time_accum -= frame_slice;
message_queue->flush();
- /*
- if (AudioServer::get_singleton())
- AudioServer::get_singleton()->update();
- */
fixed_process_ticks = MAX(fixed_process_ticks, OS::get_singleton()->get_ticks_usec() - fixed_begin); // keep the largest one for reference
fixed_process_max = MAX(OS::get_singleton()->get_ticks_usec() - fixed_begin, fixed_process_max);
@@ -1603,7 +1591,7 @@ bool Main::iteration() {
VisualServer::get_singleton()->sync(); //sync if still drawing from previous frames.
- if (OS::get_singleton()->can_draw()) {
+ if (OS::get_singleton()->can_draw() && !disable_render_loop) {
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
if (VisualServer::get_singleton()->has_changed()) {
@@ -1635,7 +1623,6 @@ bool Main::iteration() {
script_debugger->idle_poll();
}
- //x11_delay_usec(10000);
frames++;
Engine::get_singleton()->_idle_frames++;
@@ -1655,6 +1642,9 @@ bool Main::iteration() {
frames = 0;
}
+ if (fixed_fps != -1)
+ return exit;
+
if (OS::get_singleton()->is_in_low_processor_usage_mode() || !OS::get_singleton()->can_draw())
OS::get_singleton()->delay_usec(16600); //apply some delay to force idle time (results in about 60 FPS max)
else {
@@ -1737,7 +1727,6 @@ void Main::cleanup() {
unregister_core_driver_types();
unregister_core_types();
- //PerformanceMetrics::finish();
OS::get_singleton()->clear_last_error();
OS::get_singleton()->finalize_core();
}
diff --git a/main/main.h b/main/main.h
index ca96e397ca..2c1d42a163 100644
--- a/main/main.h
+++ b/main/main.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -34,6 +34,7 @@
@author Juan Linietsky <reduzio@gmail.com>
*/
+#include "core/os/thread.h"
#include "error_list.h"
#include "typedefs.h"
@@ -49,7 +50,7 @@ class Main {
public:
static Error setup(const char *execpath, int argc, char *argv[], bool p_second_phase = true);
- static Error setup2();
+ static Error setup2(Thread::ID p_main_tid_override = 0);
static bool start();
static bool iteration();
static void cleanup();
diff --git a/main/performance.cpp b/main/performance.cpp
index 3d8e21bf33..e85d2bf736 100644
--- a/main/performance.cpp
+++ b/main/performance.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -40,35 +40,35 @@ void Performance::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_monitor", "monitor"), &Performance::get_monitor);
- BIND_CONSTANT(TIME_FPS);
- BIND_CONSTANT(TIME_PROCESS);
- BIND_CONSTANT(TIME_FIXED_PROCESS);
- BIND_CONSTANT(MEMORY_STATIC);
- BIND_CONSTANT(MEMORY_DYNAMIC);
- BIND_CONSTANT(MEMORY_STATIC_MAX);
- BIND_CONSTANT(MEMORY_DYNAMIC_MAX);
- BIND_CONSTANT(MEMORY_MESSAGE_BUFFER_MAX);
- BIND_CONSTANT(OBJECT_COUNT);
- BIND_CONSTANT(OBJECT_RESOURCE_COUNT);
- BIND_CONSTANT(OBJECT_NODE_COUNT);
- BIND_CONSTANT(RENDER_OBJECTS_IN_FRAME);
- BIND_CONSTANT(RENDER_VERTICES_IN_FRAME);
- BIND_CONSTANT(RENDER_MATERIAL_CHANGES_IN_FRAME);
- BIND_CONSTANT(RENDER_SHADER_CHANGES_IN_FRAME);
- BIND_CONSTANT(RENDER_SURFACE_CHANGES_IN_FRAME);
- BIND_CONSTANT(RENDER_DRAW_CALLS_IN_FRAME);
- BIND_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL);
- BIND_CONSTANT(RENDER_VIDEO_MEM_USED);
- BIND_CONSTANT(RENDER_TEXTURE_MEM_USED);
- BIND_CONSTANT(RENDER_VERTEX_MEM_USED);
- BIND_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS);
- BIND_CONSTANT(PHYSICS_2D_COLLISION_PAIRS);
- BIND_CONSTANT(PHYSICS_2D_ISLAND_COUNT);
- BIND_CONSTANT(PHYSICS_3D_ACTIVE_OBJECTS);
- BIND_CONSTANT(PHYSICS_3D_COLLISION_PAIRS);
- BIND_CONSTANT(PHYSICS_3D_ISLAND_COUNT);
-
- BIND_CONSTANT(MONITOR_MAX);
+ BIND_ENUM_CONSTANT(TIME_FPS);
+ BIND_ENUM_CONSTANT(TIME_PROCESS);
+ BIND_ENUM_CONSTANT(TIME_FIXED_PROCESS);
+ BIND_ENUM_CONSTANT(MEMORY_STATIC);
+ BIND_ENUM_CONSTANT(MEMORY_DYNAMIC);
+ BIND_ENUM_CONSTANT(MEMORY_STATIC_MAX);
+ BIND_ENUM_CONSTANT(MEMORY_DYNAMIC_MAX);
+ BIND_ENUM_CONSTANT(MEMORY_MESSAGE_BUFFER_MAX);
+ BIND_ENUM_CONSTANT(OBJECT_COUNT);
+ BIND_ENUM_CONSTANT(OBJECT_RESOURCE_COUNT);
+ BIND_ENUM_CONSTANT(OBJECT_NODE_COUNT);
+ BIND_ENUM_CONSTANT(RENDER_OBJECTS_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_VERTICES_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_MATERIAL_CHANGES_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_SHADER_CHANGES_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_SURFACE_CHANGES_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_DRAW_CALLS_IN_FRAME);
+ BIND_ENUM_CONSTANT(RENDER_USAGE_VIDEO_MEM_TOTAL);
+ BIND_ENUM_CONSTANT(RENDER_VIDEO_MEM_USED);
+ BIND_ENUM_CONSTANT(RENDER_TEXTURE_MEM_USED);
+ BIND_ENUM_CONSTANT(RENDER_VERTEX_MEM_USED);
+ BIND_ENUM_CONSTANT(PHYSICS_2D_ACTIVE_OBJECTS);
+ BIND_ENUM_CONSTANT(PHYSICS_2D_COLLISION_PAIRS);
+ BIND_ENUM_CONSTANT(PHYSICS_2D_ISLAND_COUNT);
+ BIND_ENUM_CONSTANT(PHYSICS_3D_ACTIVE_OBJECTS);
+ BIND_ENUM_CONSTANT(PHYSICS_3D_COLLISION_PAIRS);
+ BIND_ENUM_CONSTANT(PHYSICS_3D_ISLAND_COUNT);
+
+ BIND_ENUM_CONSTANT(MONITOR_MAX);
}
String Performance::get_monitor_name(Monitor p_monitor) const {
@@ -125,9 +125,7 @@ float Performance::get_monitor(Monitor p_monitor) const {
case OBJECT_NODE_COUNT: {
MainLoop *ml = OS::get_singleton()->get_main_loop();
- if (!ml)
- return 0;
- SceneTree *sml = ml->cast_to<SceneTree>();
+ SceneTree *sml = Object::cast_to<SceneTree>(ml);
if (!sml)
return 0;
return sml->get_node_count();
diff --git a/main/performance.h b/main/performance.h
index 75583c6c38..a9e3c07d7c 100644
--- a/main/performance.h
+++ b/main/performance.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_containers.cpp b/main/tests/test_containers.cpp
deleted file mode 100644
index 956be5d169..0000000000
--- a/main/tests/test_containers.cpp
+++ /dev/null
@@ -1,92 +0,0 @@
-/*************************************************************************/
-/* test_containers.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "test_containers.h"
-
-#include "dvector.h"
-#include "math_funcs.h"
-#include "print_string.h"
-#include "servers/visual/default_mouse_cursor.xpm"
-#include "set.h"
-
-#include "image.h"
-#include "list.h"
-#include "variant.h"
-
-namespace TestContainers {
-
-MainLoop *test() {
-
- /*
- HashMap<int,int> int_map;
-
- for (int i=0;i<68000;i++) {
-
- int num=(int)Math::random(0,1024);
- int_map[i]=num;
- }
- */
-
- {
-
- };
-
-#if 0
- Set<int> set;
-
- print_line("Begin Insert");
- for (int i=0;i<1100;i++) {
-
- int num=i;//(int)Math::random(0,1024);
- //print_line("inserting "+itos(num));
- set.insert( num );
- }
-
- /*
- for (int i=0;i<400;i++) {
-
- int num=(int)Math::random(0,1024);
- set.erase(num);
- }
- */
- //set.print_tree();
-
- for(Set<int>::Element *I=set.front();I;I=I->next()) {
-
- print_line("inserted "+itos(I->get())+" prev is "+itos(I->prev()?I->prev()->get():-100));
-
- }
-
- print_line("depth is "+itos(set.calculate_depth()));
- print_line("Insert Success");
-#endif
-
- return NULL;
-}
-}
diff --git a/main/tests/test_containers.h b/main/tests/test_containers.h
deleted file mode 100644
index 7b589d4057..0000000000
--- a/main/tests/test_containers.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*************************************************************************/
-/* test_containers.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef TEST_CONTAINERS_H
-#define TEST_CONTAINERS_H
-
-#include "os/main_loop.h"
-/**
- @author Juan Linietsky <reduzio@gmail.com>
-*/
-
-namespace TestContainers {
-
-MainLoop *test();
-}
-
-#endif
diff --git a/main/tests/test_gdscript.cpp b/main/tests/test_gdscript.cpp
index 95147d8467..bcf4278bde 100644
--- a/main/tests/test_gdscript.cpp
+++ b/main/tests/test_gdscript.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -911,7 +911,7 @@ static void _disassemble_class(const Ref<GDScript> &p_class, const Vector<String
}
}
-MainLoop *test(TestType p_test) {
+MainLoop *test(TestType p_type) {
List<String> cmdlargs = OS::get_singleton()->get_cmdline_args();
@@ -950,7 +950,7 @@ MainLoop *test(TestType p_test) {
}
}
- if (p_test == TEST_TOKENIZER) {
+ if (p_type == TEST_TOKENIZER) {
GDTokenizerText tk;
tk.set_code(code);
@@ -993,7 +993,7 @@ MainLoop *test(TestType p_test) {
}
}
- if (p_test == TEST_PARSER) {
+ if (p_type == TEST_PARSER) {
GDParser parser;
Error err = parser.parse(code);
@@ -1010,7 +1010,7 @@ MainLoop *test(TestType p_test) {
_parser_show_class(cnode, 0, lines);
}
- if (p_test == TEST_COMPILER) {
+ if (p_type == TEST_COMPILER) {
GDParser parser;
@@ -1044,7 +1044,7 @@ MainLoop *test(TestType p_test) {
current = current->get_base();
}
- } else if (p_test == TEST_BYTECODE) {
+ } else if (p_type == TEST_BYTECODE) {
Vector<uint8_t> buf = GDTokenizerBuffer::parse_code_string(code);
String dst = test.get_basename() + ".gdc";
@@ -1053,16 +1053,6 @@ MainLoop *test(TestType p_test) {
memdelete(fw);
}
-#if 0
- Parser parser;
- Error err = parser.parse(code);
- if (err) {
- print_line("error:"+itos(parser.get_error_line())+":"+itos(parser.get_error_column())+":"+parser.get_error());
- } else {
- print_line("Parse O-K!");
- }
-#endif
-
memdelete(fa);
return NULL;
@@ -1073,7 +1063,7 @@ MainLoop *test(TestType p_test) {
namespace TestGDScript {
-MainLoop *test(TestType p_test) {
+MainLoop *test(TestType p_type) {
return NULL;
}
diff --git a/main/tests/test_gdscript.h b/main/tests/test_gdscript.h
index b4e1665de5..f37b175913 100644
--- a/main/tests/test_gdscript.h
+++ b/main/tests/test_gdscript.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_gui.cpp b/main/tests/test_gui.cpp
index 3c6a708cd8..d9b2873d6b 100644
--- a/main/tests/test_gui.cpp
+++ b/main/tests/test_gui.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -70,32 +70,6 @@ public:
SceneTree::init();
-#if 0
-
-
- Viewport *vp = memnew( Viewport );
- vp->set_world( Ref<World>( memnew( World )));
- get_root()->add_child(vp);
-
- vp->set_rect(Rect2(0,0,256,256));
- vp->set_as_render_target(true);
- vp->set_render_target_update_mode(Viewport::RENDER_TARGET_UPDATE_ALWAYS);
-
-
- Camera *camera = memnew( Camera );
- vp->add_child(camera);
- camera->make_current();
-
- Sprite *sp = memnew( Sprite );
- sp->set_texture( vp->get_render_target_texture() );
- //sp->set_texture( ResourceLoader::load("res://ball.png") );
- sp->set_position(Point2(300,300));
- get_root()->add_child(sp);
-
-
- return;
-#endif
-
Panel *frame = memnew(Panel);
frame->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
frame->set_anchor(MARGIN_BOTTOM, Control::ANCHOR_END);
@@ -111,7 +85,6 @@ public:
label->set_position(Point2(80, 90));
label->set_size(Point2(170, 80));
label->set_align(Label::ALIGN_FILL);
- //label->set_text("There");
label->set_text("There was once upon a time a beautiful unicorn that loved to play with little girls...");
frame->add_child(label);
@@ -124,25 +97,6 @@ public:
frame->add_child(button);
-#if 0
- Sprite *tf = memnew( Sprite );
- frame->add_child(tf);
- Image img;
- ImageLoader::load_image("LarvoClub.png",&img);
-
- img.resize(512,512);
- img.generate_mipmaps();
- img.compress(Image::COMPRESS_PVRTC4);
- Ref<ImageTexture> tt = memnew( ImageTexture );
- tt->create_from_image(img);
- tf->set_texture(tt);
- tf->set_position(Point2(50,50));
- //tf->set_scale(Point2(0.3,0.3));
-
-
- return;
-#endif
-
Tree *tree = memnew(Tree);
tree->set_columns(2);
@@ -182,9 +136,6 @@ public:
frame->add_child(tree);
- //control = memnew( Control );
- //root->add_child( control );
-
LineEdit *line_edit = memnew(LineEdit);
line_edit->set_position(Point2(30, 190));
@@ -244,41 +195,11 @@ public:
frame->add_child(options);
- /*
- Tree * tree = memnew( Tree );
- tree->set_columns(2);
-
- tree->set_position( Point2( 230,210 ) );
- tree->set_size( Point2( 150,250 ) );
-
-
- TreeItem *item = tree->create_item();
- item->set_editable(0,true);
- item->set_text(0,"root");
- item = tree->create_item( tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_CHECK);
- item->set_editable(0,true);
- item->set_text(0,"check");
- item = tree->create_item( tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0,true);
- item->set_range_config(0,0,20,0.1);
- item->set_range(0,2);
- item->add_button(0,Theme::get_default()->get_icon("folder","FileDialog"));
- item = tree->create_item( tree->get_root() );
- item->set_cell_mode(0, TreeItem::CELL_MODE_RANGE);
- item->set_editable(0,true);
- item->set_text(0,"Have,Many,Several,Options!");
- item->set_range(0,2);
-
- frame->add_child(tree);
-*/
-
RichTextLabel *richtext = memnew(RichTextLabel);
richtext->set_position(Point2(600, 210));
richtext->set_size(Point2(180, 250));
- richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, 20);
+ richtext->set_anchor_and_margin(MARGIN_RIGHT, Control::ANCHOR_END, -20);
frame->add_child(richtext);
@@ -306,20 +227,10 @@ public:
richtext->add_text("keep writing a lot of text");
richtext->pop();
richtext->add_text(" so the label control overflows and the scrollbar appears.\n");
- //richtext->push_indent(1);
- //richtext->add_text("By the way, testing indent levels! Yohohoho! Everything should appear to the right sightly here!\n");
- //richtext->pop();
richtext->push_meta("http://www.scrollingcapabilities.xz");
richtext->add_text("This allows to test for the scrolling capabilities ");
richtext->pop();
richtext->add_text("of the rich text label for huge text (not like this text will really be huge but, you know).\nAs long as it is so long that it will work nicely for a test/demo, then it's welcomed in my book...\nChanging subject, the day is cloudy today and I'm wondering if I'll get che chance to travel somewhere nice. Sometimes, watching the clouds from satellite images may give a nice insight about how pressure zones in our planet work, althogh it also makes it pretty obvious to see why most weather forecasts get it wrong so often.\nClouds are so difficult to predict!\nBut it's pretty cool how our civilization has adapted to having water falling from the sky each time it rains...");
- //richtext->add_text("Hello!\nGorgeous..");
-
- //richtext->push_meta("http://www.scrollingcapabilities.xz");
- ///richtext->add_text("Hello!\n");
- //richtext->pop();
-
- richtext->set_anchor(MARGIN_RIGHT, Control::ANCHOR_END);
TabContainer *tabc = memnew(TabContainer);
@@ -348,21 +259,6 @@ public:
tabc->set_position(Point2(400, 210));
tabc->set_size(Point2(180, 250));
-
- /*Ref<ImageTexture> text = memnew( ImageTexture );
- text->load("test_data/concave.png");
-
- Sprite* sprite = memnew(Sprite);
- sprite->set_texture(text);
- sprite->set_position(Point2(300, 300));
- frame->add_child(sprite);
- sprite->show();
-
- Sprite* sprite2 = memnew(Sprite);
- sprite->set_texture(text);
- sprite->add_child(sprite2);
- sprite2->set_position(Point2(50, 50));
- sprite2->show();*/
}
};
diff --git a/main/tests/test_gui.h b/main/tests/test_gui.h
index 881ff96956..a5c5695980 100644
--- a/main/tests/test_gui.h
+++ b/main/tests/test_gui.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_image.cpp b/main/tests/test_image.cpp
index 0b120f87d5..b94d93b2b1 100644
--- a/main/tests/test_image.cpp
+++ b/main/tests/test_image.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_image.h b/main/tests/test_image.h
index 3b1783ded7..254bccea85 100644
--- a/main/tests/test_image.h
+++ b/main/tests/test_image.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_io.cpp b/main/tests/test_io.cpp
index f7c49c9249..f96c5cfe3c 100644
--- a/main/tests/test_io.cpp
+++ b/main/tests/test_io.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -112,66 +112,6 @@ MainLoop *test() {
FileAccess::make_default<FileAccessMemory>(FileAccess::ACCESS_USERDATA);
print_line("archive test");
-#if 0
- Archive arch;
-
- Archive::get_singleton()->add_package("a_package");
- FileAccessArchive f;
-
- print_line("opening for read");
- f._open("file.txt", FileAccess::READ);
- int pos = f.get_pos();
- printf("file has %i bytes, initial pos %i\n", (int)f.get_len(), pos);
-
- do {
- printf("%c", f.get_8());
-
- } while (!f.eof_reached());
-
- print_line("opening for stored seek");
- f.open("seek.bin", FileAccess::READ);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- f.seek(128);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
-
- print_line("opening for deflated seek");
- f.open("seek_deflated.bin", FileAccess::READ);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- f.seek(128);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- f.seek(256);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- f.seek(4);
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
- pos = f.get_pos();
- printf("byte at pos %i is %i\n", pos, (int)f.get_8());
-
- f.close();
-
- DirAccessArchive d;
- String dir = "../blah1/blah2/blahask/../blah3/.//blah4/";
- printf("changing dir to %s\n", dir.utf8().get_data());
- d.change_dir(dir);
- printf("current dir is %s\n", d.get_current_dir().utf8().get_data());
-
- FileAccessMemory::cleanup();
-#endif
};
print_line("test done");
diff --git a/main/tests/test_io.h b/main/tests/test_io.h
index 765c083955..ffb834b894 100644
--- a/main/tests/test_io.h
+++ b/main/tests/test_io.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_main.cpp b/main/tests/test_main.cpp
index f3ed4604e1..794bdb757b 100644
--- a/main/tests/test_main.cpp
+++ b/main/tests/test_main.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -32,19 +32,16 @@
#ifdef DEBUG_ENABLED
-#include "test_containers.h"
+#include "test_gdscript.h"
#include "test_gui.h"
+#include "test_image.h"
+#include "test_io.h"
#include "test_math.h"
#include "test_physics.h"
#include "test_physics_2d.h"
#include "test_render.h"
-#include "test_sound.h"
-#include "test_string.h"
-
-#include "test_gdscript.h"
-#include "test_image.h"
-#include "test_io.h"
#include "test_shader_lang.h"
+#include "test_string.h"
const char **tests_get_names() {
@@ -71,11 +68,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
return TestString::test();
}
- if (p_test == "containers") {
-
- return TestContainers::test();
- }
-
if (p_test == "math") {
return TestMath::test();
@@ -103,11 +95,6 @@ MainLoop *test_main(String p_test, const List<String> &p_args) {
}
#endif
- //if (p_test=="sound") {
-
- // return TestSound::test();
- //}
-
if (p_test == "io") {
return TestIO::test();
diff --git a/main/tests/test_main.h b/main/tests/test_main.h
index da890a4b96..0a50e3c7be 100644
--- a/main/tests/test_main.h
+++ b/main/tests/test_main.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_math.cpp b/main/tests/test_math.cpp
index d21be24dab..3ba8ef51b4 100644
--- a/main/tests/test_math.cpp
+++ b/main/tests/test_math.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -205,54 +205,12 @@ class GetClassAndNamespace {
case 'r':
res = 13;
break;
- /* too much, not needed for now
- case 'u': {
- //hexnumbarh - oct is deprecated
-
-
- for(int j=0;j<4;j++) {
- CharType c = code[idx+j+1];
- if (c==0) {
- r_err_str="Unterminated String";
- return ERR_PARSE_ERROR;
- }
- if (!((c>='0' && c<='9') || (c>='a' && c<='f') || (c>='A' && c<='F'))) {
-
- r_err_str="Malformed hex constant in string";
- return ERR_PARSE_ERROR;
- }
- CharType v;
- if (c>='0' && c<='9') {
- v=c-'0';
- } else if (c>='a' && c<='f') {
- v=c-'a';
- v+=10;
- } else if (c>='A' && c<='F') {
- v=c-'A';
- v+=10;
- } else {
- ERR_PRINT("BUG");
- v=0;
- }
-
- res<<=4;
- res|=v;
-
-
- }
- idx+=4; //will add at the end anyway
-
-
- } break;*/
case '\"': res = '\"'; break;
case '\\':
res = '\\';
break;
- //case '/': res='/'; break;
default: {
res = next;
- //r_err_str="Invalid escape sequence";
- //return ERR_PARSE_ERROR;
} break;
}
@@ -413,23 +371,6 @@ void test_vec(Plane p_vec) {
print_line("out: " + v0);
v0.normal.z = (v0.d / 100.0 * 2.0 - 1.0) * v0.d;
print_line("out_F: " + v0);
-
- /*v0: 0, 0, -0.1, 0.1
-v1: 0, 0, 0, 0.1
-fix: 0, 0, 0, 0.1
-v0: 0, 0, 1.302803, 1.5
-v1: 0, 0, 1.401401, 1.5
-fix: 0, 0, 1.401401, 1.5
-v0: 0, 0, 25.851850, 26
-v1: 0, 0, 25.925926, 26
-fix: 0, 0, 25.925924, 26
-v0: 0, 0, 49.899902, 50
-v1: 0, 0, 49.949947, 50
-fix: 0, 0, 49.949951, 50
-v0: 0, 0, 100, 100
-v1: 0, 0, 100, 100
-fix: 0, 0, 100, 100
-*/
}
uint32_t ihash(uint32_t a) {
@@ -469,10 +410,9 @@ MainLoop *test() {
const float pow2to9 = 512.0f;
const float B = 15.0f;
- //const float Emax = 31.0f;
const float N = 9.0f;
- float sharedexp = 65408.000f; //(( pow2to9 - 1.0f)/ pow2to9)*powf( 2.0f, 31.0f - 15.0f);
+ float sharedexp = 65408.000f;
float cRed = MAX(0.0f, MIN(sharedexp, r));
float cGreen = MAX(0.0f, MIN(sharedexp, g));
@@ -480,8 +420,6 @@ MainLoop *test() {
float cMax = MAX(cRed, MAX(cGreen, cBlue));
- // expp = MAX(-B - 1, log2(maxc)) + 1 + B
-
float expp = MAX(-B - 1.0f, floor(Math::log(cMax) / Math_LN2)) + 1.0f + B;
float sMax = (float)floor((cMax / Math::pow(2.0f, expp - B - N)) + 0.5f);
@@ -591,8 +529,6 @@ MainLoop *test() {
hashes.push_back(hashes.size());
}
- //hashes.resize(50);
-
for (int i = nearest_shift(hashes.size()); i < 20; i++) {
bool success = true;
@@ -625,7 +561,6 @@ MainLoop *test() {
}
{
- //print_line("NUM: "+itos(237641278346127));
print_line("NUM: " + itos(-128));
return NULL;
}
@@ -635,14 +570,12 @@ MainLoop *test() {
v.normalize();
float a = 0.3;
- //Quat q(v,a);
Basis m(v, a);
Vector3 v2(7, 3, 1);
v2.normalize();
float a2 = 0.8;
- //Quat q(v,a);
Basis m2(v2, a2);
Quat q = m;
@@ -749,86 +682,6 @@ MainLoop *test() {
print_line("scalar /=: " + v);
}
-#if 0
- print_line(String("C:\\momo\\.\\popo\\..\\gongo").simplify_path());
- print_line(String("res://../popo/..//gongo").simplify_path());
- print_line(String("res://..").simplify_path());
-
-
- PoolVector<uint8_t> a;
- PoolVector<uint8_t> b;
-
- a.resize(20);
- b=a;
- b.resize(30);
- a=b;
-#endif
-
-#if 0
- String za = String::utf8("รก");
- printf("unicode: %x\n",za[0]);
- CharString cs=za.utf8();
- for(int i=0;i<cs.size();i++) {
- uint32_t v = uint8_t(cs[i]);
- printf("%i - %x\n",i,v);
- }
- return NULL;
-
- print_line(String("C:\\window\\system\\momo").path_to("C:\\window\\momonga"));
- print_line(String("res://momo/sampler").path_to("res://pindonga"));
- print_line(String("/margarito/terere").path_to("/margarito/pilates"));
- print_line(String("/algo").path_to("/algo"));
- print_line(String("c:").path_to("c:\\"));
- print_line(String("/").path_to("/"));
-
-
- print_line(itos(sizeof(Variant)));
- return NULL;
-
- Vector<StringName> path;
- path.push_back("three");
- path.push_back("two");
- path.push_back("one");
- path.push_back("comeon");
- path.revert();
-
- NodePath np(path,true);
-
- print_line(np);
-
-
- return NULL;
-
- bool a=2;
-
- print_line(Variant(a));
-
-
- Transform2D mat2_1;
- mat2_1.rotate(0.5);
- Transform2D mat2_2;
- mat2_2.translate(Vector2(1,2));
- Transform2D mat2_3 = mat2_1 * mat2_2;
- mat2_3.affine_invert();
-
- print_line(mat2_3.elements[0]);
- print_line(mat2_3.elements[1]);
- print_line(mat2_3.elements[2]);
-
-
-
- Transform mat3_1;
- mat3_1.basis.rotate(Vector3(0,0,1),0.5);
- Transform mat3_2;
- mat3_2.translate(Vector3(1,2,0));
- Transform mat3_3 = mat3_1 * mat3_2;
- mat3_3.affine_invert();
-
- print_line(mat3_3.basis.get_axis(0));
- print_line(mat3_3.basis.get_axis(1));
- print_line(mat3_3.origin);
-
-#endif
return NULL;
}
}
diff --git a/main/tests/test_math.h b/main/tests/test_math.h
index 24fd442dd0..a0328a14d0 100644
--- a/main/tests/test_math.h
+++ b/main/tests/test_math.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_physics.cpp b/main/tests/test_physics.cpp
index 5a233e818e..f149821928 100644
--- a/main/tests/test_physics.cpp
+++ b/main/tests/test_physics.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -71,7 +71,6 @@ class TestPhysicsMainLoop : public MainLoop {
PhysicsDirectBodyState *state = (PhysicsDirectBodyState *)p_state;
VisualServer *vs = VisualServer::get_singleton();
Transform t = state->get_transform();
- //t.basis.scale( Vector3(1.0,0.5,0.2) );
vs->instance_set_transform(p_visual_instance, t);
}
@@ -208,7 +207,6 @@ protected:
d[VS::ARRAY_VERTEX] = p_faces;
d[VS::ARRAY_NORMAL] = normals;
vs->mesh_add_surface_from_arrays(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, d);
- //vs->material_set_flag( trimesh_mat, VisualServer::MATERIAL_FLAG_UNSHADED,true);
RID triins = vs->instance_create2(trimesh_mesh, scenario);
@@ -219,9 +217,6 @@ protected:
Transform tritrans = p_xform;
ps->body_set_state(tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans);
vs->instance_set_transform(triins, tritrans);
- //RID trimesh_material = vs->fixed_material_create();
- //vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) );
- //vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material );
}
void make_grid(int p_width, int p_height, float p_cellsize, float p_cellheight, const Transform &p_xform = Transform()) {
@@ -305,7 +300,6 @@ public:
/* LIGHT */
RID lightaux = vs->light_create(VisualServer::LIGHT_DIRECTIONAL);
- //vs->light_set_color( lightaux, VisualServer::LIGHT_COLOR_AMBIENT, Color(0.0,0.0,0.0) );
scenario = vs->scenario_create();
vs->light_set_shadow(lightaux, true);
light = vs->instance_create2(lightaux, scenario);
@@ -327,100 +321,14 @@ public:
vs->camera_set_perspective(camera, 60, 0.1, 40.0);
vs->camera_set_transform(camera, Transform(Basis(), Vector3(0, 9, 12)));
- //vs->scenario_set_debug(scenario,VS::SCENARIO_DEBUG_WIREFRAME);
Transform gxf;
gxf.basis.scale(Vector3(1.4, 0.4, 1.4));
gxf.origin = Vector3(-2, 1, -2);
make_grid(5, 5, 2.5, 1, gxf);
- //create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,gxf);
- //create_static_plane( Plane( Vector3(0,1,0), -2) );
- //test_joint();
test_fall();
- //test_joint();
-
- /*
- Vector<Vector3> faces;
- faces.push_back( Vector3(10,0,-5) );
- faces.push_back( Vector3(0,0,10) );
- faces.push_back( Vector3(-10,-0.2,-5) );
- make_trimesh(faces);
-*/
- /* Make Trimesh */
quit = false;
return;
-
-#if 0
-#define GRID_SIZE 5
-
- float grid[GRID_SIZE][GRID_SIZE];
-
- for (int i=0;i<GRID_SIZE;i++) {
-
- for (int j=0;j<GRID_SIZE;j++) {
-
- grid[j][i]=Math::random(0.0, 1.0 );
- }
- }
-
- Vector<Vector3> faces;
-
- for (int i=1;i<GRID_SIZE;i++) {
-
- for (int j=1;j<GRID_SIZE;j++) {
-
-#define MAKE_VERTEX(m_x, m_z) \
- faces.push_back(Vector3(m_x - GRID_SIZE / 2.0, grid[m_x][m_z], m_z - GRID_SIZE / 2.0) * 3.0)
-
- MAKE_VERTEX(i,j-1);
- MAKE_VERTEX(i,j);
- MAKE_VERTEX(i-1,j);
-
- MAKE_VERTEX(i-1,j-1);
- MAKE_VERTEX(i,j-1);
- MAKE_VERTEX(i-1,j);
-
- }
- }
- /*
- faces.clear();
- faces.push_back( Vector3(0,0,-5) );
- faces.push_back( Vector3(1,0,-1) );
- faces.push_back( Vector3(-1,-0,-1) );
- */
-
- RID trimesh_shape = ps->shape_create();
- ps->shape_set_data(trimesh_shape, PhysicsServer::SHAPE_CONCAVE_POLYGON,faces);
- faces=ps->shape_get_shape(trimesh_shape, 0);
- Vector<Vector3> normals; // for drawing
- for (int i=0;i<faces.size()/3;i++) {
-
- Plane p( faces[i*3+0],faces[i*3+1], faces[i*3+2] );
- normals.push_back(p.normal);
- normals.push_back(p.normal);
- normals.push_back(p.normal);
- }
-
- RID trimesh_mesh = vs->mesh_create();
- vs->mesh_add_surface(trimesh_mesh, VS::PRIMITIVE_TRIANGLES, VS::ARRAY_FORMAT_VERTEX|VS::ARRAY_FORMAT_NORMAL, faces.size() );
- vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_VERTEX, faces );
- vs->mesh_surface_set_array(trimesh_mesh,0,VS::ARRAY_NORMAL, normals );
- RID trimesh_mat = vs->fixed_material_create();
- vs->material_generate( trimesh_mat, Color(1.0,0.5,0.3) );
- vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_mat );
-
- RID triins = vs->instance_create2(trimesh_mesh);
-
-
-
- RID tribody = ps->body_create( PhysicsServer::BODY_MODE_STATIC, trimesh_shape);
- Transform tritrans = Transform( Basis(), Vector3(0,0,-2) );
- ps->body_set_state( tribody, PhysicsServer::BODY_STATE_TRANSFORM, tritrans );
- vs->instance_set_transform( triins, tritrans );
- RID trimesh_material = vs->fixed_material_create();
- vs->material_generate( trimesh_material, Color(0.2,0.4,0.6) );
- vs->mesh_surface_set_material( trimesh_mesh, 0, trimesh_material );
-#endif
}
virtual bool iteration(float p_time) {
@@ -445,58 +353,9 @@ public:
}
void test_joint() {
-#if 0
- PhysicsServer * ps = PhysicsServer::get_singleton();
-
- mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24)));
- RID b = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
-
- ps->joint_create_double_pin(b,Vector3(0,0,1.0),mover,Vector3(0,0,0));
- ps->body_add_collision_exception(mover,b);
-
-
- List<String> cmdline = OS::get_singleton()->get_cmdline_args();
- int link_count = LINK_COUNT;
- if (cmdline.size() > 0 && cmdline[cmdline.size()-1].to_int()) {
- link_count = cmdline[cmdline.size()-1].to_int();
- };
-
- for(int i=0;i<link_count;i++) {
-
- RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
- ps->joint_create_double_pin(b,Vector3(0,0,-0.7),c,Vector3(0,0,0.7));
- ps->body_add_collision_exception(c,b);
- b=c;
- }
-
-
- create_static_plane(Plane(Vector3(0,1,0),-8));
-#endif
}
void test_hinge() {
-#if 0
- PhysicsServer * ps = PhysicsServer::get_singleton();
-
-
- mover = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_STATIC,Transform(Basis(),Vector3(0,0,-24)));
- RID b = create_body(PhysicsServer::SHAPE_BOX,PhysicsServer::BODY_MODE_RIGID,Transform());
-
- ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(1,1,1.0)),mover,Transform(Basis(),Vector3(0,0,0)));
- ps->body_add_collision_exception(mover,b);
-
-/*
- for(int i=0;i<20;i++) {
-
- RID c = create_body(PhysicsServer::SHAPE_CAPSULE,PhysicsServer::BODY_MODE_RIGID,Transform());
- ps->joint_create_double_hinge(b,Transform(Basis(),Vector3(0,0,-0.7)),c,Transform(Basis(),Vector3(0,0,0.7)));
- ps->body_add_collision_exception(c,b);
- b=c;
- }
-
-*/
- //create_static_plane(Plane(Vector3(0,1,0),-8));
-#endif
}
void test_character() {
@@ -544,35 +403,21 @@ public:
};
PhysicsServer::ShapeType type = shape_idx[i % 4];
- //type=PhysicsServer::SHAPE_CONVEX_POLYGON;
Transform t;
t.origin = Vector3(0.0 * i, 3.5 + 1.1 * i, 0.7 + 0.0 * i);
- //t.origin=Vector3(-0.7+0.0*i,0.5+4.1*i,0);
t.basis.rotate(Vector3(0.2, -1, 0), Math_PI / 2 * 0.6);
- //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i);
- //t.basis.rotate(Vector3(0,-1,0),Math_PI/4*i);
- //t.basis.rotate(Vector3(-1,0,0),Math_PI/4*i);
create_body(type, PhysicsServer::BODY_MODE_RIGID, t);
- //RID b = create_body(type,i==0?PhysicsServer::BODY_MODE_STATIC:PhysicsServer::BODY_MODE_RIGID,t);
}
create_static_plane(Plane(Vector3(0, 1, 0), -1));
-
- /*
- create_static_plane( Plane( Vector3(1,0,0), -2) );
- create_static_plane( Plane( Vector3(-1,0,0), -2) );
- create_static_plane( Plane( Vector3(0,0,1), -2) );
- create_static_plane( Plane( Vector3(0,0,-1), -2) );
-*/
}
void test_activate() {
create_body(PhysicsServer::SHAPE_BOX, PhysicsServer::BODY_MODE_RIGID, Transform(Basis(), Vector3(0, 2, 0)), true);
- //create_body(PhysicsServer::SHAPE_SPHERE,PhysicsServer::BODY_MODE_RIGID,Transform(Basis(),Vector3(0,6,0)),true);
create_static_plane(Plane(Vector3(0, 1, 0), -1));
}
diff --git a/main/tests/test_physics.h b/main/tests/test_physics.h
index 9c9f2fa883..166bc87b4b 100644
--- a/main/tests/test_physics.h
+++ b/main/tests/test_physics.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_physics_2d.cpp b/main/tests/test_physics_2d.cpp
index 2c9b51aadb..a746973799 100644
--- a/main/tests/test_physics_2d.cpp
+++ b/main/tests/test_physics_2d.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_physics_2d.h b/main/tests/test_physics_2d.h
index e2022cb1f9..572429185f 100644
--- a/main/tests/test_physics_2d.h
+++ b/main/tests/test_physics_2d.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_render.cpp b/main/tests/test_render.cpp
index 74f7453d1b..1f6217928d 100644
--- a/main/tests/test_render.cpp
+++ b/main/tests/test_render.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_render.h b/main/tests/test_render.h
index d7849c45ca..84b882de06 100644
--- a/main/tests/test_render.h
+++ b/main/tests/test_render.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_shader_lang.cpp b/main/tests/test_shader_lang.cpp
index dc581a71e2..ddb2ed5e75 100644
--- a/main/tests/test_shader_lang.cpp
+++ b/main/tests/test_shader_lang.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -37,7 +37,6 @@
#include "scene/gui/control.h"
#include "scene/gui/text_edit.h"
#include "servers/visual/shader_language.h"
-//#include "drivers/gles2/shader_compiler_gles2.h"
typedef ShaderLanguage SL;
@@ -56,8 +55,6 @@ static String _mktab(int p_level) {
static String _typestr(SL::DataType p_type) {
return ShaderLanguage::get_datatype_name(p_type);
-
- return "";
}
static String _prestr(SL::DataPrecision p_pres) {
@@ -319,8 +316,9 @@ MainLoop *test() {
SL sl;
print_line("tokens:\n\n" + sl.token_debug(code));
- Map<StringName, Map<StringName, SL::DataType> > dt;
- dt["fragment"]["ALBEDO"] = SL::TYPE_VEC3;
+ Map<StringName, SL::FunctionInfo> dt;
+ dt["fragment"].built_ins["ALBEDO"] = SL::TYPE_VEC3;
+ dt["fragment"].can_discard = true;
Set<String> rm;
rm.insert("popo");
diff --git a/main/tests/test_shader_lang.h b/main/tests/test_shader_lang.h
index 7d871b72e7..203f3ffa87 100644
--- a/main/tests/test_shader_lang.h
+++ b/main/tests/test_shader_lang.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
diff --git a/main/tests/test_sound.cpp b/main/tests/test_sound.cpp
deleted file mode 100644
index d8737f6c8d..0000000000
--- a/main/tests/test_sound.cpp
+++ /dev/null
@@ -1,99 +0,0 @@
-/*************************************************************************/
-/* test_sound.cpp */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#include "test_sound.h"
-#include "math_funcs.h"
-#include "os/main_loop.h"
-#include "servers/visual_server.h"
-
-#include "io/resource_loader.h"
-#include "os/os.h"
-#include "print_string.h"
-#include "servers/audio_server.h"
-
-#if 0
-namespace TestSound {
-
-
-class TestMainLoop : public MainLoop {
-
- bool quit;
- Ref<Sample> sample;
-
-public:
- virtual void input_event(const InputEvent& p_event) {
-
-
- }
- virtual void request_quit() {
-
- quit=true;
- }
-
- virtual void init() {
-
- List<String> cmdline = OS::get_singleton()->get_cmdline_args();
- quit=false;
- if (cmdline.size()) {
-
- sample=ResourceLoader::load(cmdline.back()->get());
- ERR_FAIL_COND(sample.is_null());
- print_line("Sample loaded OK");
- }
-
- RID voice = AudioServer::get_singleton()->voice_create();
- AudioServer::get_singleton()->voice_play( voice, sample->get_rid() );
-
-
- }
-
- virtual bool idle(float p_time) {
- return false;
- }
-
-
- virtual bool iteration(float p_time) {
-
- return quit;
- }
- virtual void finish() {
-
- }
-
-};
-
-
-MainLoop* test() {
-
- return memnew( TestMainLoop );
-
-}
-
-}
-#endif
diff --git a/main/tests/test_sound.h b/main/tests/test_sound.h
deleted file mode 100644
index f55f25fa18..0000000000
--- a/main/tests/test_sound.h
+++ /dev/null
@@ -1,40 +0,0 @@
-/*************************************************************************/
-/* test_sound.h */
-/*************************************************************************/
-/* This file is part of: */
-/* GODOT ENGINE */
-/* http://www.godotengine.org */
-/*************************************************************************/
-/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
-/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
-/* */
-/* Permission is hereby granted, free of charge, to any person obtaining */
-/* a copy of this software and associated documentation files (the */
-/* "Software"), to deal in the Software without restriction, including */
-/* without limitation the rights to use, copy, modify, merge, publish, */
-/* distribute, sublicense, and/or sell copies of the Software, and to */
-/* permit persons to whom the Software is furnished to do so, subject to */
-/* the following conditions: */
-/* */
-/* The above copyright notice and this permission notice shall be */
-/* included in all copies or substantial portions of the Software. */
-/* */
-/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
-/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
-/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
-/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
-/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
-/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
-/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
-/*************************************************************************/
-#ifndef TEST_SOUND_H
-#define TEST_SOUND_H
-
-#include "os/main_loop.h"
-
-namespace TestSound {
-
-MainLoop *test();
-}
-
-#endif // TEST_SOUND_H
diff --git a/main/tests/test_string.cpp b/main/tests/test_string.cpp
index 5531b71c96..88d7702acc 100644
--- a/main/tests/test_string.cpp
+++ b/main/tests/test_string.cpp
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */
@@ -802,7 +802,6 @@ bool test_28() {
bool test_29() {
bool state = true;
- bool success = false;
IP_Address ip0("2001:0db8:85a3:0000:0000:8a2e:0370:7334");
OS::get_singleton()->print("ip0 is %ls\n", String(ip0).c_str());
@@ -817,7 +816,7 @@ bool test_29() {
OS::get_singleton()->print("ip6 is %ls\n", String(ip3).c_str());
String ip4 = "192.168.0.1";
- success = ip4.is_valid_ip_address();
+ bool success = ip4.is_valid_ip_address();
OS::get_singleton()->print("Is valid ipv4: %ls, %s\n", ip4.c_str(), success ? "OK" : "FAIL");
if (!success) state = false;
diff --git a/main/tests/test_string.h b/main/tests/test_string.h
index 1060adbc8d..9c97b13626 100644
--- a/main/tests/test_string.h
+++ b/main/tests/test_string.h
@@ -3,7 +3,7 @@
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
-/* http://www.godotengine.org */
+/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2017 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2017 Godot Engine contributors (cf. AUTHORS.md) */