Browse Source

Merge branch 'master' of https://github.com/not-surt/godot into snapping2

Conflicts:
	tools/editor/plugins/canvas_item_editor_plugin.cpp
	tools/editor/plugins/canvas_item_editor_plugin.h
Carl Olsson 10 years ago
parent
commit
fb2cdfe7ed
100 changed files with 663 additions and 123 deletions
  1. 4 0
      LICENSE.md
  2. 4 0
      SConstruct
  3. 69 68
      bin/tests/test_string.cpp
  4. 90 1
      core/bind/core_bind.cpp
  5. 20 0
      core/bind/core_bind.h
  6. 1 0
      core/global_constants.cpp
  7. 4 0
      core/io/file_access_pack.cpp
  8. 1 0
      core/io/file_access_pack.h
  9. 10 0
      core/io/resource_format_binary.cpp
  10. 5 0
      core/io/resource_format_xml.cpp
  11. 18 1
      core/math/camera_matrix.cpp
  12. 2 2
      core/math/geometry.h
  13. 8 0
      core/object.cpp
  14. 1 0
      core/object.h
  15. 1 0
      core/os/dir_access.h
  16. 22 2
      core/os/os.h
  17. 44 35
      core/ustring.cpp
  18. 2 3
      core/ustring.h
  19. 5 5
      core/variant_call.cpp
  20. 13 6
      core/variant_op.cpp
  21. BIN
      demos/2d/area_input/box_area.png
  22. BIN
      demos/2d/area_input/circle_area.png
  23. 4 0
      demos/2d/area_input/engine.cfg
  24. 16 0
      demos/2d/area_input/input.gd
  25. BIN
      demos/2d/area_input/input.scn
  26. 11 0
      demos/2d/fog_of_war/.fscache
  27. 12 0
      demos/2d/fog_of_war/engine.cfg
  28. BIN
      demos/2d/fog_of_war/floor.png
  29. 86 0
      demos/2d/fog_of_war/fog.gd
  30. BIN
      demos/2d/fog_of_war/fog.png
  31. BIN
      demos/2d/fog_of_war/fog.scn
  32. 29 0
      demos/2d/fog_of_war/fog.xml
  33. BIN
      demos/2d/fog_of_war/icon.png
  34. 1 0
      demos/2d/fog_of_war/icon.png.flags
  35. BIN
      demos/2d/fog_of_war/tile_edit.scn
  36. 43 0
      demos/2d/fog_of_war/troll.gd
  37. BIN
      demos/2d/fog_of_war/troll.png
  38. BIN
      demos/2d/fog_of_war/troll.scn
  39. 26 0
      demos/2d/hdr/beach_cave.gd
  40. BIN
      demos/2d/hdr/beach_cave.scn
  41. 13 0
      demos/2d/hdr/engine.cfg
  42. BIN
      demos/2d/hdr/ocean_beach.png
  43. 1 0
      demos/2d/hdr/ocean_beach.png.flags
  44. BIN
      demos/2d/hdr/ocean_cave.png
  45. 1 0
      demos/2d/hdr/ocean_cave.png.flags
  46. BIN
      demos/2d/isometric/dungeon.scn
  47. BIN
      demos/2d/isometric_light/character_shder.res
  48. BIN
      demos/2d/isometric_light/column.scn
  49. 96 0
      demos/2d/isometric_light/cubio.gd
  50. BIN
      demos/2d/isometric_light/cubio.scn
  51. BIN
      demos/2d/isometric_light/cubio/idle0001.png
  52. BIN
      demos/2d/isometric_light/cubio/idle0002.png
  53. BIN
      demos/2d/isometric_light/cubio/idle0003.png
  54. BIN
      demos/2d/isometric_light/cubio/idle0004.png
  55. BIN
      demos/2d/isometric_light/cubio/idle0005.png
  56. BIN
      demos/2d/isometric_light/cubio/idle0006.png
  57. BIN
      demos/2d/isometric_light/cubio/idle0007.png
  58. BIN
      demos/2d/isometric_light/cubio/idle0008.png
  59. BIN
      demos/2d/isometric_light/cubio/idle0009.png
  60. BIN
      demos/2d/isometric_light/cubio/idle0010.png
  61. BIN
      demos/2d/isometric_light/cubio/idle0011.png
  62. BIN
      demos/2d/isometric_light/cubio/idle0012.png
  63. BIN
      demos/2d/isometric_light/cubio/idle0013.png
  64. BIN
      demos/2d/isometric_light/cubio/idle0014.png
  65. BIN
      demos/2d/isometric_light/cubio/idle0015.png
  66. BIN
      demos/2d/isometric_light/cubio/idle0016.png
  67. BIN
      demos/2d/isometric_light/cubio/idle0017.png
  68. BIN
      demos/2d/isometric_light/cubio/idle0018.png
  69. BIN
      demos/2d/isometric_light/cubio/idle0019.png
  70. BIN
      demos/2d/isometric_light/cubio/idle0020.png
  71. BIN
      demos/2d/isometric_light/cubio/idle0021.png
  72. BIN
      demos/2d/isometric_light/cubio/idle0022.png
  73. BIN
      demos/2d/isometric_light/cubio/idle0023.png
  74. BIN
      demos/2d/isometric_light/cubio/idle0024.png
  75. BIN
      demos/2d/isometric_light/cubio/idle0025.png
  76. BIN
      demos/2d/isometric_light/cubio/idle0026.png
  77. BIN
      demos/2d/isometric_light/cubio/idle0027.png
  78. BIN
      demos/2d/isometric_light/cubio/idle0028.png
  79. BIN
      demos/2d/isometric_light/cubio/idle0029.png
  80. BIN
      demos/2d/isometric_light/cubio/idle0030.png
  81. BIN
      demos/2d/isometric_light/cubio/idle0031.png
  82. BIN
      demos/2d/isometric_light/cubio/idle0032.png
  83. BIN
      demos/2d/isometric_light/cubio/idle0033.png
  84. BIN
      demos/2d/isometric_light/cubio/idle0034.png
  85. BIN
      demos/2d/isometric_light/cubio/idle0035.png
  86. BIN
      demos/2d/isometric_light/cubio/idle0036.png
  87. BIN
      demos/2d/isometric_light/cubio/idle0037.png
  88. BIN
      demos/2d/isometric_light/cubio/idle0038.png
  89. BIN
      demos/2d/isometric_light/cubio/idle0039.png
  90. BIN
      demos/2d/isometric_light/cubio/idle0040.png
  91. BIN
      demos/2d/isometric_light/cubio/idle0041.png
  92. BIN
      demos/2d/isometric_light/cubio/idle0042.png
  93. BIN
      demos/2d/isometric_light/cubio/idle0043.png
  94. BIN
      demos/2d/isometric_light/cubio/idle0044.png
  95. BIN
      demos/2d/isometric_light/cubio/idle0045.png
  96. BIN
      demos/2d/isometric_light/cubio/idle0046.png
  97. BIN
      demos/2d/isometric_light/cubio/idle0047.png
  98. BIN
      demos/2d/isometric_light/cubio/idle0048.png
  99. BIN
      demos/2d/isometric_light/cubio/idle0049.png
  100. BIN
      demos/2d/isometric_light/cubio/idle0050.png

+ 4 - 0
LICENSE.md

@@ -21,3 +21,7 @@
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  
  CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,  
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     
  TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE     
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                
  SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.                
+
+
+**********************************************************************
+

+ 4 - 0
SConstruct

@@ -67,12 +67,16 @@ env_base.android_source_modules=[]
 env_base.android_source_files=[]
 env_base.android_source_files=[]
 env_base.android_module_libraries=[]
 env_base.android_module_libraries=[]
 env_base.android_manifest_chunk=""
 env_base.android_manifest_chunk=""
+env_base.android_permission_chunk=""
+env_base.android_appattributes_chunk=""
 env_base.disabled_modules=[]
 env_base.disabled_modules=[]
 
 
 env_base.__class__.android_module_source = methods.android_module_source
 env_base.__class__.android_module_source = methods.android_module_source
 env_base.__class__.android_module_library = methods.android_module_library
 env_base.__class__.android_module_library = methods.android_module_library
 env_base.__class__.android_module_file = methods.android_module_file
 env_base.__class__.android_module_file = methods.android_module_file
 env_base.__class__.android_module_manifest = methods.android_module_manifest
 env_base.__class__.android_module_manifest = methods.android_module_manifest
