Merge branch 'master' of github.com:okamstudio/godot

This commit is contained in:
Anton Yabchinskiy 2015-07-29 23:01:36 +03:00
commit dc8df8a91a
1421 changed files with 30242 additions and 8860 deletions

10
.editorconfig Normal file
View File

@ -0,0 +1,10 @@
root = true
[*]
charset = utf-8
end_of_line = lf
indent_style = tab
[.travis.yml]
indent_style = space
indent_size = 2

21
.gitignore vendored
View File

@ -23,6 +23,9 @@ tools/editor/editor_icons.cpp
make.bat make.bat
log.txt log.txt
# Javascript specific
*.bc
# Android specific # Android specific
platform/android/java/local.properties platform/android/java/local.properties
platform/android/java/project.properties platform/android/java/project.properties
@ -262,3 +265,21 @@ Desktop.ini
$RECYCLE.BIN/ $RECYCLE.BIN/
logo.h logo.h
*.autosave *.autosave
# https://github.com/github/gitignore/blob/master/Global/Tags.gitignore
# Ignore tags created by etags, ctags, gtags (GNU global) and cscope
TAGS
!TAGS/
tags
!tags/
gtags.files
GTAGS
GRTAGS
GPATH
cscope.files
cscope.out
cscope.in.out
cscope.po.out
godot.creator.*
projects/

2432
Doxyfile Normal file

File diff suppressed because it is too large Load Diff

2
LOGO_LICENSE.md Normal file
View File

@ -0,0 +1,2 @@
Godot Logo (c) Andrea Calabró, distributed under the terms of the CC By License:
https://creativecommons.org/licenses/by/3.0/legalcode

View File