+env_base.__class__.android_module_permission = methods.android_module_permission
+env_base.__class__.android_module_attribute = methods.android_module_attribute
 env_base.__class__.disable_module = methods.disable_module
 env_base.__class__.disable_module = methods.disable_module
 
 
 env_base.__class__.add_source_files = methods.add_source_files
 env_base.__class__.add_source_files = methods.add_source_files

+ 69 - 68
bin/tests/test_string.cpp

@@ -519,12 +519,13 @@ bool test_28() {
 	char output_format[] = "\tTest:\t%ls => %ls (%s)\n";
 	char output_format[] = "\tTest:\t%ls => %ls (%s)\n";
 	String format, output;
 	String format, output;
 	Array args;
 	Array args;
+	bool error;
 	
 	
 	// %%
 	// %%
 	format = "fish %% frog";
 	format = "fish %% frog";
 	args.clear();
 	args.clear();
-	output = format.sprintf(args);
-	success = (output == String("fish % frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish % frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -534,8 +535,8 @@ bool test_28() {
 	format = "fish %d frog";
 	format = "fish %d frog";
 	args.clear();
 	args.clear();
 	args.push_back(5);
 	args.push_back(5);
-	output = format.sprintf(args);
-	success = (output == String("fish 5 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 5 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -543,8 +544,8 @@ bool test_28() {
 	format = "fish %05d frog";
 	format = "fish %05d frog";
 	args.clear();
 	args.clear();
 	args.push_back(5);
 	args.push_back(5);
-	output = format.sprintf(args);
-	success = (output == String("fish 00005 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 00005 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -552,8 +553,8 @@ bool test_28() {
 	format = "fish %5d frog";
 	format = "fish %5d frog";
 	args.clear();
 	args.clear();
 	args.push_back(5);
 	args.push_back(5);
-	output = format.sprintf(args);
-	success = (output == String("fish     5 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish     5 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -561,8 +562,8 @@ bool test_28() {
 	format = "fish %-5d frog";
 	format = "fish %-5d frog";
 	args.clear();
 	args.clear();
 	args.push_back(5);
 	args.push_back(5);
-	output = format.sprintf(args);
-	success = (output == String("fish 5     frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 5     frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -570,8 +571,8 @@ bool test_28() {
 	format = "fish %+d frog";
 	format = "fish %+d frog";
 	args.clear();
 	args.clear();
 	args.push_back(5);
 	args.push_back(5);
-	output = format.sprintf(args);
-	success = (output == String("fish +5 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish +5 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -579,8 +580,8 @@ bool test_28() {
 	format = "fish %d frog";
 	format = "fish %d frog";
 	args.clear();
 	args.clear();
 	args.push_back(-5);
 	args.push_back(-5);
-	output = format.sprintf(args);
-	success = (output == String("fish -5 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish -5 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -588,8 +589,8 @@ bool test_28() {
 	format = "fish %x frog";
 	format = "fish %x frog";
 	args.clear();
 	args.clear();
 	args.push_back(45);
 	args.push_back(45);
-	output = format.sprintf(args);
-	success = (output == String("fish 2d frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 2d frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -597,8 +598,8 @@ bool test_28() {
 	format = "fish %X frog";
 	format = "fish %X frog";
 	args.clear();
 	args.clear();
 	args.push_back(45);
 	args.push_back(45);
-	output = format.sprintf(args);
-	success = (output == String("fish 2D frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 2D frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -606,8 +607,8 @@ bool test_28() {
 	format = "fish %o frog";
 	format = "fish %o frog";
 	args.clear();
 	args.clear();
 	args.push_back(99);
 	args.push_back(99);
-	output = format.sprintf(args);
-	success = (output == String("fish 143 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 143 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -617,8 +618,8 @@ bool test_28() {
 	format = "fish %f frog";
 	format = "fish %f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish 99.990000 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 99.990000 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -626,8 +627,8 @@ bool test_28() {
 	format = "fish %11f frog";
 	format = "fish %11f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish   99.990000 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish   99.990000 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -635,8 +636,8 @@ bool test_28() {
 	format = "fish %-11f frog";
 	format = "fish %-11f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish 99.990000   frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 99.990000   frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -644,8 +645,8 @@ bool test_28() {
 	format = "fish %f frog";
 	format = "fish %f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99);
 	args.push_back(99);
-	output = format.sprintf(args);
-	success = (output == String("fish 99.000000 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 99.000000 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -653,8 +654,8 @@ bool test_28() {
 	format = "fish %+f frog";
 	format = "fish %+f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish +99.990000 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish +99.990000 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -662,8 +663,8 @@ bool test_28() {
 	format = "fish %.1f frog";
 	format = "fish %.1f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish 100.0 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 100.0 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -671,8 +672,8 @@ bool test_28() {
 	format = "fish %.12f frog";
 	format = "fish %.12f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish 99.990000000000 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 99.990000000000 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -680,8 +681,8 @@ bool test_28() {
 	format = "fish %.f frog";
 	format = "fish %.f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish 100 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish 100 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -691,8 +692,8 @@ bool test_28() {
 	format = "fish %s frog";
 	format = "fish %s frog";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == String("fish cheese frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish cheese frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -700,8 +701,8 @@ bool test_28() {
 	format = "fish %10s frog";
 	format = "fish %10s frog";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == String("fish     cheese frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish     cheese frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -709,8 +710,8 @@ bool test_28() {
 	format = "fish %-10s frog";
 	format = "fish %-10s frog";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == String("fish cheese     frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish cheese     frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -720,8 +721,8 @@ bool test_28() {
 	format = "fish %c frog";
 	format = "fish %c frog";
 	args.clear();
 	args.clear();
 	args.push_back("A");
 	args.push_back("A");
-	output = format.sprintf(args);
-	success = (output == String("fish A frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish A frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -729,8 +730,8 @@ bool test_28() {
 	format = "fish %c frog";
 	format = "fish %c frog";
 	args.clear();
 	args.clear();
 	args.push_back(65);
 	args.push_back(65);
-	output = format.sprintf(args);
-	success = (output == String("fish A frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish A frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -741,8 +742,8 @@ bool test_28() {
 	args.clear();
 	args.clear();
 	args.push_back(10);
 	args.push_back(10);
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == String("fish     cheese frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish     cheese frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -751,8 +752,8 @@ bool test_28() {
 	args.clear();
 	args.clear();
 	args.push_back(10);
 	args.push_back(10);
 	args.push_back(99);
 	args.push_back(99);
-	output = format.sprintf(args);
-	success = (output == String("fish         99 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish         99 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -762,8 +763,8 @@ bool test_28() {
 	args.push_back(10);
 	args.push_back(10);
 	args.push_back(3);
 	args.push_back(3);
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == String("fish     99.990 frog"));
+	output = format.sprintf(args, &error);
+	success = (output == String("fish     99.990 frog") && !error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -773,8 +774,8 @@ bool test_28() {
 	format = "fish %s %s frog";
 	format = "fish %s %s frog";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "not enough arguments for format string" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -783,8 +784,8 @@ bool test_28() {
 	args.clear();
 	args.clear();
 	args.push_back("hello");
 	args.push_back("hello");
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "not all arguments converted during string formatting" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -792,8 +793,8 @@ bool test_28() {
 	format = "fish %10";
 	format = "fish %10";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "incomplete format" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -801,8 +802,8 @@ bool test_28() {
 	format = "fish %&f frog";
 	format = "fish %&f frog";
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "unsupported format character" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -810,8 +811,8 @@ bool test_28() {
 	format = "fish %2.2.2f frog";
 	format = "fish %2.2.2f frog";
 	args.clear();
 	args.clear();
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "too many decimal points in format" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -820,8 +821,8 @@ bool test_28() {
 	args.clear();
 	args.clear();
 	args.push_back("cheese");
 	args.push_back("cheese");
 	args.push_back(99.99);
 	args.push_back(99.99);
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "* wants number" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -829,8 +830,8 @@ bool test_28() {
 	format = "fish %c frog";
 	format = "fish %c frog";
 	args.clear();
 	args.clear();
 	args.push_back("sc");
 	args.push_back("sc");
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "%c requires number or single-character string" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 
@@ -838,8 +839,8 @@ bool test_28() {
 	format = "fish %c frog";
 	format = "fish %c frog";
 	args.clear();
 	args.clear();
 	args.push_back(Array());
 	args.push_back(Array());
-	output = format.sprintf(args);
-	success = (output == "");
+	output = format.sprintf(args, &error);
+	success = (output == "%c requires number or single-character string" && error);
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	OS::get_singleton()->print(output_format, format.c_str(), output.c_str(), success ? "OK" : "FAIL");
 	if (!success) state = false;
 	if (!success) state = false;
 
 

+ 90 - 1
core/bind/core_bind.cpp

@@ -176,6 +176,76 @@ bool _OS::is_video_mode_fullscreen(int p_screen) const {
 
 
 }
 }
 
 
+#ifdef NEW_WM_API
+int _OS::get_screen_count() const {
+	return OS::get_singleton()->get_screen_count();
+}
+
+int _OS::get_screen() const {
+	return OS::get_singleton()->get_screen();
+}
+
+void _OS::set_screen(int p_screen) {
+	OS::get_singleton()->set_screen(p_screen);
+}
+
+Point2 _OS::get_screen_position(int p_screen) const {
+	return OS::get_singleton()->get_screen_position(p_screen);
+}
+
+Size2 _OS::get_screen_size(int p_screen) const {
+	return OS::get_singleton()->get_screen_size(p_screen);
+}
+
+Point2 _OS::get_window_position() const {
+	return OS::get_singleton()->get_window_position();
+}
+
+void _OS::set_window_position(const Point2& p_position) {
+	OS::get_singleton()->set_window_position(p_position);
+}
+
+Size2 _OS::get_window_size() const {
+	return OS::get_singleton()->get_window_size();
+}
+
+void _OS::set_window_size(const Size2& p_size) {
+	OS::get_singleton()->set_window_size(p_size);
+}
+
+void _OS::set_fullscreen(bool p_enabled) {
+	OS::get_singleton()->set_fullscreen(p_enabled);
+}
+
+bool _OS::is_fullscreen() const {
+	return OS::get_singleton()->is_fullscreen();
+}
+
+void _OS::set_resizable(bool p_enabled) {
+	OS::get_singleton()->set_resizable(p_enabled);
+}
+
+bool _OS::is_resizable() const {
+	return OS::get_singleton()->is_resizable();
+}
+
+void _OS::set_minimized(bool p_enabled) {
+	OS::get_singleton()->set_minimized(p_enabled);
+}
+
+bool _OS::is_minimized() const {
+	return OS::get_singleton()->is_minimized();
+}
+
+void _OS::set_maximized(bool p_enabled) {
+	OS::get_singleton()->set_maximized(p_enabled);
+}
+
+bool _OS::is_maximized() const {
+	return OS::get_singleton()->is_maximized();
+}
+#endif
+
 void _OS::set_use_file_access_save_and_swap(bool p_enable) {
 void _OS::set_use_file_access_save_and_swap(bool p_enable) {
 
 
 	FileAccess::set_backup_save(p_enable);
 	FileAccess::set_backup_save(p_enable);
@@ -186,7 +256,6 @@ bool _OS::is_video_mode_resizable(int p_screen) const {
 	OS::VideoMode vm;
 	OS::VideoMode vm;
 	vm = OS::get_singleton()->get_video_mode(p_screen);
 	vm = OS::get_singleton()->get_video_mode(p_screen);
 	return vm.resizable;
 	return vm.resizable;
-
 }
 }
 
 
 Array _OS::get_fullscreen_mode_list(int p_screen) const {
 Array _OS::get_fullscreen_mode_list(int p_screen) const {
@@ -637,6 +706,26 @@ void _OS::_bind_methods() {
 	ObjectTypeDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0));
 	ObjectTypeDB::bind_method(_MD("is_video_mode_resizable","screen"),&_OS::is_video_mode_resizable,DEFVAL(0));
 	ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0));
 	ObjectTypeDB::bind_method(_MD("get_fullscreen_mode_list","screen"),&_OS::get_fullscreen_mode_list,DEFVAL(0));
 
 
+#ifdef NEW_WM_API
+	ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count);
+	ObjectTypeDB::bind_method(_MD("get_screen"),&_OS::get_screen);
+	ObjectTypeDB::bind_method(_MD("set_screen"),&_OS::set_screen);
+	ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0));
+	ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0));
+	ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position);
+	ObjectTypeDB::bind_method(_MD("set_window_position"),&_OS::set_window_position);
+	ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size);
+	ObjectTypeDB::bind_method(_MD("set_window_size"),&_OS::set_window_size);
+	ObjectTypeDB::bind_method(_MD("set_fullscreen","enabled"),&_OS::set_fullscreen);
+	ObjectTypeDB::bind_method(_MD("is_fullscreen"),&_OS::is_fullscreen);
+	ObjectTypeDB::bind_method(_MD("set_resizable","enabled"),&_OS::set_resizable);
+	ObjectTypeDB::bind_method(_MD("is_resizable"),&_OS::is_resizable);
+	ObjectTypeDB::bind_method(_MD("set_minimized", "enabled"),&_OS::set_minimized);
+	ObjectTypeDB::bind_method(_MD("is_minimized"),&_OS::is_minimized);
+	ObjectTypeDB::bind_method(_MD("set_maximized", "enabled"),&_OS::set_maximized);
+	ObjectTypeDB::bind_method(_MD("is_maximized"),&_OS::is_maximized);
+#endif
+
 	ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second);
 	ObjectTypeDB::bind_method(_MD("set_iterations_per_second","iterations_per_second"),&_OS::set_iterations_per_second);
 	ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second);
 	ObjectTypeDB::bind_method(_MD("get_iterations_per_second"),&_OS::get_iterations_per_second);
 	ObjectTypeDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps);
 	ObjectTypeDB::bind_method(_MD("set_target_fps","target_fps"),&_OS::set_target_fps);

+ 20 - 0
core/bind/core_bind.h

@@ -108,6 +108,26 @@ public:
 	bool is_video_mode_resizable(int p_screen=0) const;
 	bool is_video_mode_resizable(int p_screen=0) const;
 	Array get_fullscreen_mode_list(int p_screen=0) const;
 	Array get_fullscreen_mode_list(int p_screen=0) const;
 
 
+#ifdef NEW_WM_API
+	virtual int get_screen_count() const;
+	virtual int get_screen() const;
+	virtual void set_screen(int p_screen);
+	virtual Point2 get_screen_position(int p_screen=0) const;
+	virtual Size2 get_screen_size(int p_screen=0) const;
+	virtual Point2 get_window_position() const;
+	virtual void set_window_position(const Point2& p_position);
+	virtual Size2 get_window_size() const;
+	virtual void set_window_size(const Size2& p_size);
+	virtual void set_fullscreen(bool p_enabled);
+	virtual bool is_fullscreen() const;
+	virtual void set_resizable(bool p_enabled);
+	virtual bool is_resizable() const;
+	virtual void set_minimized(bool p_enabled);
+	virtual bool is_minimized() const;
+	virtual void set_maximized(bool p_enabled);
+	virtual bool is_maximized() const;
+#endif
+
 	Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
 	Error native_video_play(String p_path, float p_volume, String p_audio_track, String p_subtitle_track);
 	bool native_video_is_playing();
 	bool native_video_is_playing();
 	void native_video_pause();
 	void native_video_pause();

+ 1 - 0
core/global_constants.cpp

@@ -313,6 +313,7 @@ static _GlobalConstant _global_constants[]={
 	BIND_GLOBAL_CONSTANT( KEY_MASK_ALT   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_ALT   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_META   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_META   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_CTRL   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_CTRL   ),
+	BIND_GLOBAL_CONSTANT( KEY_MASK_CMD   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_KPAD   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_KPAD   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_GROUP_SWITCH   ),
 	BIND_GLOBAL_CONSTANT( KEY_MASK_GROUP_SWITCH   ),
 
 

+ 4 - 0
core/io/file_access_pack.cpp

@@ -362,6 +362,10 @@ bool DirAccessPack::current_is_dir() const{
 
 
 	return cdir;
 	return cdir;
 }
 }
+bool DirAccessPack::current_is_hidden() const{
+
+	return false;
+}
 void DirAccessPack::list_dir_end() {
 void DirAccessPack::list_dir_end() {
 
 
 	list_dirs.clear();
 	list_dirs.clear();

+ 1 - 0
core/io/file_access_pack.h

@@ -208,6 +208,7 @@ public:
 	virtual bool list_dir_begin();
 	virtual bool list_dir_begin();
 	virtual String get_next();
 	virtual String get_next();
 	virtual bool current_is_dir() const;
 	virtual bool current_is_dir() const;
+	virtual bool current_is_hidden() const;
 	virtual void list_dir_end();
 	virtual void list_dir_end();
 
 
 	virtual int get_drive_count();
 	virtual int get_drive_count();

+ 10 - 0
core/io/resource_format_binary.cpp

@@ -1778,6 +1778,11 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
 	f->store_32(VERSION_MINOR);
 	f->store_32(VERSION_MINOR);
 	f->store_32(FORMAT_VERSION);
 	f->store_32(FORMAT_VERSION);
 
 
+	if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
+		f->close();
+		return ERR_CANT_CREATE;
+	}
+
 	//f->store_32(saved_resources.size()+external_resources.size()); // load steps -not needed
 	//f->store_32(saved_resources.size()+external_resources.size()); // load steps -not needed
 	save_unicode_string(p_resource->get_type());
 	save_unicode_string(p_resource->get_type());
 	uint64_t md_at = f->get_pos();
 	uint64_t md_at = f->get_pos();
@@ -1910,6 +1915,11 @@ Error ResourceFormatSaverBinaryInstance::save(const String &p_path,const RES& p_
 
 
 	f->store_buffer((const uint8_t*)"RSRC",4); //magic at end
 	f->store_buffer((const uint8_t*)"RSRC",4); //magic at end
 
 
+	if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
+		f->close();
+		return ERR_CANT_CREATE;
+	}
+
 	f->close();
 	f->close();
 
 
 
 

+ 5 - 0
core/io/resource_format_xml.cpp

@@ -2592,6 +2592,11 @@ Error ResourceFormatSaverXMLInstance::save(const String &p_path,const RES& p_res
 	}
 	}
 
 
 	exit_tag("resource_file");
 	exit_tag("resource_file");
+	if (f->get_error()!=OK && f->get_error()!=ERR_FILE_EOF) {
+		f->close();
+		return ERR_CANT_CREATE;
+	}
+
 	f->close();
 	f->close();
 	//memdelete(f);
 	//memdelete(f);
 
 

+ 18 - 1
core/math/camera_matrix.cpp

@@ -121,7 +121,7 @@ void CameraMatrix::set_orthogonal(float p_size, float p_aspect, float p_znear, f
 
 
 
 
 void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, float p_top, float p_near, float p_far) {
 void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, float p_top, float p_near, float p_far) {
-
+#if 0
 	///@TODO, give a check to this. I'm not sure if it's working.
 	///@TODO, give a check to this. I'm not sure if it's working.
 	set_identity();
 	set_identity();
 
 
@@ -133,10 +133,27 @@ void CameraMatrix::set_frustum(float p_left, float p_right, float p_bottom, floa
 	matrix[2][3]=-(2*p_far*p_near) / (p_far-p_near);
 	matrix[2][3]=-(2*p_far*p_near) / (p_far-p_near);
 	matrix[3][2]=-1;
 	matrix[3][2]=-1;
 	matrix[3][3]=0;
 	matrix[3][3]=0;
+#else
+	float *te = &matrix[0][0];
+	float x = 2 * p_near / ( p_right - p_left );
+	float y = 2 * p_near / ( p_top - p_bottom );
+
+	float a = ( p_right + p_left ) / ( p_right - p_left );
+	float b = ( p_top + p_bottom ) / ( p_top - p_bottom );
+	float c = - ( p_far + p_near ) / ( p_far - p_near );
+	float d = - 2 * p_far * p_near / ( p_far - p_near );
+
+	te[0] = x;	te[4] = 0;	te[8] = a;	te[12] = 0;
+	te[1] = 0;	te[5] = y;	te[9] = b;	te[13] = 0;
+	te[2] = 0;	te[6] = 0;	te[10] = c;	te[14] = d;
+	te[3] = 0;	te[7] = 0;	te[11] = - 1;	te[15] = 0;
+
+#endif
 
 
 }
 }
 
 
 
 
+
 float CameraMatrix::get_z_far() const {
 float CameraMatrix::get_z_far() const {
 	
 	
 	const float * matrix = (const float*)this->matrix;			
 	const float * matrix = (const float*)this->matrix;			

+ 2 - 2
core/math/geometry.h

@@ -519,9 +519,9 @@ public:
 
 
 	    bool s_ab = (b.x-a.x)*as_y-(b.y-a.y)*as_x > 0;
 	    bool s_ab = (b.x-a.x)*as_y-(b.y-a.y)*as_x > 0;
 
 
-	    if((c.x-a.x)*as_y-(c.y-a.y)*as_x > 0 == s_ab) return false;
+	    if(((c.x-a.x)*as_y-(c.y-a.y)*as_x > 0) == s_ab) return false;
 
 
-	    if((c.x-b.x)*(s.y-b.y)-(c.y-b.y)*(s.x-b.x) > 0 != s_ab) return false;
+	    if(((c.x-b.x)*(s.y-b.y)-(c.y-b.y)*(s.x-b.x) > 0) != s_ab) return false;
 
 
 	    return true;
 	    return true;
 	}
 	}

+ 8 - 0
core/object.cpp

@@ -1033,6 +1033,13 @@ void Object::add_user_signal(const MethodInfo& p_signal) {
 	signal_map[p_signal.name]=s;
 	signal_map[p_signal.name]=s;
 }
 }
 
 
+bool Object::_has_user_signal(const StringName& p_name) const {
+
+	if (!signal_map.has(p_name))
+		return false;
+	return signal_map[p_name].user.name.length()>0;
+}
+
 struct _ObjectSignalDisconnectData {
 struct _ObjectSignalDisconnectData {
 
 
 	StringName signal;
 	StringName signal;
@@ -1431,6 +1438,7 @@ void Object::_bind_methods() {
 //	ObjectTypeDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()));
 //	ObjectTypeDB::bind_method(_MD("call_deferred","method","arg1","arg2","arg3","arg4"),&Object::_call_deferred_bind,DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()),DEFVAL(Variant()));
 
 
 	ObjectTypeDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array()));
 	ObjectTypeDB::bind_method(_MD("add_user_signal","signal","arguments"),&Object::_add_user_signal,DEFVAL(Array()));
+	ObjectTypeDB::bind_method(_MD("has_user_signal","signal"),&Object::_has_user_signal);
 //	ObjectTypeDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array()));
 //	ObjectTypeDB::bind_method(_MD("emit_signal","signal","arguments"),&Object::_emit_signal,DEFVAL(Array()));
 
 
 
 

+ 1 - 0
core/object.h

@@ -386,6 +386,7 @@ friend void postinitialize_handler(Object*);
 	Dictionary metadata;
 	Dictionary metadata;
 
 
 	void _add_user_signal(const String& p_name, const Array& p_pargs=Array());
 	void _add_user_signal(const String& p_name, const Array& p_pargs=Array());
+	bool _has_user_signal(const StringName& p_name) const;
 	Variant _emit_signal(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
 	Variant _emit_signal(const Variant** p_args, int p_argcount, Variant::CallError& r_error);
 	Array _get_signal_list() const;
 	Array _get_signal_list() const;
 	Array _get_signal_connection_list(const String& p_signal) const;
 	Array _get_signal_connection_list(const String& p_signal) const;

+ 1 - 0
core/os/dir_access.h

@@ -78,6 +78,7 @@ public:
 	virtual String get_next(bool* p_is_dir); // compatibility
 	virtual String get_next(bool* p_is_dir); // compatibility
 	virtual String get_next()=0;
 	virtual String get_next()=0;
 	virtual bool current_is_dir() const=0;
 	virtual bool current_is_dir() const=0;
+	virtual bool current_is_hidden() const=0;
 	
 	
 	virtual void list_dir_end()=0; ///< 
 	virtual void list_dir_end()=0; ///< 
 	
 	

+ 22 - 2
core/os/os.h

@@ -73,7 +73,7 @@ public:
 		bool fullscreen;
 		bool fullscreen;
 		bool resizable;
 		bool resizable;
 		float get_aspect() const { return (float)width/(float)height; }
 		float get_aspect() const { return (float)width/(float)height; }
-		VideoMode(int p_width=640,int p_height=480,bool p_fullscreen=false, bool p_resizable = true) { width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
+		VideoMode(int p_width=640,int p_height=480,bool p_fullscreen=false, bool p_resizable = true) {width=p_width; height=p_height; fullscreen=p_fullscreen; resizable = p_resizable; }
 	};
 	};
 protected:
 protected:
 friend class Main;
 friend class Main;
@@ -149,7 +149,27 @@ public:
 	virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0)=0;
 	virtual void set_video_mode(const VideoMode& p_video_mode,int p_screen=0)=0;
 	virtual VideoMode get_video_mode(int p_screen=0) const=0;
 	virtual VideoMode get_video_mode(int p_screen=0) const=0;
 	virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const=0;
 	virtual void get_fullscreen_mode_list(List<VideoMode> *p_list,int p_screen=0) const=0;
-	
+
+#ifdef NEW_WM_API
+	virtual int get_screen_count() const=0;
+	virtual int get_screen() const=0;
+	virtual void set_screen(int p_screen)=0;
+	virtual Point2 get_screen_position(int p_screen=0) const=0;
+	virtual Size2 get_screen_size(int p_screen=0) const=0;
+	virtual Point2 get_window_position() const=0;
+	virtual void set_window_position(const Point2& p_position)=0;
+	virtual Size2 get_window_size() const=0;
+	virtual void set_window_size(const Size2 p_size)=0;
+	virtual void set_fullscreen(bool p_enabled)=0;
+	virtual bool is_fullscreen() const=0;
+	virtual void set_resizable(bool p_enabled)=0;
+	virtual bool is_resizable() const=0;
+	virtual void set_minimized(bool p_enabled)=0;
+	virtual bool is_minimized() const=0;
+	virtual void set_maximized(bool p_enabled)=0;
+	virtual bool is_maximized() const=0;
+#endif	
+
 	virtual void set_iterations_per_second(int p_ips);
 	virtual void set_iterations_per_second(int p_ips);
 	virtual int get_iterations_per_second() const;
 	virtual int get_iterations_per_second() const;
 
 

+ 44 - 35
core/ustring.cpp

@@ -482,7 +482,7 @@ void String::erase(int p_pos, int p_chars) {
 
 
 String String::capitalize() const {
 String String::capitalize() const {
 
 
-	String aux=this->replace("_"," ").to_lower();
+	String aux=this->camelcase_to_underscore().replace("_"," ").to_lower();
 	String cap;
 	String cap;
 	for (int i=0;i<aux.get_slice_count(" ");i++) {
 	for (int i=0;i<aux.get_slice_count(" ");i++) {
 		
 		
@@ -498,6 +498,29 @@ String String::capitalize() const {
 	
 	
 	return cap;
 	return cap;
 }
 }
+
+
+String String::camelcase_to_underscore() const {
+	const CharType * cstr = c_str();
+	String newString;
+	const char A = 'A', Z = 'Z';
+	int startIndex = 0;
+
+	for ( int i = 1; i < this->size()-1; i++ ) {
+		bool isCapital = cstr[i] >= A && cstr[i] <= Z;
+
+		if ( isCapital ) {
+			newString += "_" + this->substr(startIndex, i-startIndex);
+			startIndex = i;
+		}
+	}
+
+	newString += "_" + this->substr(startIndex, this->size()-startIndex);
+
+	return newString;
+}
+
+
 int String::get_slice_count(String p_splitter) const{
 int String::get_slice_count(String p_splitter) const{
 
 
 	if (empty())
 	if (empty())
@@ -3550,8 +3573,8 @@ String String::lpad(int min_length, const String& character) const {
 // sprintf is implemented in GDScript via:
 // sprintf is implemented in GDScript via:
 //   "fish %s pie" % "frog"
 //   "fish %s pie" % "frog"
 //   "fish %s %d pie" % ["frog", 12]
 //   "fish %s %d pie" % ["frog", 12]
-String String::sprintf(const Array& values) const {
-
+// In case of an error, the string returned is the error description and "error" is true.
+String String::sprintf(const Array& values, bool* error) const {
 	String formatted;
 	String formatted;
 	CharType* self = (CharType*)c_str();
 	CharType* self = (CharType*)c_str();
 	int num_items = values.size();
 	int num_items = values.size();
@@ -3564,6 +3587,7 @@ String String::sprintf(const Array& values) const {
 	bool left_justified;
 	bool left_justified;
 	bool show_sign;
 	bool show_sign;
 
 
+	*error = true;
 
 
 	for (; *self; self++) {
 	for (; *self; self++) {
 		const CharType c = *self;
 		const CharType c = *self;
@@ -3580,13 +3604,11 @@ String String::sprintf(const Array& values) const {
 				case 'x': // Hexadecimal (lowercase)
 				case 'x': // Hexadecimal (lowercase)
 				case 'X': { // Hexadecimal (uppercase)
 				case 'X': { // Hexadecimal (uppercase)
 					if (value_index >= values.size()) {
 					if (value_index >= values.size()) {
-						ERR_EXPLAIN("not enough arguments for format string");
-						ERR_FAIL_V("");
+						return "not enough arguments for format string";
 					}
 					}
 
 
 					if (!values[value_index].is_num()) {
 					if (!values[value_index].is_num()) {
-						ERR_EXPLAIN("a number is required");
-						ERR_FAIL_V("");
+						return "a number is required";
 					}
 					}
 					
 					
 					int64_t value = values[value_index];
 					int64_t value = values[value_index];
@@ -3622,13 +3644,11 @@ String String::sprintf(const Array& values) const {
 				}
 				}
 				case 'f': { // Float
 				case 'f': { // Float
 					if (value_index >= values.size()) {
 					if (value_index >= values.size()) {
-						ERR_EXPLAIN("not enough arguments for format string");
-						ERR_FAIL_V("");
+						return "not enough arguments for format string";
 					}
 					}
 
 
 					if (!values[value_index].is_num()) {
 					if (!values[value_index].is_num()) {
-						ERR_EXPLAIN("a number is required");
-						ERR_FAIL_V("");
+						return "a number is required";
 					}
 					}
 
 
 					double value = values[value_index];
 					double value = values[value_index];
@@ -3657,8 +3677,7 @@ String String::sprintf(const Array& values) const {
 				}
 				}
 				case 's': { // String
 				case 's': { // String
 					if (value_index >= values.size()) {
 					if (value_index >= values.size()) {
-						ERR_EXPLAIN("not enough arguments for format string");
-						ERR_FAIL_V("");
+						return "not enough arguments for format string";
 					}
 					}
 
 
 					String str = values[value_index];
 					String str = values[value_index];
@@ -3676,8 +3695,7 @@ String String::sprintf(const Array& values) const {
 				}
 				}
 				case 'c': {
 				case 'c': {
 					if (value_index >= values.size()) {
 					if (value_index >= values.size()) {
-						ERR_EXPLAIN("not enough arguments for format string");
-						ERR_FAIL_V("");
+						return "not enough arguments for format string";
 					}
 					}
 
 
 					// Convert to character.
 					// Convert to character.
@@ -3685,22 +3703,18 @@ String String::sprintf(const Array& values) const {
 					if (values[value_index].is_num()) {
 					if (values[value_index].is_num()) {
 						int value = values[value_index];
 						int value = values[value_index];
 						if (value < 0) {
 						if (value < 0) {
-							ERR_EXPLAIN("unsigned byte integer is lower than maximum")
-							ERR_FAIL_V("");
+							return "unsigned byte integer is lower than maximum";
 						} else if (value > 255) {
 						} else if (value > 255) {
-							ERR_EXPLAIN("unsigned byte integer is greater than maximum")
-							ERR_FAIL_V("");
+							return "unsigned byte integer is greater than maximum";
 						}
 						}
 						str = chr(values[value_index]);
 						str = chr(values[value_index]);
 					} else if (values[value_index].get_type() == Variant::STRING) {
 					} else if (values[value_index].get_type() == Variant::STRING) {
 						str = values[value_index];
 						str = values[value_index];
 						if (str.length() != 1) {
 						if (str.length() != 1) {
-							ERR_EXPLAIN("%c requires number or single-character string");
-							ERR_FAIL_V("");
+							return "%c requires number or single-character string";
 						}
 						}
 					} else {
 					} else {
-						ERR_EXPLAIN("%c requires number or single-character string");
-						ERR_FAIL_V("");
+						return "%c requires number or single-character string";
 					}
 					}
 
 
 					// Padding.
 					// Padding.
@@ -3741,8 +3755,7 @@ String String::sprintf(const Array& values) const {
 				}
 				}
 				case '.': { // Float separtor.
 				case '.': { // Float separtor.
 					if (in_decimals) {
 					if (in_decimals) {
-						ERR_EXPLAIN("too many decimal points in format");
-						ERR_FAIL_V("");
+						return "too many decimal points in format";
 					}
 					}
 					in_decimals = true;
 					in_decimals = true;
 					min_decimals = 0; // We want to add the value manually.
 					min_decimals = 0; // We want to add the value manually.
@@ -3751,13 +3764,11 @@ String String::sprintf(const Array& values) const {
 
 
 				case '*': { // Dyanmic width, based on value.
 				case '*': { // Dyanmic width, based on value.
 					if (value_index >= values.size()) {
 					if (value_index >= values.size()) {
-						ERR_EXPLAIN("not enough arguments for format string");
-						ERR_FAIL_V("");
+						return "not enough arguments for format string";
 					}
 					}
 
 
 					if (!values[value_index].is_num()) {
 					if (!values[value_index].is_num()) {
-						ERR_EXPLAIN("* wants number");
-						ERR_FAIL_V("");
+						return "* wants number";
 					}
 					}
 
 
 					int size = values[value_index];
 					int size = values[value_index];
@@ -3773,8 +3784,7 @@ String String::sprintf(const Array& values) const {
 				}
 				}
 
 
 				default: {
 				default: {
-					ERR_EXPLAIN("unsupported format character");
-  					ERR_FAIL_V("");
+					return "unsupported format character";
   				}
   				}
 			}
 			}
 		} else { // Not in format string.
 		} else { // Not in format string.
@@ -3796,14 +3806,13 @@ String String::sprintf(const Array& values) const {
 	}
 	}
 
 
 	if (in_format) {
 	if (in_format) {
-		ERR_EXPLAIN("incomplete format");
-  		ERR_FAIL_V("");
+		return "incomplete format";
 	}
 	}
 
 
 	if (value_index != values.size()) {
 	if (value_index != values.size()) {
-		ERR_EXPLAIN("not all arguments converted during string formatting");
-  		ERR_FAIL_V("");
+		return "not all arguments converted during string formatting";
 	}
 	}
 
 
+	*error = false;
 	return formatted;
 	return formatted;
 }
 }

+ 2 - 3
core/ustring.h

@@ -130,7 +130,7 @@ public:
 	String pad_zeros(int p_digits) const;
 	String pad_zeros(int p_digits) const;
 	String lpad(int min_length,const String& character=" ") const;
 	String lpad(int min_length,const String& character=" ") const;
 	String rpad(int min_length,const String& character=" ") const;
 	String rpad(int min_length,const String& character=" ") const;
-	String sprintf(const Array& values) const;
+	String sprintf(const Array& values, bool* error) const;
 	static String num(double p_num,int p_decimals=-1);
 	static String num(double p_num,int p_decimals=-1);
 	static String num_scientific(double p_num);
 	static String num_scientific(double p_num);
 	static String num_real(double p_num);
 	static String num_real(double p_num);
@@ -149,6 +149,7 @@ public:
 	static double to_double(const CharType* p_str, const CharType **r_end=NULL);
 	static double to_double(const CharType* p_str, const CharType **r_end=NULL);
 	static int64_t to_int(const CharType* p_str,int p_len=-1);
 	static int64_t to_int(const CharType* p_str,int p_len=-1);
 	String capitalize() const;
 	String capitalize() const;
+	String camelcase_to_underscore() const;
 
 
 	int get_slice_count(String p_splitter) const;
 	int get_slice_count(String p_splitter) const;
 	String get_slice(String p_splitter,int p_slice) const;
 	String get_slice(String p_splitter,int p_slice) const;
@@ -225,8 +226,6 @@ public:
 	String(const char *p_str);
 	String(const char *p_str);
 	String(const CharType *p_str,int p_clip_to_len=-1);
 	String(const CharType *p_str,int p_clip_to_len=-1);
 	String(const StrRange& p_range);
 	String(const StrRange& p_range);
-
-
 };
 };
 
 
 
 

+ 5 - 5
core/variant_call.cpp

@@ -511,7 +511,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_LOCALMEM1(ColorArray,append_array);
 	VCALL_LOCALMEM1(ColorArray,append_array);
 
 
 #define VCALL_PTR0(m_type,m_method)\
 #define VCALL_PTR0(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
 #define VCALL_PTR0R(m_type,m_method)\
 #define VCALL_PTR0R(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(); }
 #define VCALL_PTR1(m_type,m_method)\
 #define VCALL_PTR1(m_type,m_method)\
@@ -519,7 +519,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 #define VCALL_PTR1R(m_type,m_method)\
 #define VCALL_PTR1R(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0]); }
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0]); }
 #define VCALL_PTR2(m_type,m_method)\
 #define VCALL_PTR2(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
 #define VCALL_PTR2R(m_type,m_method)\
 #define VCALL_PTR2R(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1]); }
 #define VCALL_PTR3(m_type,m_method)\
 #define VCALL_PTR3(m_type,m_method)\
@@ -531,7 +531,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 #define VCALL_PTR4R(m_type,m_method)\
 #define VCALL_PTR4R(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3]); }
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3]); }
 #define VCALL_PTR5(m_type,m_method)\
 #define VCALL_PTR5(m_type,m_method)\
-static void _call_##m_type##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
+static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
 #define VCALL_PTR5R(m_type,m_method)\
 #define VCALL_PTR5R(m_type,m_method)\
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
 static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Variant** p_args) { r_ret=reinterpret_cast<m_type*>(p_self._data._ptr)->m_method(*p_args[0],*p_args[1],*p_args[2],*p_args[3],*p_args[4]); }
 
 
@@ -685,7 +685,7 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
 	VCALL_PTR0R( InputEvent, is_pressed );
 	VCALL_PTR0R( InputEvent, is_pressed );
 	VCALL_PTR1R( InputEvent, is_action );
 	VCALL_PTR1R( InputEvent, is_action );
 	VCALL_PTR0R( InputEvent, is_echo );
 	VCALL_PTR0R( InputEvent, is_echo );
-	//VCALL_PTR2( InputEvent, set_as_action );
+    VCALL_PTR2( InputEvent, set_as_action );
 
 
 	struct ConstructData {
 	struct ConstructData {
 
 
@@ -1496,7 +1496,7 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
 	ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
 	ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_pressed,varray());
 	ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
 	ADDFUNC1(INPUT_EVENT,BOOL,InputEvent,is_action,STRING,"action",varray());
 	ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
 	ADDFUNC0(INPUT_EVENT,BOOL,InputEvent,is_echo,varray());
-	//ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
+    ADDFUNC2(INPUT_EVENT,NIL,InputEvent,set_as_action,STRING,"action",BOOL,"pressed",varray());
 
 
 	/* REGISTER CONSTRUCTORS */
 	/* REGISTER CONSTRUCTORS */
 
 

+ 13 - 6
core/variant_op.cpp

@@ -552,6 +552,9 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
 					if (p_b.type==MATRIX32) {
 					if (p_b.type==MATRIX32) {
 						_RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 );
 						_RETURN( *p_a._data._matrix32 * *p_b._data._matrix32 );
 					};
 					};
+					if (p_b.type==VECTOR2) {
+						_RETURN( p_a._data._matrix32->xform( *(const Vector2*)p_b._data._mem) );
+					};
 					r_valid=false;
 					r_valid=false;
 					return;
 					return;
 				} break;
 				} break;
@@ -738,18 +741,22 @@ void Variant::evaluate(const Operator& p_op, const Variant& p_a, const Variant&
 				_RETURN( p_a._data._int % p_b._data._int );
 				_RETURN( p_a._data._int % p_b._data._int );
 				
 				
 			} else if (p_a.type==STRING) {
 			} else if (p_a.type==STRING) {
-				const String *str=reinterpret_cast<const String*>(p_a._data._mem);
+				const String* format=reinterpret_cast<const String*>(p_a._data._mem);
 
 
+				String result;
+				bool error;
 				if (p_b.type==ARRAY) {
 				if (p_b.type==ARRAY) {
 					// e.g. "frog %s %d" % ["fish", 12]
 					// e.g. "frog %s %d" % ["fish", 12]
-					const Array *arr=reinterpret_cast<const Array*>(p_b._data._mem);
-					_RETURN(str->sprintf(*arr));
+					const Array* args=reinterpret_cast<const Array*>(p_b._data._mem);
+					result=format->sprintf(*args, &error);
 				} else {
 				} else {
 					// e.g. "frog %d" % 12
 					// e.g. "frog %d" % 12
-					Array arr;
-					arr.push_back(p_b);
-					_RETURN(str->sprintf(arr));
+					Array args;
+					args.push_back(p_b);
+					result=format->sprintf(args, &error);
 				}
 				}
+				r_valid = !error;
+				_RETURN(result);
 			}
 			}
 
 
 			r_valid=false;
 			r_valid=false;

BIN
demos/2d/area_input/box_area.png


BIN
demos/2d/area_input/circle_area.png


+ 4 - 0
demos/2d/area_input/engine.cfg

@@ -0,0 +1,4 @@
+[application]
+
+name="Area 2D Input Events"
+main_scene="res://input.scn"

+ 16 - 0
demos/2d/area_input/input.gd

@@ -0,0 +1,16 @@
+
+extends Area2D
+
+#virtual from CollisionObject2D (also available as signal)
+func _input_event(viewport, event, shape_idx):
+	#convert event to local coordinates
+	if (event.type==InputEvent.MOUSE_MOTION):
+		event = make_input_local( event )
+		get_node("label").set_text(str(event.pos))
+		
+#virtual from CollisionObject2D (also available as signal)
+func _mouse_exit():
+		get_node("label").set_text("")
+		
+
+

BIN
demos/2d/area_input/input.scn


+ 11 - 0
demos/2d/fog_of_war/.fscache

@@ -0,0 +1,11 @@
+::res://::1422910453
+floor.png::ImageTexture::1422910453::
+fog.gd::GDScript::1422910025::
+fog.png::ImageTexture::1422908128::
+fog.scn::PackedScene::1422909435::
+fog.xml::TileSet::1422909324::
+icon.png::ImageTexture::1422811193::
+tile_edit.scn::PackedScene::1422909313::
+troll.gd::GDScript::1422909940::
+troll.png::ImageTexture::1418669358::
+troll.scn::PackedScene::1418669358::

+ 12 - 0
demos/2d/fog_of_war/engine.cfg

@@ -0,0 +1,12 @@
+[application]
+
+name="Fog of War"
+main_scene="res://fog.scn"
+icon="icon.png"
+
+[input]
+
+move_up=[key(Up)]
+move_bottom=[key(Down)]
+move_left=[key(Left)]
+move_right=[key(Right)]

BIN
demos/2d/fog_of_war/floor.png


+ 86 - 0
demos/2d/fog_of_war/fog.gd

@@ -0,0 +1,86 @@
+
+extends TileMap
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+# boundarys for the fog rectangle
+var x_min = -20 # left start tile
+var x_max = 20 # right end tile
+var y_min = -20 # top start tile
+var y_max = 20 # bottom end tile
+
+var position # players position
+
+# iteration variables
+var x
+var y
+
+# variable to check if player moved
+var x_old
+var y_old
+
+# array to build up the visible area like a square
+# first value determines the width/height of the tip
+# here it would be 2*2 + 1 = 5 tiles wide/high
+# second value determines the total squares size
+# here it would be 5*2 + 1 = 10 tiles wide/high
+var l = range(2,5)
+
+# process that runs in realtime
+func _fixed_process(delta):
+	position = get_node("../troll").get_pos()
+	
+	# calculate the corresponding tile
+	# from the players position
+	x = int(position.x/get_cell_size().x)
+	# switching from positive to negative tile positions
+	# causes problems because of rounding problems
+	if position.x < 0:
+		x -= 1 # correct negative values
+	
+	y = int(position.y/get_cell_size().y)
+	if position.y < 0:
+		y -= 1
+		
+	# check if the player moved one tile further
+	if (x_old != x) or (y_old != y):
+		
+		# create the transparent part (visited area)
+		var end = l.size()-1
+		var start = 0
+		for steps in range(l.size()):
+			for m in range(x-l[end]-1,x+l[end]+2):
+				for n in range(y-l[start]-1,y+l[start]+2):
+					if get_cell(m,n) != 0:
+						set_cell(m,n,1,0,0)
+			end -= 1
+			start += 1
+	
+		# create the actual and active visible part
+		var end = l.size()-1
+		var start = 0
+		for steps in range(l.size()):
+			for m in range(x-l[end],x+l[end]+1):
+				for n in range(y-l[start],y+l[start]+1):
+					set_cell(m,n,-1)
+			end -= 1
+			start += 1
+		
+	x_old = x
+	y_old = y
+	
+	pass
+
+func _ready():
+	# Initalization here
+	
+	# create a square filled with the 100% opaque fog
+	for x in range(x_min,x_max):
+		for y in range(y_min,y_max):
+			set_cell(x,y,0,0,0)
+	set_fixed_process(true)
+	pass
+
+

BIN
demos/2d/fog_of_war/fog.png


BIN
demos/2d/fog_of_war/fog.scn


+ 29 - 0
demos/2d/fog_of_war/fog.xml

@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<resource_file type="TileSet" subresource_count="3" version="1.0" version_name="Godot Engine v1.0.stable.custom_build">
+	<ext_resource path="res://floor.png" type="Texture"></ext_resource>
+	<ext_resource path="res://fog.png" type="Texture"></ext_resource>
+	<main_resource>
+		<string name="0/name"> "fog opaque" </string>
+		<resource name="0/texture" resource_type="Texture" path="res://fog.png">  </resource>
+		<vector2 name="0/tex_offset"> -48, -48 </vector2>
+		<vector2 name="0/shape_offset"> 0, 0 </vector2>
+		<rect2 name="0/region"> 0, 0, 144, 144 </rect2>
+		<array name="0/shapes" len="0" shared="false">
+		</array>
+		<string name="1/name"> "fog transparent" </string>
+		<resource name="1/texture" resource_type="Texture" path="res://fog.png">  </resource>
+		<vector2 name="1/tex_offset"> -48, -48 </vector2>
+		<vector2 name="1/shape_offset"> 0, 0 </vector2>
+		<rect2 name="1/region"> 144, 0, 144, 144 </rect2>
+		<array name="1/shapes" len="0" shared="false">
+		</array>
+		<string name="2/name"> "floor" </string>
+		<resource name="2/texture" resource_type="Texture" path="res://floor.png">  </resource>
+		<vector2 name="2/tex_offset"> 0, 0 </vector2>
+		<vector2 name="2/shape_offset"> 0, 0 </vector2>
+		<rect2 name="2/region"> 0, 0, 0, 0 </rect2>
+		<array name="2/shapes" len="0" shared="false">
+		</array>
+
+	</main_resource>
+</resource_file>

BIN
demos/2d/fog_of_war/icon.png


+ 1 - 0
demos/2d/fog_of_war/icon.png.flags

@@ -0,0 +1 @@
+gen_mipmaps=true

BIN
demos/2d/fog_of_war/tile_edit.scn


+ 43 - 0
demos/2d/fog_of_war/troll.gd

@@ -0,0 +1,43 @@
+
+extends KinematicBody2D
+
+# This is a simple collision demo showing how
+# the kinematic cotroller works.
+# move() will allow to move the node, and will
+# always move it to a non-colliding spot, 
+# as long as it starts from a non-colliding spot too.
+
+
+#pixels / second
+const MOTION_SPEED=160
+
+func _fixed_process(delta):
+
+	var motion = Vector2()
+	
+	if (Input.is_action_pressed("move_up")):
+		motion+=Vector2(0,-1)
+	if (Input.is_action_pressed("move_bottom")):
+		motion+=Vector2(0,1)
+	if (Input.is_action_pressed("move_left")):
+		motion+=Vector2(-1,0)
+	if (Input.is_action_pressed("move_right")):
+		motion+=Vector2(1,0)
+	
+	motion = motion.normalized() * MOTION_SPEED * delta
+	motion = move(motion)
+	
+	#make character slide nicely through the world	
+	var slide_attempts = 4
+	while(is_colliding() and slide_attempts>0):
+		motion = get_collision_normal().slide(motion)
+		motion=move(motion)
+		slide_attempts-=1
+	
+
+func _ready():
+	# Initalization here
+	set_fixed_process(true)
+	pass
+
+

BIN
demos/2d/fog_of_war/troll.png


BIN
demos/2d/fog_of_war/troll.scn


+ 26 - 0
demos/2d/hdr/beach_cave.gd

@@ -0,0 +1,26 @@
+
+extends Node2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+const CAVE_LIMIT=1000
+
+func _input(ev):
+	if (ev.type==InputEvent.MOUSE_MOTION and ev.button_mask&1):
+		var rel_x = ev.relative_x
+		var cavepos = get_node("cave").get_pos()
+		cavepos.x+=rel_x
+		if (cavepos.x<-CAVE_LIMIT):
+			cavepos.x=-CAVE_LIMIT
+		elif (cavepos.x>0):
+			cavepos.x=0
+		get_node("cave").set_pos(cavepos)
+			
+
+func _ready():
+	set_process_input(true)
+	# Initialization here
+	pass
+
+

BIN
demos/2d/hdr/beach_cave.scn


+ 13 - 0
demos/2d/hdr/engine.cfg

@@ -0,0 +1,13 @@
+[application]
+
+name="HDR for 2D"
+main_scene="res://beach_cave.scn"
+
+[display]
+
+width=1080
+height=720
+
+[rasterizer]
+
+blur_buffer_size=128

BIN
demos/2d/hdr/ocean_beach.png


+ 1 - 0
demos/2d/hdr/ocean_beach.png.flags

@@ -0,0 +1 @@
+tolinear=true

BIN
demos/2d/hdr/ocean_cave.png


+ 1 - 0
demos/2d/hdr/ocean_cave.png.flags

@@ -0,0 +1 @@
+tolinear=true

BIN
demos/2d/isometric/dungeon.scn


BIN
demos/2d/isometric_light/character_shder.res


BIN
demos/2d/isometric_light/column.scn


+ 96 - 0
demos/2d/isometric_light/cubio.gd

@@ -0,0 +1,96 @@
+
+extends KinematicBody2D
+
+# member variables here, example:
+# var a=2
+# var b="textvar"
+
+const MAX_SPEED = 300.0
+const IDLE_SPEED = 10.0
+const ACCEL=5.0
+const VSCALE=0.5
+const SHOOT_INTERVAL=0.3
+
+var speed=Vector2()
+var current_anim=""
+var current_mirror=false
+
+var shoot_countdown=0
+
+func _input(ev):
+	if (ev.type==InputEvent.MOUSE_BUTTON and ev.button_index==1 and ev.pressed and shoot_countdown<=0):
+		var pos = get_canvas_transform().affine_inverse() * ev.pos
+		var dir = (pos-get_global_pos()).normalized()
+		var bullet = preload("res://shoot.scn").instance()
+		bullet.advance_dir=dir
+		bullet.set_pos( get_global_pos() + dir * 60 )
+		get_parent().add_child(bullet)
+		shoot_countdown=SHOOT_INTERVAL
+		
+		
+		
+
+func _fixed_process(delta):
+	
+	shoot_countdown-=delta
+	var dir = Vector2()
+	if (Input.is_action_pressed("up")):
+		dir+=Vector2(0,-1)
+	if (Input.is_action_pressed("down")):
+		dir+=Vector2(0,1)
+	if (Input.is_action_pressed("left")):
+		dir+=Vector2(-1,0)
+	if (Input.is_action_pressed("right")):
+		dir+=Vector2(1,0)
+		
+	if (dir!=Vector2()):
+		dir=dir.normalized()
+	speed = speed.linear_interpolate(dir*MAX_SPEED,delta*ACCEL)
+	var motion = speed * delta
+	motion.y*=VSCALE
+	motion=move(motion)
+	
+	if (is_colliding()):
+		var n = get_collision_normal()
+		motion=n.slide(motion)
+		move(motion)
+
+	var next_anim=""
+	var next_mirror=false
+	
+	if (dir==Vector2() and speed.length()<IDLE_SPEED):
+		next_anim="idle"
+		next_mirror=false
+	elif (speed.length()>IDLE_SPEED*0.1):
+		var angle = atan2(abs(speed.x),speed.y)	
+		
+		next_mirror = speed.x>0
+		if (angle<PI/8):
+			next_anim="bottom"
+			next_mirror=false
+		elif (angle<PI/4+PI/8):
+			next_anim="bottom_left"
+		elif (angle<PI*2/4+PI/8):
+			next_anim="left"
+		elif (angle<PI*3/4+PI/8):
+			next_anim="top_left"
+		else:
+			next_anim="top"
+			next_mirror=false
+		
+			
+	if (next_anim!=current_anim or next_mirror!=current_mirror):
+		get_node("frames").set_flip_h(next_mirror)
+		get_node("anim").play(next_anim)
+		current_anim=next_anim
+		current_mirror=next_mirror
+		
+
+
+func _ready():
+	# Initialization here
+	set_fixed_process(true)
+	set_process_input(true)
+	pass
+
+

BIN
demos/2d/isometric_light/cubio.scn


BIN
demos/2d/isometric_light/cubio/idle0001.png


BIN
demos/2d/isometric_light/cubio/idle0002.png


BIN
demos/2d/isometric_light/cubio/idle0003.png


BIN
demos/2d/isometric_light/cubio/idle0004.png


BIN
demos/2d/isometric_light/cubio/idle0005.png


BIN
demos/2d/isometric_light/cubio/idle0006.png


BIN
demos/2d/isometric_light/cubio/idle0007.png


BIN
demos/2d/isometric_light/cubio/idle0008.png


BIN
demos/2d/isometric_light/cubio/idle0009.png


BIN
demos/2d/isometric_light/cubio/idle0010.png


BIN
demos/2d/isometric_light/cubio/idle0011.png


BIN
demos/2d/isometric_light/cubio/idle0012.png


BIN
demos/2d/isometric_light/cubio/idle0013.png


BIN
demos/2d/isometric_light/cubio/idle0014.png


BIN
demos/2d/isometric_light/cubio/idle0015.png


BIN
demos/2d/isometric_light/cubio/idle0016.png


BIN
demos/2d/isometric_light/cubio/idle0017.png


BIN
demos/2d/isometric_light/cubio/idle0018.png


BIN
demos/2d/isometric_light/cubio/idle0019.png


BIN
demos/2d/isometric_light/cubio/idle0020.png


BIN
demos/2d/isometric_light/cubio/idle0021.png


BIN
demos/2d/isometric_light/cubio/idle0022.png


BIN
demos/2d/isometric_light/cubio/idle0023.png


BIN
demos/2d/isometric_light/cubio/idle0024.png


BIN
demos/2d/isometric_light/cubio/idle0025.png


BIN
demos/2d/isometric_light/cubio/idle0026.png


BIN
demos/2d/isometric_light/cubio/idle0027.png


BIN
demos/2d/isometric_light/cubio/idle0028.png


BIN
demos/2d/isometric_light/cubio/idle0029.png


BIN
demos/2d/isometric_light/cubio/idle0030.png


BIN
demos/2d/isometric_light/cubio/idle0031.png


BIN
demos/2d/isometric_light/cubio/idle0032.png


BIN
demos/2d/isometric_light/cubio/idle0033.png


BIN
demos/2d/isometric_light/cubio/idle0034.png


BIN
demos/2d/isometric_light/cubio/idle0035.png


BIN
demos/2d/isometric_light/cubio/idle0036.png


BIN
demos/2d/isometric_light/cubio/idle0037.png


BIN
demos/2d/isometric_light/cubio/idle0038.png


BIN
demos/2d/isometric_light/cubio/idle0039.png


BIN
demos/2d/isometric_light/cubio/idle0040.png


BIN
demos/2d/isometric_light/cubio/idle0041.png


BIN
demos/2d/isometric_light/cubio/idle0042.png


BIN
demos/2d/isometric_light/cubio/idle0043.png


BIN
demos/2d/isometric_light/cubio/idle0044.png


BIN
demos/2d/isometric_light/cubio/idle0045.png


BIN
demos/2d/isometric_light/cubio/idle0046.png


BIN
demos/2d/isometric_light/cubio/idle0047.png


BIN
demos/2d/isometric_light/cubio/idle0048.png


BIN
demos/2d/isometric_light/cubio/idle0049.png


BIN
demos/2d/isometric_light/cubio/idle0050.png


Some files were not shown because too many files changed in this diff