@ -111,6 +111,7 @@ opts.Add('jpg','JPG Image loader support (yes/no)','yes')
opts.Add('webp','WEBP Image loader support (yes/no)','yes') opts.Add('webp','WEBP Image loader support (yes/no)','yes')
opts.Add('dds','DDS Texture loader support (yes/no)','yes') opts.Add('dds','DDS Texture loader support (yes/no)','yes')
opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes') opts.Add('pvr','PVR (PowerVR) Texture loader support (yes/no)','yes')
opts.Add('etc1','etc1 Texture compression support (yes/no)','yes')
opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes') opts.Add('builtin_zlib','Use built-in zlib (yes/no)','yes')
opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no') opts.Add('openssl','Use OpenSSL (yes/no/builtin)','no')
opts.Add('musepack','Musepack Audio (yes/no)','yes') opts.Add('musepack','Musepack Audio (yes/no)','yes')
@ -122,6 +123,8 @@ opts.Add("LINKFLAGS", "Custom flags for the linker");
opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no") opts.Add('disable_3d', 'Disable 3D nodes for smaller executable (yes/no)', "no")
opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no") opts.Add('disable_advanced_gui', 'Disable advance 3D gui nodes and behaviors (yes/no)', "no")
opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no') opts.Add('colored', 'Enable colored output for the compilation (yes/no)', 'no')
opts.Add('extra_suffix', 'Custom extra suffix added to the base filename of all generated binary files.', '')
opts.Add('vsproj', 'Generate Visual Studio Project. (yes/no)', 'no')
# add platform specific options # add platform specific options
@ -176,7 +179,29 @@ if selected_platform in platform_list:
else: else:
env = env_base.Clone() env = env_base.Clone()
if env['vsproj']=="yes":
env.vs_incs = []
env.vs_srcs = []
def AddToVSProject( sources ):
for x in sources:
if type(x) == type(""):
fname = env.File(x).path
else:
fname = env.File(x)[0].path
pieces = fname.split(".")
if len(pieces)>0:
basename = pieces[0]
basename = basename.replace('\\\\','/')
env.vs_srcs = env.vs_srcs + [basename + ".cpp"]
env.vs_incs = env.vs_incs + [basename + ".h"]
#print basename
env.AddToVSProject = AddToVSProject
env.extra_suffix="" env.extra_suffix=""
if env["extra_suffix"] != '' :
env.extra_suffix += '.'+env["extra_suffix"]
CCFLAGS = env.get('CCFLAGS', '') CCFLAGS = env.get('CCFLAGS', '')
env['CCFLAGS'] = '' env['CCFLAGS'] = ''
@ -308,6 +333,8 @@ if selected_platform in platform_list:
if (env['colored']=='yes'): if (env['colored']=='yes'):
methods.colored(sys,env) methods.colored(sys,env)
if (env['etc1']=='yes'):
env.Append(CPPFLAGS=['-DETC1_ENABLED'])
Export('env') Export('env')
@ -324,6 +351,37 @@ if selected_platform in platform_list:
SConscript("main/SCsub") SConscript("main/SCsub")
SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform SConscript("platform/"+selected_platform+"/SCsub"); # build selected platform
# Microsoft Visual Studio Project Generation
if (env['vsproj'])=="yes":
AddToVSProject(env.core_sources)
AddToVSProject(env.main_sources)
AddToVSProject(env.modules_sources)
AddToVSProject(env.scene_sources)
AddToVSProject(env.servers_sources)
AddToVSProject(env.tool_sources)
#env['MSVS_VERSION']='9.0'
env['MSVSBUILDCOM'] = "scons platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes"
env['MSVSREBUILDCOM'] = "scons platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes"
env['MSVSCLEANCOM'] = "scons platform=" + selected_platform + " target=" + env["target"] + " bits=" + env["bits"] + " tools=yes"
debug_variants = ['Debug|Win32']+['Debug|x64']
release_variants = ['Release|Win32']+['Release|x64']
release_debug_variants = ['Release_Debug|Win32']+['Release_Debug|x64']
variants = debug_variants + release_variants + release_debug_variants
debug_targets = ['Debug']+['Debug']
release_targets = ['Release']+['Release']
release_debug_targets = ['ReleaseDebug']+['ReleaseDebug']
targets = debug_targets + release_targets + release_debug_targets
msvproj = env.MSVSProject(target = ['#godot' + env['MSVSPROJECTSUFFIX'] ],
incs = env.vs_incs,
srcs = env.vs_srcs,
runfile = targets,
buildtarget = targets,
auto_build_solution=1,
variant = variants)
else: else:

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -478,6 +478,7 @@ static String _disassemble_addr(const Ref<GDScript>& p_script,const GDFunction&
case GDFunction::ADDR_TYPE_NIL: { case GDFunction::ADDR_TYPE_NIL: {
return "nil"; return "nil";
} break; } break;
} }
return "<err>"; return "<err>";
@ -828,6 +829,13 @@ static void _disassemble_class(const Ref<GDScript>& p_class,const Vector<String>
txt+=" end"; txt+=" end";
incr+=1; incr+=1;
} break; } break;
case GDFunction::OPCODE_ASSERT: {
txt+=" assert ";
txt+=DADDR(1);
incr+=2;
} break;
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -109,6 +109,9 @@ public:
frame->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END ); frame->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
frame->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_END ); frame->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_END );
frame->set_end( Point2(0,0) ); frame->set_end( Point2(0,0) );
Ref<Theme> t = memnew( Theme );
frame->set_theme(t);
get_root()->add_child( frame ); get_root()->add_child( frame );
@ -140,10 +143,10 @@ public:
img.resize(512,512); img.resize(512,512);
img.generate_mipmaps(); img.generate_mipmaps();
img.compress(); img.compress(Image::COMPRESS_PVRTC4);
Ref<Texture> text = memnew( Texture ); Ref<ImageTexture> tt = memnew( ImageTexture );
text->create_from_image(img); tt->create_from_image(img);
tf->set_texture(text); tf->set_texture(tt);
tf->set_pos(Point2(50,50)); tf->set_pos(Point2(50,50));
//tf->set_scale(Point2(0.3,0.3)); //tf->set_scale(Point2(0.3,0.3));

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -191,7 +191,7 @@ class TestPhysics2DMainLoop : public MainLoop {
Image image(convex_png); Image image(convex_png);
body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].image=vs->texture_create_from_image(image); body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].image=vs->texture_create_from_image(image);
RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON); RID convex_polygon_shape = ps->shape_create(Physics2DServer::SHAPE_CONVEX_POLYGON);
@ -206,7 +206,7 @@ class TestPhysics2DMainLoop : public MainLoop {
arr.push_back(Point2(11,7)-sb); arr.push_back(Point2(11,7)-sb);
ps->shape_set_data(convex_polygon_shape,arr); ps->shape_set_data(convex_polygon_shape,arr);
body_shape_data[Physics2DServer::SHAPE_CONVEX_POLYGON].shape = convex_polygon_shape; body_shape_data[Physics2DServer::SHAPE_CUSTOM+1].shape = convex_polygon_shape;
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -33,6 +33,8 @@
#include "print_string.h" #include "print_string.h"
#include "os/os.h" #include "os/os.h"
#include "quick_hull.h" #include "quick_hull.h"
#include "os/keyboard.h"
#define OBJECT_COUNT 50 #define OBJECT_COUNT 50
namespace TestRender { namespace TestRender {
@ -59,10 +61,14 @@ class TestMainLoop : public MainLoop {
float ofs; float ofs;
bool quit; bool quit;
protected:
public: public:
virtual void input_event(const InputEvent& p_event) { virtual void input_event(const InputEvent& p_event) {
if (p_event.type==InputEvent::KEY && p_event.key.pressed)
quit=true;
} }
virtual void init() { virtual void init() {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -26,15 +26,15 @@
/* 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. */
/*************************************************************************/ /*************************************************************************/
#ifndef TEST_SOUND_H #ifndef TEST_SOUND_H
#define TEST_SOUND_H #define TEST_SOUND_H
#include "os/main_loop.h" #include "os/main_loop.h"
namespace TestSound { namespace TestSound {
MainLoop* test(); MainLoop* test();
} }
#endif // TEST_SOUND_H #endif // TEST_SOUND_H

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -31,7 +31,7 @@
//#include "math_funcs.h" //#include "math_funcs.h"
#include <stdio.h> #include <stdio.h>
#include "os/os.h" #include "os/os.h"
#include "drivers/trex/regex.h" #include "drivers/nrex/regex.h"
#include "test_string.h" #include "test_string.h"
@ -463,20 +463,16 @@ bool test_26() {
OS::get_singleton()->print("\n\nTest 26: RegEx\n"); OS::get_singleton()->print("\n\nTest 26: RegEx\n");
RegEx regexp("(.*):(.*)"); RegEx regexp("(.*):(.*)");
List<String> captures;
bool match = regexp.match("name:password", &captures); int res = regexp.find("name:password");
printf("\tmatch: %s\n", match?"true":"false"); printf("\tmatch: %s\n", (res>=0)?"true":"false");
printf("\t%i captures:\n", captures.size()); printf("\t%i captures:\n", regexp.get_capture_count());
List<String>::Element *I = captures.front(); for (int i = 0; i<regexp.get_capture_count(); i++)
while (I) { {
printf("%ls\n", regexp.get_capture(i).c_str());
printf("%ls\n", I->get().c_str()); }
return res;
I = I->next();
};
return captures.size();
}; };
struct test_27_data { struct test_27_data {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
#include "io/base64.h" #include "io/base64.h"
#include "core/globals.h" #include "core/globals.h"
#include "io/file_access_encrypted.h" #include "io/file_access_encrypted.h"
#include "os/keyboard.h"
_ResourceLoader *_ResourceLoader::singleton=NULL; _ResourceLoader *_ResourceLoader::singleton=NULL;
Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String& p_path,const String& p_type_hint) { Ref<ResourceInteractiveLoader> _ResourceLoader::load_interactive(const String& p_path,const String& p_type_hint) {
@ -457,9 +457,9 @@ void _OS::set_icon(const Image& p_icon) {
OS::get_singleton()->set_icon(p_icon); OS::get_singleton()->set_icon(p_icon);
} }
Dictionary _OS::get_date() const { Dictionary _OS::get_date(bool utc) const {
OS::Date date = OS::get_singleton()->get_date(); OS::Date date = OS::get_singleton()->get_date(utc);
Dictionary dated; Dictionary dated;
dated["year"]=date.year; dated["year"]=date.year;
dated["month"]=date.month; dated["month"]=date.month;
@ -470,9 +470,9 @@ Dictionary _OS::get_date() const {
} }
Dictionary _OS::get_time() const { Dictionary _OS::get_time(bool utc) const {
OS::Time time = OS::get_singleton()->get_time(); OS::Time time = OS::get_singleton()->get_time(utc);
Dictionary timed; Dictionary timed;
timed["hour"]=time.hour; timed["hour"]=time.hour;
timed["minute"]=time.min; timed["minute"]=time.min;
@ -480,6 +480,15 @@ Dictionary _OS::get_time() const {
return timed; return timed;
} }
Dictionary _OS::get_time_zone_info() const {
OS::TimeZoneInfo info = OS::get_singleton()->get_time_zone_info();
Dictionary infod;
infod["bias"] = info.bias;
infod["name"] = info.name;
return infod;
}
uint64_t _OS::get_unix_time() const { uint64_t _OS::get_unix_time() const {
return OS::get_singleton()->get_unix_time(); return OS::get_singleton()->get_unix_time();
@ -500,6 +509,10 @@ uint32_t _OS::get_ticks_msec() const {
return OS::get_singleton()->get_ticks_msec(); return OS::get_singleton()->get_ticks_msec();
} }
uint32_t _OS::get_splash_tick_msec() const {
return OS::get_singleton()->get_splash_tick_msec();
}
bool _OS::can_use_threads() const { bool _OS::can_use_threads() const {
@ -690,6 +703,20 @@ String _OS::get_custom_level() const {
return OS::get_singleton()->get_custom_level(); return OS::get_singleton()->get_custom_level();
} }
String _OS::get_scancode_string(uint32_t p_code) const {
return keycode_get_string(p_code);
}
bool _OS::is_scancode_unicode(uint32_t p_unicode) const {
return keycode_has_unicode(p_unicode);
}
int _OS::find_scancode_from_string(const String& p_code) const {
return find_keycode(p_code);
}
_OS *_OS::singleton=NULL; _OS *_OS::singleton=NULL;
void _OS::_bind_methods() { void _OS::_bind_methods() {
@ -709,13 +736,13 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count); ObjectTypeDB::bind_method(_MD("get_screen_count"),&_OS::get_screen_count);
ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen); ObjectTypeDB::bind_method(_MD("get_current_screen"),&_OS::get_current_screen);
ObjectTypeDB::bind_method(_MD("set_current_screen"),&_OS::set_current_screen); ObjectTypeDB::bind_method(_MD("set_current_screen","screen"),&_OS::set_current_screen);
ObjectTypeDB::bind_method(_MD("get_screen_position"),&_OS::get_screen_position,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_screen_position","screen"),&_OS::get_screen_position,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_screen_size"),&_OS::get_screen_size,DEFVAL(0)); ObjectTypeDB::bind_method(_MD("get_screen_size","screen"),&_OS::get_screen_size,DEFVAL(0));
ObjectTypeDB::bind_method(_MD("get_window_position"),&_OS::get_window_position); 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("set_window_position","position"),&_OS::set_window_position);
ObjectTypeDB::bind_method(_MD("get_window_size"),&_OS::get_window_size); 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_window_size","size"),&_OS::set_window_size);
ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen); ObjectTypeDB::bind_method(_MD("set_window_fullscreen","enabled"),&_OS::set_window_fullscreen);
ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen); ObjectTypeDB::bind_method(_MD("is_window_fullscreen"),&_OS::is_window_fullscreen);
ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable); ObjectTypeDB::bind_method(_MD("set_window_resizable","enabled"),&_OS::set_window_resizable);
@ -756,8 +783,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args); ObjectTypeDB::bind_method(_MD("get_cmdline_args"),&_OS::get_cmdline_args);
ObjectTypeDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop); ObjectTypeDB::bind_method(_MD("get_main_loop"),&_OS::get_main_loop);
ObjectTypeDB::bind_method(_MD("get_date"),&_OS::get_date); ObjectTypeDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time"),&_OS::get_time); ObjectTypeDB::bind_method(_MD("get_time","utc"),&_OS::get_time,DEFVAL(false));
ObjectTypeDB::bind_method(_MD("get_time_zone_info"),&_OS::get_time_zone_info);
ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time); ObjectTypeDB::bind_method(_MD("get_unix_time"),&_OS::get_unix_time);
ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon); ObjectTypeDB::bind_method(_MD("set_icon"),&_OS::set_icon);
@ -765,6 +793,7 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec); ObjectTypeDB::bind_method(_MD("delay_usec","usec"),&_OS::delay_usec);
ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec); ObjectTypeDB::bind_method(_MD("delay_msec","msec"),&_OS::delay_msec);
ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec); ObjectTypeDB::bind_method(_MD("get_ticks_msec"),&_OS::get_ticks_msec);
ObjectTypeDB::bind_method(_MD("get_splash_tick_msec"),&_OS::get_splash_tick_msec);
ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale); ObjectTypeDB::bind_method(_MD("get_locale"),&_OS::get_locale);
ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name); ObjectTypeDB::bind_method(_MD("get_model_name"),&_OS::get_model_name);
@ -805,6 +834,9 @@ void _OS::_bind_methods() {
ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop); ObjectTypeDB::bind_method(_MD("native_video_stop"),&_OS::native_video_stop);
ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause); ObjectTypeDB::bind_method(_MD("native_video_pause"),&_OS::native_video_pause);
ObjectTypeDB::bind_method(_MD("get_scancode_string","code"),&_OS::get_scancode_string);
ObjectTypeDB::bind_method(_MD("is_scancode_unicode","code"),&_OS::is_scancode_unicode);
ObjectTypeDB::bind_method(_MD("find_scancode_from_string","string"),&_OS::find_scancode_from_string);
ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap); ObjectTypeDB::bind_method(_MD("set_use_file_access_save_and_swap","enabled"),&_OS::set_use_file_access_save_and_swap);
@ -1646,12 +1678,89 @@ Variant _Marshalls::base64_to_variant(const String& p_str) {
return v; return v;
}; };
String _Marshalls::raw_to_base64(const DVector<uint8_t> &p_arr) {
int len = p_arr.size();
DVector<uint8_t>::Read r = p_arr.read();
int b64len = len / 3 * 4 + 4 + 1;
DVector<uint8_t> b64buff;
b64buff.resize(b64len);
DVector<uint8_t>::Write w64 = b64buff.write();
int strlen = base64_encode((char*)(&w64[0]), (char*)(&r[0]), len);
w64[strlen] = 0;
String ret = (char*)&w64[0];
return ret;
};
DVector<uint8_t> _Marshalls::base64_to_raw(const String &p_str) {
int strlen = p_str.length();
CharString cstr = p_str.ascii();
int arr_len;
DVector<uint8_t> buf;
{
buf.resize(strlen / 4 * 3 + 1);
DVector<uint8_t>::Write w = buf.write();
arr_len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen);
};
buf.resize(arr_len);
// conversion from DVector<uint8_t> to raw array?
return buf;
};
String _Marshalls::utf8_to_base64(const String& p_str) {
CharString cstr = p_str.utf8();
int len = cstr.length();
int b64len = len / 3 * 4 + 4 + 1;
DVector<uint8_t> b64buff;
b64buff.resize(b64len);
DVector<uint8_t>::Write w64 = b64buff.write();
int strlen = base64_encode((char*)(&w64[0]), (char*)cstr.get_data(), len);
w64[strlen] = 0;
String ret = (char*)&w64[0];
return ret;
};
String _Marshalls::base64_to_utf8(const String& p_str) {
int strlen = p_str.length();
CharString cstr = p_str.ascii();
DVector<uint8_t> buf;
buf.resize(strlen / 4 * 3 + 1 + 1);
DVector<uint8_t>::Write w = buf.write();
int len = base64_decode((char*)(&w[0]), (char*)cstr.get_data(), strlen);
w[len] = 0;
String ret = String::utf8((char*)&w[0]);
return ret;
};
void _Marshalls::_bind_methods() { void _Marshalls::_bind_methods() {
ObjectTypeDB::bind_method(_MD("variant_to_base64:String","variant"),&_Marshalls::variant_to_base64); ObjectTypeDB::bind_method(_MD("variant_to_base64:String","variant"),&_Marshalls::variant_to_base64);
ObjectTypeDB::bind_method(_MD("base64_to_variant:Variant","base64_str"),&_Marshalls::base64_to_variant); ObjectTypeDB::bind_method(_MD("base64_to_variant:Variant","base64_str"),&_Marshalls::base64_to_variant);
ObjectTypeDB::bind_method(_MD("raw_to_base64:String","array"),&_Marshalls::raw_to_base64);
ObjectTypeDB::bind_method(_MD("base64_to_raw:RawArray","base64_str"),&_Marshalls::base64_to_raw);
ObjectTypeDB::bind_method(_MD("utf8_to_base64:String","utf8_str"),&_Marshalls::utf8_to_base64);
ObjectTypeDB::bind_method(_MD("base64_to_utf8:String","base64_str"),&_Marshalls::base64_to_utf8);
}; };
@ -1735,9 +1844,12 @@ _Mutex::~_Mutex(){
void _Thread::_start_func(void *ud) { void _Thread::_start_func(void *ud) {
_Thread *t=(_Thread*)ud; Ref<_Thread>* tud=(Ref<_Thread>*)ud;
Ref<_Thread> t=*tud;
memdelete(tud);
Variant::CallError ce; Variant::CallError ce;
const Variant* arg[1]={&t->userdata}; const Variant* arg[1]={&t->userdata};
t->ret=t->target_instance->call(t->target_method,arg,1,ce); t->ret=t->target_instance->call(t->target_method,arg,1,ce);
if (ce.error!=Variant::CallError::CALL_OK) { if (ce.error!=Variant::CallError::CALL_OK) {
@ -1762,6 +1874,7 @@ void _Thread::_start_func(void *ud) {
default: {} default: {}
} }
ERR_EXPLAIN("Could not call function '"+t->target_method.operator String()+"'' starting thread ID: "+t->get_id()+" Reason: "+reason); ERR_EXPLAIN("Could not call function '"+t->target_method.operator String()+"'' starting thread ID: "+t->get_id()+" Reason: "+reason);
ERR_FAIL(); ERR_FAIL();
} }
@ -1782,9 +1895,11 @@ Error _Thread::start(Object *p_instance,const StringName& p_method,const Variant
userdata=p_userdata; userdata=p_userdata;
active=true; active=true;
Ref<_Thread> *ud = memnew( Ref<_Thread>(this) );
Thread::Settings s; Thread::Settings s;
s.priority=(Thread::Priority)p_priority; s.priority=(Thread::Priority)p_priority;
thread = Thread::create(_start_func,this,s); thread = Thread::create(_start_func,ud,s);
if (!thread) { if (!thread) {
active=false; active=false;
target_method=StringName(); target_method=StringName();
@ -1845,5 +1960,8 @@ _Thread::_Thread() {
_Thread::~_Thread() { _Thread::~_Thread() {
if (active) {
ERR_EXPLAIN("Reference to a Thread object object was lost while the thread is still running..");
}
ERR_FAIL_COND(active==true); ERR_FAIL_COND(active==true);
} }

View File

@ -178,6 +178,11 @@ public:
String get_unique_ID() const; String get_unique_ID() const;
String get_scancode_string(uint32_t p_code) const;
bool is_scancode_unicode(uint32_t p_unicode) const;
int find_scancode_from_string(const String& p_code) const;
/* /*
struct Date { struct Date {
@ -199,8 +204,9 @@ public:
void set_use_file_access_save_and_swap(bool p_enable); void set_use_file_access_save_and_swap(bool p_enable);
void set_icon(const Image& p_icon); void set_icon(const Image& p_icon);
Dictionary get_date() const; Dictionary get_date(bool utc) const;
Dictionary get_time() const; Dictionary get_time(bool utc) const;
Dictionary get_time_zone_info() const;
uint64_t get_unix_time() const; uint64_t get_unix_time() const;
int get_static_memory_usage() const; int get_static_memory_usage() const;
@ -210,6 +216,7 @@ public:
void delay_usec(uint32_t p_usec) const; void delay_usec(uint32_t p_usec) const;
void delay_msec(uint32_t p_msec) const; void delay_msec(uint32_t p_msec) const;
uint32_t get_ticks_msec() const; uint32_t get_ticks_msec() const;
uint32_t get_splash_tick_msec() const;
bool can_use_threads() const; bool can_use_threads() const;
@ -429,6 +436,12 @@ public:
String variant_to_base64(const Variant& p_var); String variant_to_base64(const Variant& p_var);
Variant base64_to_variant(const String& p_str); Variant base64_to_variant(const String& p_str);
String raw_to_base64(const DVector<uint8_t>& p_arr);
DVector<uint8_t> base64_to_raw(const String& p_str);
String utf8_to_base64(const String& p_str);
String base64_to_utf8(const String& p_str);
_Marshalls() {}; _Marshalls() {};
}; };

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -161,7 +161,7 @@ void Color::invert() {
r=1.0-r; r=1.0-r;
g=1.0-g; g=1.0-g;
g=1.0-b; b=1.0-b;
} }
void Color::contrast() { void Color::contrast() {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -34,6 +34,7 @@
#include "os/mutex.h" #include "os/mutex.h"
#include "os/memory.h" #include "os/memory.h"
#include "simple_type.h" #include "simple_type.h"
#include "print_string.h"
/** /**
@author Juan Linietsky <reduzio@gmail.com> @author Juan Linietsky <reduzio@gmail.com>
*/ */
@ -174,7 +175,7 @@ class CommandQueueMT {
R* ret; R* ret;
SyncSemaphore *sync; SyncSemaphore *sync;
virtual void call() { *ret = (instance->*method)(p1); sync->sem->post(); sync->in_use=false; ; } virtual void call() { *ret = (instance->*method)(p1); sync->sem->post(); print_line("post"); sync->in_use=false; ; }
}; };
template<class T,class M,class P1,class P2,class R> template<class T,class M,class P1,class P2,class R>
@ -675,6 +676,7 @@ public:
if (sync) sync->post(); if (sync) sync->post();
ss->sem->wait(); ss->sem->wait();
print_line("wait");
} }
template<class T, class M, class P1, class P2,class R> template<class T, class M, class P1, class P2,class R>

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -42,6 +42,7 @@ CoreStringNames::CoreStringNames() {
_iter_init=StaticCString::create("_iter_init"); _iter_init=StaticCString::create("_iter_init");
_iter_next=StaticCString::create("_iter_next"); _iter_next=StaticCString::create("_iter_next");
_iter_get=StaticCString::create("_iter_get"); _iter_get=StaticCString::create("_iter_get");
get_rid=StaticCString::create("get_rid");
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -56,6 +56,7 @@ public:
StringName _iter_init; StringName _iter_init;
StringName _iter_next; StringName _iter_next;
StringName _iter_get; StringName _iter_get;
StringName get_rid;
}; };

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -339,7 +339,7 @@ Error Globals::setup(const String& p_path,const String & p_main_pack) {
//try to load settings in ascending through dirs shape! //try to load settings in ascending through dirs shape!
//tries to open pack, but only first time //tries to open pack, but only first time
if (first_time && _load_resource_pack(current_dir+"/data.pck")) { if (first_time && (_load_resource_pack(current_dir+"/data.pck") || _load_resource_pack(current_dir+"/data.pcz") )) {
if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) { if (_load_settings("res://engine.cfg")==OK || _load_settings_binary("res://engine.cfb")==OK) {
_load_settings("res://override.cfg"); _load_settings("res://override.cfg");
@ -1149,6 +1149,12 @@ Error Globals::_save_settings_text(const String& p_file,const Map<String,List<St
return OK; return OK;
} }
Error Globals::_save_custom_bnd(const String &p_file) { // add other params as dictionary and array?
return save_custom(p_file);
};
Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const Set<String>& p_ignore_masks) { Error Globals::save_custom(const String& p_path,const CustomMap& p_custom,const Set<String>& p_ignore_masks) {
ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_path=="",ERR_INVALID_PARAMETER);
@ -1321,7 +1327,7 @@ Vector<String> Globals::get_optimizer_presets() const {
if (!E->get().name.begins_with("optimizer_presets/")) if (!E->get().name.begins_with("optimizer_presets/"))
continue; continue;
names.push_back(E->get().name.get_slice("/",1)); names.push_back(E->get().name.get_slicec('/',1));
} }
names.sort(); names.sort();
@ -1361,6 +1367,9 @@ void Globals::_bind_methods() {
ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton); ObjectTypeDB::bind_method(_MD("has_singleton"),&Globals::has_singleton);
ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object); ObjectTypeDB::bind_method(_MD("get_singleton"),&Globals::get_singleton_object);
ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack); ObjectTypeDB::bind_method(_MD("load_resource_pack"),&Globals::_load_resource_pack);
ObjectTypeDB::bind_method(_MD("save_custom"),&Globals::_save_custom_bnd);
} }
Globals::Globals() { Globals::Globals() {
@ -1381,7 +1390,7 @@ Globals::Globals() {
set("application/name","" ); set("application/name","" );
set("application/main_scene",""); set("application/main_scene","");
custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"xml,res,scn,xscn"); custom_prop_info["application/main_scene"]=PropertyInfo(Variant::STRING,"application/main_scene",PROPERTY_HINT_FILE,"scn,res,xscn,xml");
set("application/disable_stdout",false); set("application/disable_stdout",false);
set("application/use_shared_user_dir",true); set("application/use_shared_user_dir",true);
@ -1396,6 +1405,13 @@ Globals::Globals() {
va.push_back(joyb); va.push_back(joyb);
set("input/ui_accept",va); set("input/ui_accept",va);
va=Array();
key.key.scancode=KEY_SPACE;
va.push_back(key);
joyb.joy_button.button_index=JOY_BUTTON_3;
va.push_back(joyb);
set("input/ui_select",va);
va=Array(); va=Array();
key.key.scancode=KEY_ESCAPE; key.key.scancode=KEY_ESCAPE;
va.push_back(key); va.push_back(key);
@ -1460,6 +1476,7 @@ Globals::Globals() {
custom_prop_info["display/orientation"]=PropertyInfo(Variant::STRING,"display/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor"); custom_prop_info["display/orientation"]=PropertyInfo(Variant::STRING,"display/orientation",PROPERTY_HINT_ENUM,"landscape,portrait,reverse_landscape,reverse_portrait,sensor_landscape,sensor_portrait,sensor");
custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow"); custom_prop_info["render/mipmap_policy"]=PropertyInfo(Variant::INT,"render/mipmap_policy",PROPERTY_HINT_ENUM,"Allow,Allow For Po2,Disallow");
custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded"); custom_prop_info["render/thread_model"]=PropertyInfo(Variant::INT,"render/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
custom_prop_info["physics_2d/thread_model"]=PropertyInfo(Variant::INT,"physics_2d/thread_model",PROPERTY_HINT_ENUM,"Single-Unsafe,Single-Safe,Multi-Threaded");
set("display/emulate_touchscreen",false); set("display/emulate_touchscreen",false);
using_datapack=false; using_datapack=false;

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -86,6 +86,7 @@ protected:
List<Singleton> singletons; List<Singleton> singletons;
Error _save_custom_bnd(const String& p_file);
bool _load_resource_pack(const String& p_pack); bool _load_resource_pack(const String& p_pack);

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -134,6 +134,18 @@ void Image::get_mipmap_offset_and_size(int p_mipmap,int &r_ofs, int &r_size) con
} }
void Image::get_mipmap_offset_size_and_dimensions(int p_mipmap,int &r_ofs, int &r_size,int &w, int& h) const {
int ofs;
_get_mipmap_offset_and_size(p_mipmap,ofs,w,h);
int ofs2,w2,h2;
_get_mipmap_offset_and_size(p_mipmap+1,ofs2,w2,h2);
r_ofs=ofs;
r_size=ofs2-ofs;
}
void Image::put_pixel(int p_x,int p_y, const Color& p_color,int p_mipmap){ void Image::put_pixel(int p_x,int p_y, const Color& p_color,int p_mipmap){
ERR_FAIL_INDEX(p_mipmap,mipmaps+1); ERR_FAIL_INDEX(p_mipmap,mipmaps+1);
@ -1004,10 +1016,10 @@ void Image::create( const char ** p_xpm ) {
String line_str=line_ptr; String line_str=line_ptr;
line_str.replace("\t"," "); line_str.replace("\t"," ");
size_width=line_str.get_slice(" ",0).to_int(); size_width=line_str.get_slicec(' ',0).to_int();
size_height=line_str.get_slice(" ",1).to_int(); size_height=line_str.get_slicec(' ',1).to_int();
colormap_size=line_str.get_slice(" ",2).to_int(); colormap_size=line_str.get_slicec(' ',2).to_int();
pixelchars=line_str.get_slice(" ",3).to_int(); pixelchars=line_str.get_slicec(' ',3).to_int();
ERR_FAIL_COND(colormap_size > 32766); ERR_FAIL_COND(colormap_size > 32766);
ERR_FAIL_COND(pixelchars > 5); ERR_FAIL_COND(pixelchars > 5);
ERR_FAIL_COND(size_width > 32767); ERR_FAIL_COND(size_width > 32767);
@ -1112,6 +1124,7 @@ void Image::create( const char ** p_xpm ) {
} }
#define DETECT_ALPHA_MAX_TRESHOLD 254 #define DETECT_ALPHA_MAX_TRESHOLD 254
#define DETECT_ALPHA_MIN_TRESHOLD 2 #define DETECT_ALPHA_MIN_TRESHOLD 2
#define DETECT_ALPHA( m_value )\ #define DETECT_ALPHA( m_value )\
{ \ { \
uint8_t value=m_value;\ uint8_t value=m_value;\
@ -1124,6 +1137,82 @@ void Image::create( const char ** p_xpm ) {
}\ }\
} }
#define DETECT_NON_ALPHA( m_value )\
{ \
uint8_t value=m_value;\
if (value>0) {\
\
detected=true;\
break;\
}\
}
bool Image::is_invisible() const {
if (format==FORMAT_GRAYSCALE ||
format==FORMAT_RGB ||
format==FORMAT_INDEXED)
return false;
int len = data.size();
if (len==0)
return true;
if (format >= FORMAT_YUV_422 && format <= FORMAT_YUV_444)
return false;
int w,h;
_get_mipmap_offset_and_size(1,len,w,h);
DVector<uint8_t>::Read r = data.read();
const unsigned char *data_ptr=r.ptr();
bool detected=false;
switch(format) {
case FORMAT_INTENSITY: {
for(int i=0;i<len;i++) {
DETECT_NON_ALPHA(data_ptr[i]);
}
} break;
case FORMAT_GRAYSCALE_ALPHA: {
for(int i=0;i<(len>>1);i++) {
DETECT_NON_ALPHA(data_ptr[(i<<1)+1]);
}
} break;
case FORMAT_RGBA: {
for(int i=0;i<(len>>2);i++) {
DETECT_NON_ALPHA(data_ptr[(i<<2)+3])
}
} break;
case FORMAT_INDEXED: {
return false;
} break;
case FORMAT_INDEXED_ALPHA: {
return false;
} break;
case FORMAT_PVRTC2_ALPHA:
case FORMAT_PVRTC4_ALPHA:
case FORMAT_BC2:
case FORMAT_BC3: {
detected=true;
} break;
default: {}
}
return !detected;
}
Image::AlphaMode Image::detect_alpha() const { Image::AlphaMode Image::detect_alpha() const {
if (format==FORMAT_GRAYSCALE || if (format==FORMAT_GRAYSCALE ||
@ -1734,6 +1823,10 @@ Error Image::_decompress_bc() {
return OK; return OK;
} }
bool Image::is_compressed() const {
return format>=FORMAT_BC1;
}
Image Image::decompressed() const { Image Image::decompressed() const {
@ -1986,7 +2079,7 @@ void Image::blit_rect(const Image& p_src, const Rect2& p_src_rect,const Point2&
} }
Image (*Image::_png_mem_loader_func)(const uint8_t*)=NULL; Image (*Image::_png_mem_loader_func)(const uint8_t*,int)=NULL;
void (*Image::_image_compress_bc_func)(Image *)=NULL; void (*Image::_image_compress_bc_func)(Image *)=NULL;
void (*Image::_image_compress_pvrtc2_func)(Image *)=NULL; void (*Image::_image_compress_pvrtc2_func)(Image *)=NULL;
void (*Image::_image_compress_pvrtc4_func)(Image *)=NULL; void (*Image::_image_compress_pvrtc4_func)(Image *)=NULL;
@ -2155,7 +2248,7 @@ void Image::fix_alpha_edges() {
} }
Image::Image(const uint8_t* p_png) { Image::Image(const uint8_t* p_png,int p_len) {
width=0; width=0;
height=0; height=0;
@ -2163,7 +2256,7 @@ Image::Image(const uint8_t* p_png) {
format=FORMAT_GRAYSCALE; format=FORMAT_GRAYSCALE;
if (_png_mem_loader_func) { if (_png_mem_loader_func) {
*this = _png_mem_loader_func(p_png); *this = _png_mem_loader_func(p_png,p_len);
} }
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -94,7 +94,7 @@ public:
/* INTERPOLATE GAUSS */ /* INTERPOLATE GAUSS */
}; };
static Image (*_png_mem_loader_func)(const uint8_t* p_png); static Image (*_png_mem_loader_func)(const uint8_t* p_png,int p_size);
static void (*_image_compress_bc_func)(Image *); static void (*_image_compress_bc_func)(Image *);
static void (*_image_compress_pvrtc2_func)(Image *); static void (*_image_compress_pvrtc2_func)(Image *);
static void (*_image_compress_pvrtc4_func)(Image *); static void (*_image_compress_pvrtc4_func)(Image *);
@ -236,6 +236,7 @@ public:
int get_mipmap_offset(int p_mipmap) const; //get where the mipmap begins in data int get_mipmap_offset(int p_mipmap) const; //get where the mipmap begins in data
void get_mipmap_offset_and_size(int p_mipmap,int &r_ofs, int &r_size) const; //get where the mipmap begins in data void get_mipmap_offset_and_size(int p_mipmap,int &r_ofs, int &r_size) const; //get where the mipmap begins in data
void get_mipmap_offset_size_and_dimensions(int p_mipmap,int &r_ofs, int &r_size,int &w, int& h) const; //get where the mipmap begins in data
/** /**
* Resize the image, using the prefered interpolation method. * Resize the image, using the prefered interpolation method.
@ -304,6 +305,7 @@ public:
}; };
AlphaMode detect_alpha() const; AlphaMode detect_alpha() const;
bool is_invisible() const;
void put_indexed_pixel(int p_x, int p_y, uint8_t p_idx,int p_mipmap=0); void put_indexed_pixel(int p_x, int p_y, uint8_t p_idx,int p_mipmap=0);
uint8_t get_indexed_pixel(int p_x, int p_y,int p_mipmap=0) const; uint8_t get_indexed_pixel(int p_x, int p_y,int p_mipmap=0) const;
@ -334,6 +336,7 @@ public:
Image compressed(int p_mode); /* from the Image::CompressMode enum */ Image compressed(int p_mode); /* from the Image::CompressMode enum */
Error decompress(); Error decompress();
Image decompressed() const; Image decompressed() const;
bool is_compressed() const;
void fix_alpha_edges(); void fix_alpha_edges();
void premultiply_alpha(); void premultiply_alpha();
@ -348,7 +351,7 @@ public:
Image get_rect(const Rect2& p_area) const; Image get_rect(const Rect2& p_area) const;
static void set_compress_bc_func(void (*p_compress_func)(Image *)); static void set_compress_bc_func(void (*p_compress_func)(Image *));
Image(const uint8_t* p_mem_png); Image(const uint8_t* p_mem_png, int p_len=-1);
Image(const char **p_xpm); Image(const char **p_xpm);
~Image(); ~Image();

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -42,7 +42,7 @@ void InputMap::_bind_methods() {
ObjectTypeDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event); ObjectTypeDB::bind_method(_MD("action_add_event","action","event"),&InputMap::action_add_event);
ObjectTypeDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event); ObjectTypeDB::bind_method(_MD("action_has_event","action","event"),&InputMap::action_has_event);
ObjectTypeDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event); ObjectTypeDB::bind_method(_MD("action_erase_event","action","event"),&InputMap::action_erase_event);
ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::get_action_list); ObjectTypeDB::bind_method(_MD("get_action_list","action"),&InputMap::_get_action_list);
ObjectTypeDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action); ObjectTypeDB::bind_method(_MD("event_is_action","event","action"),&InputMap::event_is_action);
ObjectTypeDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals); ObjectTypeDB::bind_method(_MD("load_from_globals"),&InputMap::load_from_globals);
@ -162,6 +162,22 @@ void InputMap::action_erase_event(const StringName& p_action,const InputEvent& p
} }
Array InputMap::_get_action_list(const StringName& p_action) {
Array ret;
const List<InputEvent> *al = get_action_list(p_action);
if (al) {
for(const List<InputEvent>::Element *E=al->front();E;E=E->next()) {
ret.push_back(E->get());;
}
}
return ret;
}
const List<InputEvent> *InputMap::get_action_list(const StringName& p_action) { const List<InputEvent> *InputMap::get_action_list(const StringName& p_action) {
const Map<StringName, Action>::Element *E=input_map.find(p_action); const Map<StringName, Action>::Element *E=input_map.find(p_action);
@ -176,7 +192,7 @@ bool InputMap::event_is_action(const InputEvent& p_event, const StringName& p_ac
Map<StringName,Action >::Element *E=input_map.find(p_action); Map<StringName,Action >::Element *E=input_map.find(p_action);
if(!E) { if(!E) {
ERR_EXPLAIN("Request for unexisting InputMap action: "+String(p_action)); ERR_EXPLAIN("Request for nonexistent InputMap action: "+String(p_action));
ERR_FAIL_COND_V(!E,false); ERR_FAIL_COND_V(!E,false);
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -46,6 +46,8 @@ class InputMap : public Object {
List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const; List<InputEvent>::Element *_find_event(List<InputEvent> &p_list,const InputEvent& p_event) const;
Array _get_action_list(const StringName& p_action);
protected: protected:
static void _bind_methods(); static void _bind_methods();

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -26,28 +26,28 @@
/* 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. */
/*************************************************************************/ /*************************************************************************/
#ifndef COMPRESSION_H #ifndef COMPRESSION_H
#define COMPRESSION_H #define COMPRESSION_H
#include "typedefs.h" #include "typedefs.h"
class Compression class Compression
{ {
public: public:
enum Mode { enum Mode {
MODE_FASTLZ, MODE_FASTLZ,
MODE_DEFLATE MODE_DEFLATE
}; };
static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ); static int compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
static int get_max_compressed_buffer_size(int p_src_size,Mode p_mode=MODE_FASTLZ); static int get_max_compressed_buffer_size(int p_src_size,Mode p_mode=MODE_FASTLZ);
static void decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ); static void decompress(uint8_t *p_dst, int p_dst_max_size, const uint8_t *p_src, int p_src_size,Mode p_mode=MODE_FASTLZ);
Compression(); Compression();
}; };
#endif // COMPRESSION_H #endif // COMPRESSION_H

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -357,6 +357,7 @@ if (res!=-1 && res < min_pos) {\
} break; } break;
case MIN_OPEN: { case MIN_OPEN: {
int level=1; int level=1;
end++;
while(end<close_pos) { while(end<close_pos) {
if (str[end]=='[') if (str[end]=='[')
@ -373,6 +374,7 @@ if (res!=-1 && res < min_pos) {\
} break; } break;
case MIN_CURLY_OPEN: { case MIN_CURLY_OPEN: {
int level=1; int level=1;
end++;
while(end<close_pos) { while(end<close_pos) {
if (str[end]=='{') if (str[end]=='{')

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -26,76 +26,76 @@
/* 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. */
/*************************************************************************/ /*************************************************************************/
#ifndef FILE_ACCESS_COMPRESSED_H #ifndef FILE_ACCESS_COMPRESSED_H
#define FILE_ACCESS_COMPRESSED_H #define FILE_ACCESS_COMPRESSED_H
#include "io/compression.h" #include "io/compression.h"
#include "os/file_access.h" #include "os/file_access.h"
class FileAccessCompressed : public FileAccess { class FileAccessCompressed : public FileAccess {
Compression::Mode cmode; Compression::Mode cmode;
bool writing; bool writing;
int write_pos; int write_pos;
uint8_t*write_ptr; uint8_t*write_ptr;
int write_buffer_size; int write_buffer_size;
int write_max; int write_max;
int block_size; int block_size;
mutable bool read_eof; mutable bool read_eof;
mutable bool at_end; mutable bool at_end;
struct ReadBlock { struct ReadBlock {
int csize; int csize;
int offset; int offset;
}; };
mutable Vector<uint8_t> comp_buffer; mutable Vector<uint8_t> comp_buffer;
uint8_t *read_ptr; uint8_t *read_ptr;
mutable int read_block; mutable int read_block;
int read_block_count; int read_block_count;
mutable int read_block_size; mutable int read_block_size;
mutable int read_pos; mutable int read_pos;
Vector<ReadBlock> read_blocks; Vector<ReadBlock> read_blocks;
int read_total; int read_total;
String magic; String magic;
mutable Vector<uint8_t> buffer; mutable Vector<uint8_t> buffer;
FileAccess *f; FileAccess *f;
public: public:
void configure(const String& p_magic, Compression::Mode p_mode=Compression::MODE_FASTLZ, int p_block_size=4096); void configure(const String& p_magic, Compression::Mode p_mode=Compression::MODE_FASTLZ, int p_block_size=4096);
Error open_after_magic(FileAccess *p_base); Error open_after_magic(FileAccess *p_base);
virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open virtual bool is_open() const; ///< true when file is open
virtual void seek(size_t p_position); ///< seek to a given position virtual void seek(size_t p_position); ///< seek to a given position
virtual void seek_end(int64_t p_position=0); ///< seek from the end of file virtual void seek_end(int64_t p_position=0); ///< seek from the end of file
virtual size_t get_pos() const; ///< get position in the file virtual size_t get_pos() const; ///< get position in the file
virtual size_t get_len() const; ///< get size of the file virtual size_t get_len() const; ///< get size of the file
virtual bool eof_reached() const; ///< reading passed EOF virtual bool eof_reached() const; ///< reading passed EOF
virtual uint8_t get_8() const; ///< get a byte virtual uint8_t get_8() const; ///< get a byte
virtual int get_buffer(uint8_t *p_dst, int p_length) const; virtual int get_buffer(uint8_t *p_dst, int p_length) const;
virtual Error get_error() const; ///< get last error virtual Error get_error() const; ///< get last error
virtual void store_8(uint8_t p_dest); ///< store a byte virtual void store_8(uint8_t p_dest); ///< store a byte
virtual bool file_exists(const String& p_name); ///< return true if a file exists virtual bool file_exists(const String& p_name); ///< return true if a file exists
virtual uint64_t _get_modified_time(const String& p_file); virtual uint64_t _get_modified_time(const String& p_file);
FileAccessCompressed(); FileAccessCompressed();
virtual ~FileAccessCompressed(); virtual ~FileAccessCompressed();
}; };
#endif // FILE_ACCESS_COMPRESSED_H #endif // FILE_ACCESS_COMPRESSED_H

View File

@ -5,10 +5,12 @@
#include "print_string.h" #include "print_string.h"
#define COMP_MAGIC 0x43454447 #define COMP_MAGIC 0x43454447
#include "core/variant.h"
#include <stdio.h>
Error FileAccessEncrypted::open_and_parse(FileAccess *p_base,const Vector<uint8_t>& p_key,Mode p_mode) { Error FileAccessEncrypted::open_and_parse(FileAccess *p_base,const Vector<uint8_t>& p_key,Mode p_mode) {
print_line("open and parse!"); //print_line("open and parse!");
ERR_FAIL_COND_V(file!=NULL,ERR_ALREADY_IN_USE); ERR_FAIL_COND_V(file!=NULL,ERR_ALREADY_IN_USE);
ERR_FAIL_COND_V(p_key.size()!=32,ERR_INVALID_PARAMETER); ERR_FAIL_COND_V(p_key.size()!=32,ERR_INVALID_PARAMETER);

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -39,7 +39,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
if (!files) { if (!files) {
files = memnew((Map<String, Vector<uint8_t> >)); files = memnew((Map<String, Vector<uint8_t> >));
}; }
String name; String name;
if (Globals::get_singleton()) if (Globals::get_singleton())
@ -49,7 +49,7 @@ void FileAccessMemory::register_file(String p_name, Vector<uint8_t> p_data) {
name = DirAccess::normalize_path(name); name = DirAccess::normalize_path(name);
(*files)[name] = p_data; (*files)[name] = p_data;
}; }
void FileAccessMemory::cleanup() { void FileAccessMemory::cleanup() {
@ -57,13 +57,13 @@ void FileAccessMemory::cleanup() {
return; return;
memdelete(files); memdelete(files);
}; }
FileAccess* FileAccessMemory::create() { FileAccess* FileAccessMemory::create() {
return memnew(FileAccessMemory); return memnew(FileAccessMemory);
}; }
bool FileAccessMemory::file_exists(const String& p_name) { bool FileAccessMemory::file_exists(const String& p_name) {
@ -71,9 +71,17 @@ bool FileAccessMemory::file_exists(const String& p_name) {
name = DirAccess::normalize_path(name); name = DirAccess::normalize_path(name);
return files && (files->find(name) != NULL); return files && (files->find(name) != NULL);
}; }
Error FileAccessMemory::open_custom(const uint8_t* p_data, int p_len) {
data=(uint8_t*)p_data;
length=p_len;
pos=0;
return OK;
}
Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) { Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND); ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND);
@ -89,57 +97,57 @@ Error FileAccessMemory::_open(const String& p_path, int p_mode_flags) {
pos = 0; pos = 0;
return OK; return OK;
}; }
void FileAccessMemory::close() { void FileAccessMemory::close() {
data = NULL; data = NULL;
}; }
bool FileAccessMemory::is_open() const { bool FileAccessMemory::is_open() const {
return data != NULL; return data != NULL;
}; }
void FileAccessMemory::seek(size_t p_position) { void FileAccessMemory::seek(size_t p_position) {
ERR_FAIL_COND(!data); ERR_FAIL_COND(!data);
pos = p_position; pos = p_position;
}; }
void FileAccessMemory::seek_end(int64_t p_position) { void FileAccessMemory::seek_end(int64_t p_position) {
ERR_FAIL_COND(!data); ERR_FAIL_COND(!data);
pos = length + p_position; pos = length + p_position;
}; }
size_t FileAccessMemory::get_pos() const { size_t FileAccessMemory::get_pos() const {
ERR_FAIL_COND_V(!data, 0); ERR_FAIL_COND_V(!data, 0);
return pos; return pos;
}; }
size_t FileAccessMemory::get_len() const { size_t FileAccessMemory::get_len() const {
ERR_FAIL_COND_V(!data, 0); ERR_FAIL_COND_V(!data, 0);
return length; return length;
}; }
bool FileAccessMemory::eof_reached() const { bool FileAccessMemory::eof_reached() const {
return pos >= length; return pos >= length;
}; }
uint8_t FileAccessMemory::get_8() const { uint8_t FileAccessMemory::get_8() const {
uint8_t ret; uint8_t ret = 0;
if (pos < length) { if (pos < length) {
ret = data[pos]; ret = data[pos];
}; }
++pos; ++pos;
return ret; return ret;
}; }
int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const { int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
@ -156,19 +164,19 @@ int FileAccessMemory::get_buffer(uint8_t *p_dst,int p_length) const {
pos += p_length; pos += p_length;
return read; return read;
}; }
Error FileAccessMemory::get_error() const { Error FileAccessMemory::get_error() const {
return pos >= length ? ERR_FILE_EOF : OK; return pos >= length ? ERR_FILE_EOF : OK;
}; }
void FileAccessMemory::store_8(uint8_t p_byte) { void FileAccessMemory::store_8(uint8_t p_byte) {
ERR_FAIL_COND(!data); ERR_FAIL_COND(!data);
ERR_FAIL_COND(pos >= length); ERR_FAIL_COND(pos >= length);
data[pos++] = p_byte; data[pos++] = p_byte;
}; }
void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) { void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
@ -176,11 +184,11 @@ void FileAccessMemory::store_buffer(const uint8_t *p_src,int p_length) {
int write = MIN(p_length, left); int write = MIN(p_length, left);
if (write < p_length) { if (write < p_length) {
WARN_PRINT("Writing less data than requested"); WARN_PRINT("Writing less data than requested");
}; }
copymem(&data[pos], p_src, write); copymem(&data[pos], p_src, write);
pos += p_length; pos += p_length;
}; }
FileAccessMemory::FileAccessMemory() { FileAccessMemory::FileAccessMemory() {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -44,6 +44,7 @@ public:
static void register_file(String p_name, Vector<uint8_t> p_data); static void register_file(String p_name, Vector<uint8_t> p_data);
static void cleanup(); static void cleanup();
virtual Error open_custom(const uint8_t* p_data, int p_len); ///< open a file
virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file virtual Error _open(const String& p_path, int p_mode_flags); ///< open a file
virtual void close(); ///< close a file virtual void close(); ///< close a file
virtual bool is_open() const; ///< true when file is open virtual bool is_open() const; ///< true when file is open

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -254,6 +254,7 @@ FileAccessNetworkClient::~FileAccessNetworkClient() {
quit=true; quit=true;
sem->post(); sem->post();
Thread::wait_to_finish(thread); Thread::wait_to_finish(thread);
memdelete(thread);
} }
memdelete(blockrequest_mutex); memdelete(blockrequest_mutex);

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -92,7 +92,9 @@ void PackedData::add_path(const String& pkg_path, const String& path, uint64_t o
void PackedData::add_pack_source(PackSource *p_source) { void PackedData::add_pack_source(PackSource *p_source) {
sources.push_back(p_source); if (p_source != NULL) {
sources.push_back(p_source);
}
}; };
PackedData *PackedData::singleton=NULL; PackedData *PackedData::singleton=NULL;
@ -107,6 +109,21 @@ PackedData::PackedData() {
add_pack_source(memnew(PackedSourcePCK)); add_pack_source(memnew(PackedSourcePCK));
} }
void PackedData::_free_packed_dirs(PackedDir *p_dir) {
for (Map<String,PackedDir*>::Element *E=p_dir->subdirs.front();E;E=E->next())
_free_packed_dirs(E->get());
memdelete(p_dir);
}
PackedData::~PackedData() {
for(int i=0;i<sources.size();i++) {
memdelete(sources[i]);
}
_free_packed_dirs(root);
}
////////////////////////////////////////////////////////////////// //////////////////////////////////////////////////////////////////

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -96,6 +96,8 @@ private:
static PackedData *singleton; static PackedData *singleton;
bool disabled; bool disabled;
void _free_packed_dirs(PackedDir *p_dir);
public: public:
void add_pack_source(PackSource* p_source); void add_pack_source(PackSource* p_source);
@ -111,6 +113,7 @@ public:
_FORCE_INLINE_ bool has_path(const String& p_path); _FORCE_INLINE_ bool has_path(const String& p_path);
PackedData(); PackedData();
~PackedData();
}; };
class PackSource { class PackSource {
@ -119,6 +122,7 @@ public:
virtual bool try_open_pack(const String& p_path)=0; virtual bool try_open_pack(const String& p_path)=0;
virtual FileAccess* get_file(const String& p_path, PackedData::PackedFile* p_file)=0; virtual FileAccess* get_file(const String& p_path, PackedData::PackedFile* p_file)=0;
virtual ~PackSource() {}
}; };
class PackedSourcePCK : public PackSource { class PackedSourcePCK : public PackSource {

View File

@ -31,6 +31,7 @@
#include "file_access_zip.h" #include "file_access_zip.h"
#include "core/os/file_access.h" #include "core/os/file_access.h"
#include "core/os/copymem.h"
ZipArchive* ZipArchive::instance = NULL; ZipArchive* ZipArchive::instance = NULL;
@ -103,9 +104,17 @@ static int godot_testerror(voidpf opaque, voidpf stream) {
return f->get_error()!=OK?1:0; return f->get_error()!=OK?1:0;
}; };
static voidpf godot_alloc(voidpf opaque, uInt items, uInt size) {
return memalloc(items * size);
}; };
static void godot_free(voidpf opaque, voidpf address) {
memfree(address);
};
}; // extern "C"
void ZipArchive::close_handle(unzFile p_file) const { void ZipArchive::close_handle(unzFile p_file) const {
@ -125,6 +134,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
ERR_FAIL_COND_V(!f, NULL); ERR_FAIL_COND_V(!f, NULL);
zlib_filefunc_def io; zlib_filefunc_def io;
zeromem(&io, sizeof(io));
io.opaque = f; io.opaque = f;
io.zopen_file = godot_open; io.zopen_file = godot_open;
@ -136,9 +146,13 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
io.zclose_file = godot_close; io.zclose_file = godot_close;
io.zerror_file = godot_testerror; io.zerror_file = godot_testerror;
io.alloc_mem = godot_alloc;
io.free_mem = godot_free;
unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io); unzFile pkg = unzOpen2(packages[file.package].filename.utf8().get_data(), &io);
ERR_FAIL_COND_V(!pkg, NULL); ERR_FAIL_COND_V(!pkg, NULL);
unzGoToFilePos(pkg, &file.file_pos); int unz_err = unzGoToFilePos(pkg, &file.file_pos);
ERR_FAIL_COND_V(unz_err != UNZ_OK, NULL);
if (unzOpenCurrentFile(pkg) != UNZ_OK) { if (unzOpenCurrentFile(pkg) != UNZ_OK) {
unzClose(pkg); unzClose(pkg);
@ -150,7 +164,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
bool ZipArchive::try_open_pack(const String& p_name) { bool ZipArchive::try_open_pack(const String& p_name) {
printf("opening pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz")); //printf("opening zip pack %ls, %i, %i\n", p_name.c_str(), p_name.extension().nocasecmp_to("zip"), p_name.extension().nocasecmp_to("pcz"));
if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0) if (p_name.extension().nocasecmp_to("zip") != 0 && p_name.extension().nocasecmp_to("pcz") != 0)
return false; return false;
@ -198,7 +212,8 @@ bool ZipArchive::try_open_pack(const String& p_name) {
files[fname] = f; files[fname] = f;
uint8_t md5[16]={0,0,0,0,0,0,0,0 , 0,0,0,0,0,0,0,0}; uint8_t md5[16]={0,0,0,0,0,0,0,0 , 0,0,0,0,0,0,0,0};
PackedData::get_singleton()->add_path(p_name, fname, 0, 0, md5, this); PackedData::get_singleton()->add_path(p_name, fname, 1, 0, md5, this);
//printf("packed data add path %ls, %ls\n", p_name.c_str(), fname.c_str());
if ((i+1)<gi.number_entry) { if ((i+1)<gi.number_entry) {
unzGoToNextFile(zfile); unzGoToNextFile(zfile);

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -325,7 +325,7 @@ Error HTTPClient::poll(){
if (i==0 && responses[i].begins_with("HTTP")) { if (i==0 && responses[i].begins_with("HTTP")) {
String num = responses[i].get_slice(" ",1); String num = responses[i].get_slicec(' ',1);
response_num=num.to_int(); response_num=num.to_int();
} else { } else {

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -183,7 +183,7 @@ void IP::erase_resolve_item(ResolverID p_id) {
GLOBAL_LOCK_FUNCTION; GLOBAL_LOCK_FUNCTION;
resolver->queue[p_id].status=IP::RESOLVER_STATUS_DONE; resolver->queue[p_id].status=IP::RESOLVER_STATUS_NONE;
} }

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */

View File

@ -5,7 +5,7 @@
/* GODOT ENGINE */ /* GODOT ENGINE */
/* http://www.godotengine.org */ /* http://www.godotengine.org */
/*************************************************************************/ /*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */ /* Copyright (c) 2007-2015 Juan Linietsky, Ariel Manzur. */
/* */ /* */
/* Permission is hereby granted, free of charge, to any person obtaining */ /* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */ /* a copy of this software and associated documentation files (the */
@ -47,7 +47,7 @@ IP_Address::IP_Address(const String& p_string) {
} }
for(int i=0;i<4;i++) { for(int i=0;i<4;i++) {
field[i]=p_string.get_slice(".",i).to_int(); field[i]=p_string.get_slicec('.',i).to_int();
} }
} }

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