Merge remote-tracking branch 'upstream/master'
2
.gitignore
vendored
@ -280,4 +280,4 @@ cscope.files
|
||||
cscope.out
|
||||
cscope.in.out
|
||||
cscope.po.out
|
||||
godot.creator.user.wd3476
|
||||
godot.creator.*
|
||||
|
2
LOGO_LICENSE.md
Normal 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
|
@ -109,6 +109,9 @@ public:
|
||||
frame->set_anchor( MARGIN_RIGHT, Control::ANCHOR_END );
|
||||
frame->set_anchor( MARGIN_BOTTOM, Control::ANCHOR_END );
|
||||
frame->set_end( Point2(0,0) );
|
||||
|
||||
Ref<Theme> t = memnew( Theme );
|
||||
frame->set_theme(t);
|
||||
|
||||
get_root()->add_child( frame );
|
||||
|
||||
|
@ -457,9 +457,9 @@ void _OS::set_icon(const Image& 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;
|
||||
dated["year"]=date.year;
|
||||
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;
|
||||
timed["hour"]=time.hour;
|
||||
timed["minute"]=time.min;
|
||||
@ -480,6 +480,15 @@ Dictionary _OS::get_time() const {
|
||||
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 {
|
||||
|
||||
return OS::get_singleton()->get_unix_time();
|
||||
@ -774,8 +783,9 @@ void _OS::_bind_methods() {
|
||||
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_date"),&_OS::get_date);
|
||||
ObjectTypeDB::bind_method(_MD("get_time"),&_OS::get_time);
|
||||
ObjectTypeDB::bind_method(_MD("get_date","utc"),&_OS::get_date,DEFVAL(false));
|
||||
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("set_icon"),&_OS::set_icon);
|
||||
|
@ -204,8 +204,9 @@ public:
|
||||
void set_use_file_access_save_and_swap(bool p_enable);
|
||||
|
||||
void set_icon(const Image& p_icon);
|
||||
Dictionary get_date() const;
|
||||
Dictionary get_time() const;
|
||||
Dictionary get_date(bool utc) const;
|
||||
Dictionary get_time(bool utc) const;
|
||||
Dictionary get_time_zone_info() const;
|
||||
uint64_t get_unix_time() const;
|
||||
|
||||
int get_static_memory_usage() const;
|
||||
|
@ -161,7 +161,7 @@ void Color::invert() {
|
||||
|
||||
r=1.0-r;
|
||||
g=1.0-g;
|
||||
g=1.0-b;
|
||||
b=1.0-b;
|
||||
}
|
||||
void Color::contrast() {
|
||||
|
||||
|
@ -34,6 +34,7 @@
|
||||
#include "os/mutex.h"
|
||||
#include "os/memory.h"
|
||||
#include "simple_type.h"
|
||||
#include "print_string.h"
|
||||
/**
|
||||
@author Juan Linietsky <reduzio@gmail.com>
|
||||
*/
|
||||
@ -174,7 +175,7 @@ class CommandQueueMT {
|
||||
R* ret;
|
||||
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>
|
||||
@ -675,6 +676,7 @@ public:
|
||||
|
||||
if (sync) sync->post();
|
||||
ss->sem->wait();
|
||||
print_line("wait");
|
||||
}
|
||||
|
||||
template<class T, class M, class P1, class P2,class R>
|
||||
|
@ -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!
|
||||
|
||||
//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) {
|
||||
|
||||
_load_settings("res://override.cfg");
|
||||
@ -1396,6 +1396,13 @@ Globals::Globals() {
|
||||
va.push_back(joyb);
|
||||
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();
|
||||
key.key.scancode=KEY_ESCAPE;
|
||||
va.push_back(key);
|
||||
@ -1460,6 +1467,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["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["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);
|
||||
|
||||
using_datapack=false;
|
||||
|
@ -1124,6 +1124,7 @@ void Image::create( const char ** p_xpm ) {
|
||||
}
|
||||
#define DETECT_ALPHA_MAX_TRESHOLD 254
|
||||
#define DETECT_ALPHA_MIN_TRESHOLD 2
|
||||
|
||||
#define DETECT_ALPHA( m_value )\
|
||||
{ \
|
||||
uint8_t value=m_value;\
|
||||
@ -1136,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 {
|
||||
|
||||
if (format==FORMAT_GRAYSCALE ||
|
||||
@ -1746,6 +1823,10 @@ Error Image::_decompress_bc() {
|
||||
return OK;
|
||||
}
|
||||
|
||||
bool Image::is_compressed() const {
|
||||
return format>=FORMAT_BC1;
|
||||
}
|
||||
|
||||
|
||||
Image Image::decompressed() const {
|
||||
|
||||
@ -1998,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_pvrtc2_func)(Image *)=NULL;
|
||||
void (*Image::_image_compress_pvrtc4_func)(Image *)=NULL;
|
||||
@ -2167,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;
|
||||
height=0;
|
||||
@ -2175,7 +2256,7 @@ Image::Image(const uint8_t* p_png) {
|
||||
format=FORMAT_GRAYSCALE;
|
||||
|
||||
if (_png_mem_loader_func) {
|
||||
*this = _png_mem_loader_func(p_png);
|
||||
*this = _png_mem_loader_func(p_png,p_len);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ public:
|
||||
/* 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_pvrtc2_func)(Image *);
|
||||
static void (*_image_compress_pvrtc4_func)(Image *);
|
||||
@ -305,6 +305,7 @@ public:
|
||||
};
|
||||
|
||||
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);
|
||||
uint8_t get_indexed_pixel(int p_x, int p_y,int p_mipmap=0) const;
|
||||
@ -335,6 +336,7 @@ public:
|
||||
Image compressed(int p_mode); /* from the Image::CompressMode enum */
|
||||
Error decompress();
|
||||
Image decompressed() const;
|
||||
bool is_compressed() const;
|
||||
|
||||
void fix_alpha_edges();
|
||||
void premultiply_alpha();
|
||||
@ -349,7 +351,7 @@ public:
|
||||
Image get_rect(const Rect2& p_area) const;
|
||||
|
||||
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();
|
||||
|
||||
|
@ -74,6 +74,14 @@ bool FileAccessMemory::file_exists(const String& p_name) {
|
||||
}
|
||||
|
||||
|
||||
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) {
|
||||
|
||||
ERR_FAIL_COND_V(!files, ERR_FILE_NOT_FOUND);
|
||||
|
@ -44,6 +44,7 @@ public:
|
||||
static void register_file(String p_name, Vector<uint8_t> p_data);
|
||||
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 void close(); ///< close a file
|
||||
virtual bool is_open() const; ///< true when file is open
|
||||
|
@ -31,6 +31,7 @@
|
||||
#include "file_access_zip.h"
|
||||
|
||||
#include "core/os/file_access.h"
|
||||
#include "core/os/copymem.h"
|
||||
|
||||
ZipArchive* ZipArchive::instance = NULL;
|
||||
|
||||
@ -103,9 +104,17 @@ static int godot_testerror(voidpf opaque, voidpf stream) {
|
||||
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 {
|
||||
|
||||
@ -125,6 +134,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
|
||||
ERR_FAIL_COND_V(!f, NULL);
|
||||
|
||||
zlib_filefunc_def io;
|
||||
zeromem(&io, sizeof(io));
|
||||
|
||||
io.opaque = f;
|
||||
io.zopen_file = godot_open;
|
||||
@ -136,9 +146,13 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
|
||||
io.zclose_file = godot_close;
|
||||
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);
|
||||
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) {
|
||||
|
||||
unzClose(pkg);
|
||||
@ -150,7 +164,7 @@ unzFile ZipArchive::get_file_handle(String p_file) const {
|
||||
|
||||
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)
|
||||
return false;
|
||||
|
||||
@ -198,7 +212,8 @@ bool ZipArchive::try_open_pack(const String& p_name) {
|
||||
files[fname] = f;
|
||||
|
||||
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) {
|
||||
unzGoToNextFile(zfile);
|
||||
|
@ -36,7 +36,7 @@
|
||||
|
||||
PacketPeer::PacketPeer() {
|
||||
|
||||
|
||||
last_get_error=OK;
|
||||
}
|
||||
|
||||
Error PacketPeer::get_packet_buffer(DVector<uint8_t> &r_buffer) const {
|
||||
@ -108,10 +108,29 @@ Variant PacketPeer::_bnd_get_var() const {
|
||||
return var;
|
||||
};
|
||||
|
||||
Error PacketPeer::_put_packet(const DVector<uint8_t> &p_buffer) {
|
||||
return put_packet_buffer(p_buffer);
|
||||
}
|
||||
DVector<uint8_t> PacketPeer::_get_packet() const {
|
||||
|
||||
DVector<uint8_t> raw;
|
||||
last_get_error=get_packet_buffer(raw);
|
||||
return raw;
|
||||
}
|
||||
|
||||
Error PacketPeer::_get_packet_error() const {
|
||||
|
||||
return last_get_error;
|
||||
}
|
||||
|
||||
|
||||
void PacketPeer::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_var"),&PacketPeer::_bnd_get_var);
|
||||
ObjectTypeDB::bind_method(_MD("put_var", "var:var"),&PacketPeer::put_var);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet"),&PacketPeer::_get_packet);
|
||||
ObjectTypeDB::bind_method(_MD("put_packet:Error", "buffer"),&PacketPeer::_put_packet);
|
||||
ObjectTypeDB::bind_method(_MD("get_packet_error:Error"),&PacketPeer::_get_packet_error);
|
||||
ObjectTypeDB::bind_method(_MD("get_available_packet_count"),&PacketPeer::get_available_packet_count);
|
||||
};
|
||||
|
||||
|
@ -41,6 +41,14 @@ class PacketPeer : public Reference {
|
||||
|
||||
static void _bind_methods();
|
||||
|
||||
|
||||
Error _put_packet(const DVector<uint8_t> &p_buffer);
|
||||
DVector<uint8_t> _get_packet() const;
|
||||
Error _get_packet_error() const;
|
||||
|
||||
|
||||
mutable Error last_get_error;
|
||||
|
||||
public:
|
||||
|
||||
virtual int get_available_packet_count() const=0;
|
||||
|
@ -214,6 +214,7 @@ RES ResourceLoader::load(const String &p_path,const String& p_type_hint,bool p_n
|
||||
Ref<ResourceImportMetadata> ResourceLoader::load_import_metadata(const String &p_path) {
|
||||
|
||||
|
||||
|
||||
String local_path;
|
||||
if (p_path.is_rel_path())
|
||||
local_path="res://"+p_path;
|
||||
|
@ -226,6 +226,29 @@ struct Rect2 {
|
||||
return true;
|
||||
}
|
||||
|
||||
inline float distance_to(const Vector2& p_point) const {
|
||||
|
||||
float dist = 1e20;
|
||||
|
||||
if (p_point.x < pos.x) {
|
||||
dist=MIN(dist,pos.x-p_point.x);
|
||||
}
|
||||
if (p_point.y < pos.y) {
|
||||
dist=MIN(dist,pos.y-p_point.y);
|
||||
}
|
||||
if (p_point.x >= (pos.x+size.x) ) {
|
||||
dist=MIN(p_point.x-(pos.x+size.x),dist);
|
||||
}
|
||||
if (p_point.y >= (pos.y+size.y) ) {
|
||||
dist=MIN(p_point.y-(pos.y+size.y),dist);
|
||||
}
|
||||
|
||||
if (dist==1e20)
|
||||
return 0;
|
||||
else
|
||||
return dist;
|
||||
}
|
||||
|
||||
_FORCE_INLINE_ bool intersects_transformed(const Matrix32& p_xform, const Rect2& p_rect) const;
|
||||
|
||||
bool intersects_segment(const Point2& p_from, const Point2& p_to, Point2* r_pos=NULL, Point2* r_normal=NULL) const;
|
||||
|
@ -324,6 +324,7 @@ int MessageQueue::get_max_buffer_usage() const {
|
||||
|
||||
void MessageQueue::flush() {
|
||||
|
||||
|
||||
if (buffer_max_used<buffer_end); {
|
||||
buffer_max_used=buffer_end;
|
||||
//statistics();
|
||||
@ -331,9 +332,14 @@ void MessageQueue::flush() {
|
||||
|
||||
uint32_t read_pos=0;
|
||||
|
||||
while (read_pos < buffer_end ) {
|
||||
//using reverse locking strategy
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
while (read_pos<buffer_end) {
|
||||
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
|
||||
//lock on each interation, so a call can re-add itself to the message queue
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
Message *message = (Message*)&buffer[ read_pos ];
|
||||
|
||||
@ -379,16 +385,17 @@ void MessageQueue::flush() {
|
||||
|
||||
}
|
||||
|
||||
read_pos+=sizeof(Message);
|
||||
uint32_t advance = sizeof(Message);
|
||||
if (message->type!=TYPE_NOTIFICATION)
|
||||
read_pos+=sizeof(Variant)*message->args;
|
||||
advance+=sizeof(Variant)*message->args;
|
||||
message->~Message();
|
||||
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
_THREAD_SAFE_LOCK_
|
||||
read_pos+=advance;
|
||||
|
||||
}
|
||||
|
||||
_THREAD_SAFE_LOCK_
|
||||
|
||||
buffer_end=0; // reset buffer
|
||||
_THREAD_SAFE_UNLOCK_
|
||||
|
||||
|
@ -995,12 +995,44 @@ Variant Object::get_meta(const String& p_name) const {
|
||||
return metadata[p_name];
|
||||
}
|
||||
|
||||
|
||||
Array Object::_get_property_list_bind() const {
|
||||
|
||||
List<PropertyInfo> lpi;
|
||||
get_property_list(&lpi);
|
||||
return convert_property_list(&lpi);
|
||||
}
|
||||
|
||||
Array Object::_get_method_list_bind() const {
|
||||
|
||||
List<MethodInfo> ml;
|
||||
get_method_list(&ml);
|
||||
Array ret;
|
||||
|
||||
for(List<MethodInfo>::Element *E=ml.front();E;E=E->next()) {
|
||||
|
||||
Dictionary d;
|
||||
d["name"]=E->get().name;
|
||||
d["args"]=convert_property_list(&E->get().arguments);
|
||||
Array da;
|
||||
for(int i=0;i<E->get().default_arguments.size();i++)
|
||||
da.push_back(E->get().default_arguments[i]);
|
||||
d["default_args"]=da;
|
||||
d["flags"]=E->get().flags;
|
||||
d["id"]=E->get().id;
|
||||
Dictionary r;
|
||||
r["type"]=E->get().return_val.type;
|
||||
r["hint"]=E->get().return_val.hint;
|
||||
r["hint_string"]=E->get().return_val.hint_string;
|
||||
d["return_type"]=r;
|
||||
//va.push_back(d);
|
||||
ret.push_back(d);
|
||||
}
|
||||
|
||||
return ret;
|
||||
|
||||
}
|
||||
|
||||
DVector<String> Object::_get_meta_list_bind() const {
|
||||
|
||||
DVector<String> _metaret;
|
||||
@ -1319,7 +1351,7 @@ Error Object::connect(const StringName& p_signal, Object *p_to_object, const Str
|
||||
if (!s) {
|
||||
bool signal_is_valid = ObjectTypeDB::has_signal(get_type_name(),p_signal);
|
||||
if (!signal_is_valid) {
|
||||
ERR_EXPLAIN("Attempt to connect to nonexistent signal: "+p_signal);
|
||||
ERR_EXPLAIN("Attempt to connect nonexistent signal '"+p_signal+"' to method '"+p_to_method+"'");
|
||||
ERR_FAIL_COND_V(!signal_is_valid,ERR_INVALID_PARAMETER);
|
||||
}
|
||||
signal_map[p_signal]=Signal();
|
||||
@ -1439,6 +1471,7 @@ void Object::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set","property","value"),&Object::_set_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get","property"),&Object::_get_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get_property_list"),&Object::_get_property_list_bind);
|
||||
ObjectTypeDB::bind_method(_MD("get_method_list"),&Object::_get_method_list_bind);
|
||||
ObjectTypeDB::bind_method(_MD("notification","what"),&Object::notification,DEFVAL(false));
|
||||
ObjectTypeDB::bind_method(_MD("get_instance_ID"),&Object::get_instance_ID);
|
||||
|
||||
|
@ -54,6 +54,7 @@ enum PropertyHint {
|
||||
PROPERTY_HINT_ENUM, ///< hint_text= "val1,val2,val3,etc"
|
||||
PROPERTY_HINT_EXP_EASING, /// exponential easing funciton (Math::ease)
|
||||
PROPERTY_HINT_LENGTH, ///< hint_text= "length" (as integer)
|
||||
PROPERTY_HINT_SPRITE_FRAME,
|
||||
PROPERTY_HINT_KEY_ACCEL, ///< hint_text= "length" (as integer)
|
||||
PROPERTY_HINT_FLAGS, ///< hint_text= "flag1,flag2,etc" (as bit flags)
|
||||
PROPERTY_HINT_ALL_FLAGS,
|
||||
@ -448,6 +449,7 @@ protected:
|
||||
|
||||
DVector<String> _get_meta_list_bind() const;
|
||||
Array _get_property_list_bind() const;
|
||||
Array _get_method_list_bind() const;
|
||||
|
||||
public: //should be protected, but bug in clang++
|
||||
static void initialize_type();
|
||||
|
@ -31,7 +31,20 @@
|
||||
|
||||
void MainLoop::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method("input_event",&MainLoop::input_event);
|
||||
ObjectTypeDB::bind_method(_MD("input_event","ev"),&MainLoop::input_event);
|
||||
ObjectTypeDB::bind_method(_MD("input_text","text"),&MainLoop::input_text);
|
||||
ObjectTypeDB::bind_method(_MD("init"),&MainLoop::init);
|
||||
ObjectTypeDB::bind_method(_MD("iteration","delta"),&MainLoop::iteration);
|
||||
ObjectTypeDB::bind_method(_MD("idle","delta"),&MainLoop::idle);
|
||||
ObjectTypeDB::bind_method(_MD("finish"),&MainLoop::finish);
|
||||
|
||||
BIND_VMETHOD( MethodInfo("_input_event",PropertyInfo(Variant::INPUT_EVENT,"ev")) );
|
||||
BIND_VMETHOD( MethodInfo("_input_text",PropertyInfo(Variant::STRING,"text")) );
|
||||
BIND_VMETHOD( MethodInfo("_initialize") );
|
||||
BIND_VMETHOD( MethodInfo("_iteration",PropertyInfo(Variant::REAL,"delta")) );
|
||||
BIND_VMETHOD( MethodInfo("_idle",PropertyInfo(Variant::REAL,"delta")) );
|
||||
BIND_VMETHOD( MethodInfo("_finalize") );
|
||||
|
||||
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_IN);
|
||||
BIND_CONSTANT(NOTIFICATION_WM_FOCUS_OUT);
|
||||
@ -58,13 +71,15 @@ MainLoop::~MainLoop()
|
||||
|
||||
void MainLoop::input_text( const String& p_text ) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("_input_text",p_text);
|
||||
|
||||
}
|
||||
|
||||
void MainLoop::input_event( const InputEvent& p_event ) {
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("input_event",p_event);
|
||||
get_script_instance()->call("_input_event",p_event);
|
||||
|
||||
}
|
||||
|
||||
@ -74,13 +89,13 @@ void MainLoop::init() {
|
||||
set_script(init_script.get_ref_ptr());
|
||||
|
||||
if (get_script_instance())
|
||||
get_script_instance()->call("init");
|
||||
get_script_instance()->call("_initialize");
|
||||
|
||||
}
|
||||
bool MainLoop::iteration(float p_time) {
|
||||
|
||||
if (get_script_instance())
|
||||
return get_script_instance()->call("iteration",p_time);
|
||||
return get_script_instance()->call("_iteration",p_time);
|
||||
|
||||
return false;
|
||||
|
||||
@ -88,14 +103,14 @@ bool MainLoop::iteration(float p_time) {
|
||||
bool MainLoop::idle(float p_time) {
|
||||
|
||||
if (get_script_instance())
|
||||
return get_script_instance()->call("idle",p_time);
|
||||
return get_script_instance()->call("_idle",p_time);
|
||||
|
||||
return false;
|
||||
}
|
||||
void MainLoop::finish() {
|
||||
|
||||
if (get_script_instance()) {
|
||||
get_script_instance()->call("finish");
|
||||
get_script_instance()->call("_finalize");
|
||||
set_script(RefPtr()); //clear script
|
||||
}
|
||||
|
||||
|
@ -112,13 +112,6 @@ size_t Memory::get_dynamic_mem_usage() {
|
||||
return MemoryPoolDynamic::get_singleton()->get_total_usage();
|
||||
}
|
||||
|
||||
void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) {
|
||||
|
||||
void *failptr=0;
|
||||
ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */
|
||||
|
||||
return p_pointer;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
@ -236,11 +236,11 @@ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_de
|
||||
#endif
|
||||
|
||||
|
||||
_FORCE_INLINE_ void postinitialize_handler(void *) {}
|
||||
_ALWAYS_INLINE_ void postinitialize_handler(void *) {}
|
||||
|
||||
|
||||
template<class T>
|
||||
_FORCE_INLINE_ T *_post_initialize(T *p_obj) {
|
||||
_ALWAYS_INLINE_ T *_post_initialize(T *p_obj) {
|
||||
|
||||
postinitialize_handler(p_obj);
|
||||
return p_obj;
|
||||
@ -249,19 +249,26 @@ _FORCE_INLINE_ T *_post_initialize(T *p_obj) {
|
||||
#ifdef DEBUG_MEMORY_ENABLED
|
||||
|
||||
#define memnew(m_class) _post_initialize(new(__FILE__":"__STR(__LINE__)", memnew type: "__STR(m_class)) m_class)
|
||||
#define memnew_placement(m_placement,m_class) _post_initialize(new(m_placement,sizeof(m_class),__FILE__":"__STR(__LINE__)", type: "__STR(m_class)) m_class)
|
||||
|
||||
#else
|
||||
|
||||
#define memnew(m_class) _post_initialize(new("") m_class)
|
||||
#define memnew_placement(m_placement,m_class) _post_initialize(new(m_placement,sizeof(m_class),"") m_class)
|
||||
|
||||
#endif
|
||||
|
||||
_ALWAYS_INLINE_ void * operator new(size_t p_size,void *p_pointer,size_t check, const char *p_description) {
|
||||
// void *failptr=0;
|
||||
// ERR_FAIL_COND_V( check < p_size , failptr); /** bug, or strange compiler, most likely */
|
||||
|
||||
return p_pointer;
|
||||
}
|
||||
|
||||
|
||||
#define memnew_allocator(m_class,m_allocator) _post_initialize(new(m_allocator::alloc) m_class)
|
||||
#define memnew_placement(m_placement,m_class) _post_initialize(new(m_placement,sizeof(m_class),"") m_class)
|
||||
|
||||
|
||||
_FORCE_INLINE_ bool predelete_handler(void *) { return true; }
|
||||
_ALWAYS_INLINE_ bool predelete_handler(void *) { return true; }
|
||||
|
||||
template<class T>
|
||||
void memdelete(T *p_class) {
|
||||
|
12
core/os/os.h
@ -244,9 +244,15 @@ public:
|
||||
int min;
|
||||
int sec;
|
||||
};
|
||||
|
||||
virtual Date get_date() const=0;
|
||||
virtual Time get_time() const=0;
|
||||
|
||||
struct TimeZoneInfo {
|
||||
int bias;
|
||||
String name;
|
||||
};
|
||||
|
||||
virtual Date get_date(bool local=false) const=0;
|
||||
virtual Time get_time(bool local=false) const=0;
|
||||
virtual TimeZoneInfo get_time_zone_info() const=0;
|
||||
virtual uint64_t get_unix_time() const;
|
||||
|
||||
virtual void delay_usec(uint32_t p_usec) const=0;
|
||||
|
@ -294,6 +294,9 @@ public:
|
||||
reference=NULL;
|
||||
}
|
||||
|
||||
void instance() {
|
||||
ref( memnew( T ));
|
||||
}
|
||||
|
||||
Ref() {
|
||||
|
||||
|
@ -302,8 +302,8 @@ bool Variant::can_convert(Variant::Type p_type_from,Variant::Type p_type_to) {
|
||||
case COLOR: {
|
||||
|
||||
static const Type valid[] = {
|
||||
//STRING,
|
||||
//INT,
|
||||
STRING,
|
||||
INT,
|
||||
NIL,
|
||||
};
|
||||
|
||||
@ -1653,6 +1653,10 @@ Variant::operator Color() const {
|
||||
|
||||
if (type==COLOR)
|
||||
return *reinterpret_cast<const Color*>(_data._mem);
|
||||
else if (type==STRING)
|
||||
return Color::html( operator String() );
|
||||
else if (type==INT)
|
||||
return Color::hex( operator int() );
|
||||
else
|
||||
return Color();
|
||||
}
|
||||
|
@ -285,6 +285,36 @@ static void _call_##m_type##_##m_method(Variant& r_ret,Variant& p_self,const Var
|
||||
VCALL_LOCALMEM1R(String,pad_decimals);
|
||||
VCALL_LOCALMEM1R(String,pad_zeros);
|
||||
|
||||
static void _call_String_to_ascii(Variant& r_ret,Variant& p_self,const Variant** p_args) {
|
||||
|
||||
String *s = reinterpret_cast<String*>(p_self._data._mem);
|
||||
CharString charstr = s->ascii();
|
||||
|
||||
ByteArray retval;
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
ByteArray::Write w = retval.write();
|
||||
copymem(w.ptr(), charstr.ptr(), len);
|
||||
w = DVector<uint8_t>::Write();
|
||||
|
||||
r_ret = retval;
|
||||
}
|
||||
|
||||
static void _call_String_to_utf8(Variant& r_ret,Variant& p_self,const Variant** p_args) {
|
||||
|
||||
String *s = reinterpret_cast<String*>(p_self._data._mem);
|
||||
CharString charstr = s->utf8();
|
||||
|
||||
ByteArray retval;
|
||||
size_t len = charstr.length();
|
||||
retval.resize(len);
|
||||
ByteArray::Write w = retval.write();
|
||||
copymem(w.ptr(), charstr.ptr(), len);
|
||||
w = DVector<uint8_t>::Write();
|
||||
|
||||
r_ret = retval;
|
||||
}
|
||||
|
||||
|
||||
VCALL_LOCALMEM0R(Vector2,normalized);
|
||||
VCALL_LOCALMEM0R(Vector2,length);
|
||||
@ -1215,9 +1245,10 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC0(STRING,STRING,String,capitalize,varray());
|
||||
ADDFUNC2(STRING,STRING_ARRAY,String,split,STRING,"divisor",BOOL,"allow_empty",varray(true));
|
||||
ADDFUNC2(STRING,REAL_ARRAY,String,split_floats,STRING,"divisor",BOOL,"allow_empty",varray(true));
|
||||
ADDFUNC0(STRING,STRING,String,to_upper,varray());
|
||||
|
||||
ADDFUNC0(STRING,STRING,String,to_upper,varray());
|
||||
ADDFUNC0(STRING,STRING,String,to_lower,varray());
|
||||
|
||||
ADDFUNC1(STRING,STRING,String,left,INT,"pos",varray());
|
||||
ADDFUNC1(STRING,STRING,String,right,INT,"pos",varray());
|
||||
ADDFUNC0(STRING,STRING,String,strip_edges,varray());
|
||||
@ -1249,6 +1280,10 @@ _VariantCall::addfunc(Variant::m_vtype,Variant::m_ret,_SCS(#m_method),VCALL(m_cl
|
||||
ADDFUNC1(STRING,STRING,String,pad_decimals,INT,"digits",varray());
|
||||
ADDFUNC1(STRING,STRING,String,pad_zeros,INT,"digits",varray());
|
||||
|
||||
ADDFUNC0(STRING,STRING,String,to_ascii,varray());
|
||||
ADDFUNC0(STRING,STRING,String,to_utf8,varray());
|
||||
|
||||
|
||||
ADDFUNC0(VECTOR2,VECTOR2,Vector2,normalized,varray());
|
||||
ADDFUNC0(VECTOR2,REAL,Vector2,length,varray());
|
||||
ADDFUNC0(VECTOR2,REAL,Vector2,atan2,varray());
|
||||
|
@ -104,7 +104,7 @@ public:
|
||||
|
||||
|
||||
template <class T_val>
|
||||
int find(T_val& p_val) const;
|
||||
int find(const T_val& p_val) const;
|
||||
|
||||
void set(int p_index,T p_elem);
|
||||
T get(int p_index) const;
|
||||
@ -221,7 +221,7 @@ void Vector<T>::_copy_on_write() {
|
||||
}
|
||||
|
||||
template<class T> template<class T_val>
|
||||
int Vector<T>::find(T_val& p_val) const {
|
||||
int Vector<T>::find(const T_val &p_val) const {
|
||||
|
||||
int ret = -1;
|
||||
if (size() == 0)
|
||||
|
@ -2,3 +2,13 @@
|
||||
|
||||
name="Motion Test"
|
||||
main_scene="res://motion.scn"
|
||||
|
||||
<<<<<<< HEAD
|
||||
=======
|
||||
[display]
|
||||
|
||||
width=800
|
||||
height=600
|
||||
stretch_mode="2d"
|
||||
stretch_aspect="keep"
|
||||
>>>>>>> ab99671bb835a5fe24a092ec34afe1ad862ac254
|
||||
|
49
demos/2d/space_shooter/asteroid.gd
Normal file
@ -0,0 +1,49 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const SPEED=-200
|
||||
const Y_RANDOM=10
|
||||
|
||||
var points=1
|
||||
|
||||
|
||||
var speed_y=0.0
|
||||
|
||||
func _process(delta):
|
||||
|
||||
translate( Vector2(SPEED,speed_y) * delta )
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
speed_y=rand_range(-Y_RANDOM,Y_RANDOM)
|
||||
pass
|
||||
|
||||
var destroyed=false
|
||||
|
||||
func destroy():
|
||||
if (destroyed):
|
||||
return
|
||||
destroyed=true
|
||||
get_node("anim").play("explode")
|
||||
set_process(false)
|
||||
get_node("sfx").play("sound_explode")
|
||||
#accum points
|
||||
get_node("/root/game_state").points+=1
|
||||
|
||||
func is_enemy():
|
||||
return not destroyed
|
||||
|
||||
|
||||
func _on_visibility_enter_screen():
|
||||
set_process(true)
|
||||
#make it spin!
|
||||
get_node("anim").play("spin")
|
||||
|
||||
|
||||
func _on_visibility_exit_screen():
|
||||
queue_free()
|
||||
pass # replace with function body
|
BIN
demos/2d/space_shooter/asteroid.scn
Normal file
BIN
demos/2d/space_shooter/bg_gradient.png
Normal file
After Width: | Height: | Size: 1.5 KiB |
BIN
demos/2d/space_shooter/big_star.png
Normal file
After Width: | Height: | Size: 275 B |
37
demos/2d/space_shooter/enemy1.gd
Normal file
@ -0,0 +1,37 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const SPEED=-200
|
||||
|
||||
func _process(delta):
|
||||
get_parent().translate(Vector2(SPEED*delta,0))
|
||||
|
||||
|
||||
var destroyed=false
|
||||
|
||||
func is_enemy():
|
||||
return not destroyed
|
||||
|
||||
|
||||
func destroy():
|
||||
if (destroyed):
|
||||
return
|
||||
destroyed=true
|
||||
get_node("anim").play("explode")
|
||||
set_process(false)
|
||||
get_node("sfx").play("sound_explode")
|
||||
#accum points
|
||||
get_node("/root/game_state").points+=5
|
||||
|
||||
func _on_visibility_enter_screen():
|
||||
set_process(true)
|
||||
get_node("anim").play("zigzag")
|
||||
get_node("anim").seek(randf()*2.0) #make it start from any pos
|
||||
|
||||
func _on_visibility_exit_screen():
|
||||
queue_free()
|
||||
|
BIN
demos/2d/space_shooter/enemy1.png
Normal file
After Width: | Height: | Size: 6.9 KiB |
BIN
demos/2d/space_shooter/enemy1.scn
Normal file
56
demos/2d/space_shooter/enemy2.gd
Normal file
@ -0,0 +1,56 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
const SPEED=-220
|
||||
const SHOOT_INTERVAL=1
|
||||
var shoot_timeout=0
|
||||
|
||||
func _process(delta):
|
||||
translate( Vector2(SPEED*delta,0) )
|
||||
shoot_timeout-=delta
|
||||
|
||||
if (shoot_timeout<0):
|
||||
|
||||
shoot_timeout=SHOOT_INTERVAL
|
||||
|
||||
#instance a shot
|
||||
var shot = preload("res://enemy_shot.scn").instance()
|
||||
#set pos as "shoot_from" Position2D node
|
||||
shot.set_pos( get_node("shoot_from").get_global_pos() )
|
||||
#add it to parent, so it has world coordinates
|
||||
get_parent().add_child(shot)
|
||||
|
||||
var destroyed=false
|
||||
|
||||
func is_enemy():
|
||||
return not destroyed
|
||||
|
||||
func destroy():
|
||||
if (destroyed):
|
||||
return
|
||||
destroyed=true
|
||||
get_node("anim").play("explode")
|
||||
set_process(false)
|
||||
get_node("sfx").play("sound_explode")
|
||||
#accum points
|
||||
get_node("/root/game_state").points+=10
|
||||
|
||||
func _ready():
|
||||
set_fixed_process(true)
|
||||
# Initialization here
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_visibility_enter_screen():
|
||||
set_process(true)
|
||||
pass # replace with function body
|
||||
|
||||
|
||||
func _on_visibility_exit_screen():
|
||||
queue_free()
|
||||
pass # replace with function body
|
BIN
demos/2d/space_shooter/enemy2.png
Normal file
After Width: | Height: | Size: 5.5 KiB |
BIN
demos/2d/space_shooter/enemy2.scn
Normal file
32
demos/2d/space_shooter/enemy_shot.gd
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const SPEED = -800
|
||||
|
||||
func _process(delta):
|
||||
translate(Vector2(delta*SPEED,0))
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
set_process(true)
|
||||
|
||||
|
||||
var hit=false
|
||||
|
||||
func is_enemy():
|
||||
return true
|
||||
|
||||
func _hit_something():
|
||||
if (hit):
|
||||
return
|
||||
hit=true
|
||||
set_process(false)
|
||||
get_node("anim").play("splash")
|
||||
|
||||
func _on_visibility_exit_screen():
|
||||
queue_free()
|
||||
|
BIN
demos/2d/space_shooter/enemy_shot.png
Normal file
After Width: | Height: | Size: 330 B |
BIN
demos/2d/space_shooter/enemy_shot.scn
Normal file
22
demos/2d/space_shooter/engine.cfg
Normal file
@ -0,0 +1,22 @@
|
||||
[application]
|
||||
|
||||
name="Simple Shooter"
|
||||
main_scene="res://main_menu.scn"
|
||||
icon="res://icon.png"
|
||||
|
||||
[autoload]
|
||||
|
||||
game_state="res://game_state.gd"
|
||||
|
||||
[display]
|
||||
|
||||
width=1024
|
||||
height=600
|
||||
|
||||
[input]
|
||||
|
||||
move_up=[key(Up)]
|
||||
move_down=[key(Down)]
|
||||
move_left=[key(Left)]
|
||||
move_right=[key(Right)]
|
||||
shoot=[key(Space)]
|
BIN
demos/2d/space_shooter/explosion.scn
Normal file
BIN
demos/2d/space_shooter/fire.png
Normal file
After Width: | Height: | Size: 357 B |
24
demos/2d/space_shooter/game_state.gd
Normal file
@ -0,0 +1,24 @@
|
||||
extends Node
|
||||
|
||||
|
||||
var points = 0
|
||||
var max_points = 0
|
||||
|
||||
|
||||
func _ready():
|
||||
var f = File.new()
|
||||
#load high score
|
||||
if (f.open("user://highscore",File.READ)==OK):
|
||||
|
||||
max_points=f.get_var()
|
||||
|
||||
|
||||
|
||||
func game_over():
|
||||
if (points>max_points):
|
||||
max_points=points
|
||||
#save high score
|
||||
var f = File.new()
|
||||
f.open("user://highscore",File.WRITE)
|
||||
f.store_var(max_points)
|
||||
|
BIN
demos/2d/space_shooter/icon.png
Normal file
After Width: | Height: | Size: 6.8 KiB |
BIN
demos/2d/space_shooter/level.scn
Normal file
BIN
demos/2d/space_shooter/level_tiles.res
Normal file
BIN
demos/2d/space_shooter/level_tiles.scn
Normal file
20
demos/2d/space_shooter/main_menu.gd
Normal file
@ -0,0 +1,20 @@
|
||||
|
||||
extends Control
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
func _ready():
|
||||
|
||||
get_node("score").set_text( "HIGH SCORE: "+str( get_node("/root/game_state").max_points ) )
|
||||
# Initialization here
|
||||
pass
|
||||
|
||||
|
||||
|
||||
|
||||
func _on_play_pressed():
|
||||
get_node("/root/game_state").points=0
|
||||
get_tree().change_scene("res://level.scn")
|
||||
pass # replace with function body
|
BIN
demos/2d/space_shooter/main_menu.scn
Normal file
BIN
demos/2d/space_shooter/meteorite.png
Normal file
After Width: | Height: | Size: 5.9 KiB |
BIN
demos/2d/space_shooter/parallax.scn
Normal file
26
demos/2d/space_shooter/rail.gd
Normal file
@ -0,0 +1,26 @@
|
||||
|
||||
extends Node2D
|
||||
|
||||
|
||||
const SPEED=200
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
func stop():
|
||||
set_process(false)
|
||||
|
||||
var offset=0
|
||||
|
||||
|
||||
func _process(delta):
|
||||
|
||||
offset+=delta*SPEED
|
||||
set_pos(Vector2(offset,0))
|
||||
|
||||
func _ready():
|
||||
set_process(true)
|
||||
# Initialization here
|
||||
|
||||
|
||||
|
88
demos/2d/space_shooter/ship.gd
Normal file
@ -0,0 +1,88 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const SPEED = 200
|
||||
|
||||
var screen_size
|
||||
|
||||
var prev_shooting=false
|
||||
|
||||
func _process(delta):
|
||||
|
||||
var motion = Vector2()
|
||||
if Input.is_action_pressed("move_up"):
|
||||
motion+=Vector2(0,-1)
|
||||
if Input.is_action_pressed("move_down"):
|
||||
motion+=Vector2(0,1)
|
||||
if Input.is_action_pressed("move_left"):
|
||||
motion+=Vector2(-1,0)
|
||||
if Input.is_action_pressed("move_right"):
|
||||
motion+=Vector2(1,0)
|
||||
var shooting = Input.is_action_pressed("shoot")
|
||||
|
||||
var pos = get_pos()
|
||||
|
||||
pos+=motion*delta*SPEED
|
||||
if (pos.x<0):
|
||||
pos.x=0
|
||||
if (pos.x>screen_size.x):
|
||||
pos.x=screen_size.x
|
||||
if (pos.y<0):
|
||||
pos.y=0
|
||||
if (pos.y>screen_size.y):
|
||||
pos.y=screen_size.y
|
||||
|
||||
set_pos(pos)
|
||||
|
||||
if (shooting and not prev_shooting):
|
||||
# just pressed
|
||||
var shot = preload("res://shot.scn").instance()
|
||||
#use the position3d as reference
|
||||
shot.set_pos( get_node("shootfrom").get_global_pos() )
|
||||
#put it two parents above, so it is not moved by us
|
||||
get_node("../..").add_child(shot)
|
||||
#play sound
|
||||
get_node("sfx").play("shoot")
|
||||
|
||||
|
||||
prev_shooting = shooting
|
||||
|
||||
#update points counter
|
||||
get_node("../hud/score_points").set_text( str(get_node("/root/game_state").points) )
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
screen_size = get_viewport().get_rect().size
|
||||
set_process(true)
|
||||
pass
|
||||
|
||||
var killed=false
|
||||
|
||||
func _hit_something():
|
||||
if (killed):
|
||||
return
|
||||
killed=true
|
||||
get_node("anim").play("explode")
|
||||
get_node("sfx").play("sound_explode")
|
||||
get_node("../hud/game_over").show()
|
||||
get_node("/root/game_state").game_over()
|
||||
get_parent().stop()
|
||||
set_process(false)
|
||||
|
||||
|
||||
func _on_ship_body_enter( body ):
|
||||
_hit_something()
|
||||
|
||||
|
||||
func _on_ship_area_enter( area ):
|
||||
if (area.has_method("is_enemy") and area.is_enemy()):
|
||||
_hit_something()
|
||||
|
||||
|
||||
func _on_back_to_menu_pressed():
|
||||
get_tree().change_scene("res://main_menu.scn")
|
||||
pass # replace with function body
|
BIN
demos/2d/space_shooter/ship.png
Normal file
After Width: | Height: | Size: 2.7 KiB |
BIN
demos/2d/space_shooter/ship.scn
Normal file
BIN
demos/2d/space_shooter/shoot.png
Normal file
After Width: | Height: | Size: 222 B |
47
demos/2d/space_shooter/shot.gd
Normal file
@ -0,0 +1,47 @@
|
||||
|
||||
extends Area2D
|
||||
|
||||
# member variables here, example:
|
||||
# var a=2
|
||||
# var b="textvar"
|
||||
|
||||
const SPEED = 800
|
||||
|
||||
func _process(delta):
|
||||
translate(Vector2(delta*SPEED,0))
|
||||
|
||||
func _ready():
|
||||
# Initialization here
|
||||
set_process(true)
|
||||
pass
|
||||
|
||||
var hit=false
|
||||
|
||||
func _hit_something():
|
||||
if (hit):
|
||||
return
|
||||
hit=true
|
||||
set_process(false)
|
||||
get_node("anim").play("splash")
|
||||
|
||||
func _on_visibility_exit_screen():
|
||||
queue_free()
|
||||
pass # replace with function body
|
||||
|
||||
|
||||
|
||||
func _on_shot_area_enter( area ):
|
||||
#hit an enemy or asteroid
|
||||
if (area.has_method("destroy")):
|
||||
#duck typing at it's best
|
||||
area.destroy()
|
||||
_hit_something()
|
||||
|
||||
|
||||
pass
|
||||
|
||||
|
||||
func _on_shot_body_enter( body ):
|
||||
#hit the tilemap
|
||||
_hit_something()
|
||||
pass # replace with function body
|
BIN
demos/2d/space_shooter/shot.scn
Normal file
BIN
demos/2d/space_shooter/small_star.png
Normal file
After Width: | Height: | Size: 90 B |
BIN
demos/2d/space_shooter/sound_explode.wav
Normal file
BIN
demos/2d/space_shooter/sound_shoot.wav
Normal file
BIN
demos/2d/space_shooter/tile.png
Normal file
After Width: | Height: | Size: 810 B |
@ -4394,7 +4394,7 @@ void RasterizerGLES2::begin_shadow_map( RID p_light_instance, int p_shadow_pass
|
||||
|
||||
}
|
||||
|
||||
void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_projection) {
|
||||
void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_projection,bool p_ortho_hint) {
|
||||
|
||||
camera_transform=p_world;
|
||||
if (current_rt && current_rt_vflip) {
|
||||
@ -4402,10 +4402,11 @@ void RasterizerGLES2::set_camera(const Transform& p_world,const CameraMatrix& p_
|
||||
}
|
||||
camera_transform_inverse=camera_transform.inverse();
|
||||
camera_projection=p_projection;
|
||||
camera_plane = Plane( camera_transform.origin, camera_transform.basis.get_axis(2) );
|
||||
camera_plane = Plane( camera_transform.origin, -camera_transform.basis.get_axis(2) );
|
||||
camera_z_near=camera_projection.get_z_near();
|
||||
camera_z_far=camera_projection.get_z_far();
|
||||
camera_projection.get_viewport_size(camera_vp_size.x,camera_vp_size.y);
|
||||
camera_ortho=p_ortho_hint;
|
||||
}
|
||||
|
||||
void RasterizerGLES2::add_light( RID p_light_instance ) {
|
||||
@ -4768,8 +4769,11 @@ void RasterizerGLES2::_add_geometry( const Geometry* p_geometry, const InstanceD
|
||||
e->geometry_cmp=p_geometry_cmp;
|
||||
e->material=m;
|
||||
e->instance=p_instance;
|
||||
//e->depth=camera_plane.distance_to(p_world->origin);
|
||||
e->depth=camera_transform.origin.distance_to(p_instance->transform.origin);
|
||||
if (camera_ortho) {
|
||||
e->depth=camera_plane.distance_to(p_instance->transform.origin);
|
||||
} else {
|
||||
e->depth=camera_transform.origin.distance_to(p_instance->transform.origin);
|
||||
}
|
||||
e->owner=p_owner;
|
||||
e->light_type=0;
|
||||
e->additive=false;
|
||||
@ -5214,7 +5218,7 @@ bool RasterizerGLES2::_setup_material(const Geometry *p_geometry,const Material
|
||||
DEBUG_TEST_ERROR("Material arameters");
|
||||
|
||||
if (p_material->shader_cache->uses_time) {
|
||||
material_shader.set_uniform(MaterialShaderGLES2::TIME,Math::fmod(last_time,300.0));
|
||||
material_shader.set_uniform(MaterialShaderGLES2::TIME,Math::fmod(last_time,shader_time_rollback));
|
||||
draw_next_frame=true;
|
||||
}
|
||||
//if uses TIME - draw_next_frame=true
|
||||
@ -9219,7 +9223,7 @@ void RasterizerGLES2::_canvas_item_setup_shader_uniforms(CanvasItemMaterial *mat
|
||||
}
|
||||
|
||||
if (shader->uses_time) {
|
||||
canvas_shader.set_uniform(CanvasShaderGLES2::TIME,Math::fmod(last_time,300.0));
|
||||
canvas_shader.set_uniform(CanvasShaderGLES2::TIME,Math::fmod(last_time,shader_time_rollback));
|
||||
draw_next_frame=true;
|
||||
}
|
||||
//if uses TIME - draw_next_frame=true
|
||||
@ -10796,6 +10800,7 @@ void RasterizerGLES2::init() {
|
||||
current_rt=NULL;
|
||||
current_vd=NULL;
|
||||
current_debug=VS::SCENARIO_DEBUG_DISABLED;
|
||||
camera_ortho=false;
|
||||
|
||||
glGenBuffers(1,&gui_quad_buffer);
|
||||
glBindBuffer(GL_ARRAY_BUFFER,gui_quad_buffer);
|
||||
@ -10814,6 +10819,8 @@ void RasterizerGLES2::init() {
|
||||
glBindBuffer(GL_ELEMENT_ARRAY_BUFFER, 0);// unbind
|
||||
#endif
|
||||
|
||||
shader_time_rollback = GLOBAL_DEF("rasterizer/shader_time_rollback",300);
|
||||
|
||||
using_canvas_bg=false;
|
||||
_update_framebuffer();
|
||||
DEBUG_TEST_ERROR("Initializing");
|
||||
|
@ -1052,6 +1052,7 @@ class RasterizerGLES2 : public Rasterizer {
|
||||
float camera_z_near;
|
||||
float camera_z_far;
|
||||
Size2 camera_vp_size;
|
||||
bool camera_ortho;
|
||||
Set<String> extensions;
|
||||
bool texscreen_copied;
|
||||
bool texscreen_used;
|
||||
@ -1273,6 +1274,7 @@ class RasterizerGLES2 : public Rasterizer {
|
||||
Environment *current_env;
|
||||
VS::ScenarioDebugMode current_debug;
|
||||
RID overdraw_material;
|
||||
float shader_time_rollback;
|
||||
|
||||
|
||||
mutable MaterialShaderGLES2 material_shader;
|
||||
@ -1588,7 +1590,7 @@ public:
|
||||
|
||||
virtual void begin_shadow_map( RID p_light_instance, int p_shadow_pass );
|
||||
|
||||
virtual void set_camera(const Transform& p_world,const CameraMatrix& p_projection);
|
||||
virtual void set_camera(const Transform& p_world,const CameraMatrix& p_projection,bool p_ortho_hint);
|
||||
|
||||
virtual void add_light( RID p_light_instance ); ///< all "add_light" calls happen before add_geometry calls
|
||||
|
||||
|
@ -31,6 +31,8 @@
|
||||
#include "print_string.h"
|
||||
#include "os/os.h"
|
||||
|
||||
|
||||
|
||||
void ImageLoaderPNG::_read_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length) {
|
||||
|
||||
FileAccess *f = (FileAccess*)png_get_io_ptr(png_ptr);
|
||||
@ -253,6 +255,7 @@ void ImageLoaderPNG::get_recognized_extensions(List<String> *p_extensions) const
|
||||
struct PNGReadStatus {
|
||||
|
||||
int offset;
|
||||
int size;
|
||||
const unsigned char *image;
|
||||
};
|
||||
|
||||
@ -261,17 +264,26 @@ static void user_read_data(png_structp png_ptr,png_bytep data, png_size_t p_leng
|
||||
PNGReadStatus *rstatus;
|
||||
rstatus=(PNGReadStatus*)png_get_io_ptr(png_ptr);
|
||||
|
||||
memcpy(data,&rstatus->image[rstatus->offset],p_length);
|
||||
rstatus->offset+=p_length;
|
||||
int to_read=p_length;
|
||||
if (rstatus->size>=0) {
|
||||
to_read = MIN( p_length, rstatus->size - rstatus->offset);
|
||||
}
|
||||
memcpy(data,&rstatus->image[rstatus->offset],to_read);
|
||||
rstatus->offset+=to_read;
|
||||
|
||||
if (to_read<p_length) {
|
||||
memset(&data[to_read],0,p_length-to_read);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static Image _load_mem_png(const uint8_t* p_png) {
|
||||
static Image _load_mem_png(const uint8_t* p_png,int p_size) {
|
||||
|
||||
|
||||
PNGReadStatus prs;
|
||||
prs.image=p_png;
|
||||
prs.offset=0;
|
||||
prs.size=p_size;
|
||||
|
||||
Image img;
|
||||
Error err = ImageLoaderPNG::_load_image(&prs,user_read_data,&img);
|
||||
@ -283,9 +295,10 @@ static Image _load_mem_png(const uint8_t* p_png) {
|
||||
|
||||
static Image _lossless_unpack_png(const DVector<uint8_t>& p_data) {
|
||||
|
||||
int len = p_data.size();
|
||||
DVector<uint8_t>::Read r = p_data.read();
|
||||
ERR_FAIL_COND_V(r[0]!='P' || r[1]!='N' || r[2]!='G' || r[3]!=' ',Image());
|
||||
return _load_mem_png(&r[4]);
|
||||
return _load_mem_png(&r[4],len-4);
|
||||
|
||||
}
|
||||
|
||||
@ -424,6 +437,7 @@ static DVector<uint8_t> _lossless_pack_png(const Image& p_image) {
|
||||
|
||||
ImageLoaderPNG::ImageLoaderPNG() {
|
||||
|
||||
|
||||
Image::_png_mem_loader_func=_load_mem_png;
|
||||
Image::lossless_unpacker=_lossless_unpack_png;
|
||||
Image::lossless_packer=_lossless_pack_png;
|
||||
|
@ -40,7 +40,10 @@ class ImageLoaderPNG : public ImageFormatLoader {
|
||||
static void _read_png_data(png_structp png_ptr,png_bytep data, png_size_t p_length);
|
||||
|
||||
|
||||
|
||||
public:
|
||||
|
||||
|
||||
static Error _load_image(void *rf_up,png_rw_ptr p_func,Image *p_image);
|
||||
virtual Error load_image(Image *p_image,FileAccess *f);
|
||||
virtual void get_recognized_extensions(List<String> *p_extensions) const;
|
||||
|
@ -218,10 +218,14 @@ uint64_t OS_Unix::get_unix_time() const {
|
||||
};
|
||||
|
||||
|
||||
OS::Date OS_Unix::get_date() const {
|
||||
OS::Date OS_Unix::get_date(bool utc) const {
|
||||
|
||||
time_t t=time(NULL);
|
||||
struct tm *lt=localtime(&t);
|
||||
struct tm *lt;
|
||||
if (utc)
|
||||
lt=gmtime(&t);
|
||||
else
|
||||
lt=localtime(&t);
|
||||
Date ret;
|
||||
ret.year=1900+lt->tm_year;
|
||||
ret.month=(Month)lt->tm_mon;
|
||||
@ -231,17 +235,47 @@ OS::Date OS_Unix::get_date() const {
|
||||
|
||||
return ret;
|
||||
}
|
||||
OS::Time OS_Unix::get_time() const {
|
||||
|
||||
OS::Time OS_Unix::get_time(bool utc) const {
|
||||
time_t t=time(NULL);
|
||||
struct tm *lt=localtime(&t);
|
||||
struct tm *lt;
|
||||
if (utc)
|
||||
lt=gmtime(&t);
|
||||
else
|
||||
lt=localtime(&t);
|
||||
Time ret;
|
||||
ret.hour=lt->tm_hour;
|
||||
ret.min=lt->tm_min;
|
||||
ret.sec=lt->tm_sec;
|
||||
get_time_zone_info();
|
||||
return ret;
|
||||
}
|
||||
|
||||
|
||||
OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
|
||||
time_t t = time(NULL);
|
||||
struct tm *lt = localtime(&t);
|
||||
char name[16];
|
||||
strftime(name, 16, "%Z", lt);
|
||||
name[15] = 0;
|
||||
TimeZoneInfo ret;
|
||||
ret.name = name;
|
||||
|
||||
char bias_buf[16];
|
||||
strftime(bias_buf, 16, "%z", lt);
|
||||
int bias;
|
||||
bias_buf[15] = 0;
|
||||
sscanf(bias_buf, "%d", &bias);
|
||||
|
||||
// convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes
|
||||
int hour = (int)bias / 100;
|
||||
int minutes = bias % 100;
|
||||
if (bias < 0)
|
||||
ret.bias = hour * 60 - minutes;
|
||||
else
|
||||
ret.bias = hour * 60 + minutes;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void OS_Unix::delay_usec(uint32_t p_usec) const {
|
||||
|
||||
usleep(p_usec);
|
||||
|
@ -88,8 +88,9 @@ public:
|
||||
|
||||
virtual String get_name();
|
||||
|
||||
virtual Date get_date() const;
|
||||
virtual Time get_time() const;
|
||||
virtual Date get_date(bool utc) const;
|
||||
virtual Time get_time(bool utc) const;
|
||||
virtual TimeZoneInfo get_time_zone_info() const;
|
||||
|
||||
virtual uint64_t get_unix_time() const;
|
||||
|
||||
|
134
godot_logo.svg
Normal file
@ -0,0 +1,134 @@
|
||||
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<svg
|
||||
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
||||
xmlns:cc="http://creativecommons.org/ns#"
|
||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
||||
xmlns:svg="http://www.w3.org/2000/svg"
|
||||
xmlns="http://www.w3.org/2000/svg"
|
||||
viewBox="0 0 236.27499 84.6875"
|
||||
height="84.6875"
|
||||
width="236.27499"
|
||||
xml:space="preserve"
|
||||
version="1.1"
|
||||
id="svg3336"><metadata
|
||||
id="metadata3342"><rdf:RDF><cc:Work
|
||||
rdf:about=""><dc:format>image/svg+xml</dc:format><dc:type
|
||||
rdf:resource="http://purl.org/dc/dcmitype/StillImage" /><dc:title></dc:title></cc:Work></rdf:RDF></metadata><defs
|
||||
id="defs3340"><clipPath
|
||||
id="clipPath3350"
|
||||
clipPathUnits="userSpaceOnUse"><path
|
||||
id="path3352"
|
||||
d="m 0,67.75 189.02,0 L 189.02,0 0,0 0,67.75 Z" /></clipPath></defs><g
|
||||
transform="matrix(1.25,0,0,-1.25,0,84.6875)"
|
||||
id="g3344"><g
|
||||
id="g3346"><g
|
||||
clip-path="url(#clipPath3350)"
|
||||
id="g3348"><g
|
||||
transform="translate(112.7847,43.5176)"
|
||||
id="g3354"><path
|
||||
id="path3356"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -1.082,0 -1.989,-0.497 -2.724,-1.488 -0.732,-0.992 -1.099,-2.385 -1.099,-4.177 0,-1.796 0.349,-3.171 1.05,-4.129 0.699,-0.961 1.617,-1.439 2.756,-1.439 1.139,0 2.064,0.484 2.775,1.457 0.71,0.968 1.066,2.355 1.066,4.161 0,1.803 -0.367,3.192 -1.1,4.162 C 1.992,-0.484 1.083,0 0,0 m -0.017,-17.828 c -3.168,0 -5.752,1.037 -7.749,3.11 -1.994,2.075 -2.991,5.104 -2.991,9.084 0,3.984 1.008,6.999 3.027,9.053 2.018,2.051 4.624,3.077 7.815,3.077 3.191,0 5.769,-1.008 7.73,-3.029 1.964,-2.018 2.945,-5.076 2.945,-9.167 0,-4.094 -1.004,-7.139 -3.012,-9.137 -2.008,-1.994 -4.595,-2.991 -7.765,-2.991" /></g><g
|
||||
transform="translate(133.0269,43.2832)"
|
||||
id="g3358"><path
|
||||
id="path3360"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0,-10.119 c 0,-0.473 0.035,-0.771 0.103,-0.896 0.066,-0.124 0.27,-0.186 0.607,-0.186 1.242,0 2.183,0.464 2.826,1.388 0.645,0.924 0.964,2.462 0.964,4.617 0,2.155 -0.334,3.559 -0.997,4.212 C 2.837,-0.33 1.782,0 0.338,0 L 0,0 Z m -6.495,-15.7 0,20.298 c 0,0.564 0.14,1.009 0.423,1.34 0.281,0.325 0.648,0.49 1.1,0.49 l 5.65,0 c 3.586,0 6.309,-0.905 8.168,-2.709 1.862,-1.804 2.794,-4.645 2.794,-8.525 0,-8.3 -3.543,-12.45 -10.625,-12.45 l -5.785,0 c -1.149,0 -1.725,0.518 -1.725,1.556" /></g><g
|
||||
transform="translate(157.6558,43.5176)"
|
||||
id="g3362"><path
|
||||
id="path3364"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -1.083,0 -1.991,-0.497 -2.726,-1.488 -0.731,-0.992 -1.097,-2.385 -1.097,-4.177 0,-1.796 0.35,-3.171 1.049,-4.129 0.698,-0.961 1.617,-1.439 2.756,-1.439 1.14,0 2.065,0.484 2.775,1.457 0.711,0.968 1.067,2.355 1.067,4.161 0,1.803 -0.367,3.192 -1.1,4.162 C 1.99,-0.484 1.083,0 0,0 m -0.018,-17.828 c -3.169,0 -5.751,1.037 -7.746,3.11 -1.997,2.075 -2.995,5.104 -2.995,9.084 0,3.984 1.009,6.999 3.027,9.053 2.02,2.051 4.624,3.077 7.817,3.077 3.192,0 5.768,-1.008 7.73,-3.029 1.963,-2.018 2.944,-5.076 2.944,-9.167 0,-4.094 -1.004,-7.139 -3.012,-9.137 -2.007,-1.994 -4.596,-2.991 -7.765,-2.991" /></g><g
|
||||
transform="translate(181.0239,26.5664)"
|
||||
id="g3366"><path
|
||||
id="path3368"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-0.448 -1.115,-0.676 -3.349,-0.676 -2.232,0 -3.35,0.228 -3.35,0.676 l 0,16.985 -4.059,0 c -0.384,0 -0.655,0.518 -0.812,1.558 -0.068,0.495 -0.1,1.002 -0.1,1.521 0,0.517 0.032,1.026 0.1,1.522 0.157,1.037 0.428,1.559 0.812,1.559 l 14.717,0 c 0.383,0 0.653,-0.522 0.812,-1.559 0.067,-0.496 0.101,-1.005 0.101,-1.522 0,-0.519 -0.034,-1.026 -0.101,-1.521 C 4.612,17.503 4.342,16.985 3.959,16.985 L 0,16.985 0,0 Z" /></g><g
|
||||
transform="translate(96.0444,38.5889)"
|
||||
id="g3370"><path
|
||||
id="path3372"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -1.821,0.028 -3.906,-0.352 -3.906,-0.352 l 0,-3.554 2.096,0 -0.023,-1.585 c 0,-0.587 -0.582,-0.882 -1.743,-0.882 -1.162,0 -2.188,0.492 -3.078,1.474 -0.893,0.982 -1.337,2.419 -1.337,4.311 0,1.897 0.434,3.295 1.303,4.197 0.866,0.902 2.002,1.354 3.399,1.354 0.587,0 1.195,-0.095 1.827,-0.288 0.632,-0.192 1.055,-0.371 1.27,-0.539 0.214,-0.173 0.417,-0.255 0.609,-0.255 0.191,0 0.501,0.223 0.929,0.676 0.429,0.451 0.813,1.134 1.152,2.046 0.337,0.916 0.506,1.618 0.506,2.116 0,0.494 -0.01,0.835 -0.032,1.014 -0.474,0.519 -1.348,0.93 -2.624,1.236 -1.273,0.304 -2.7,0.456 -4.279,0.456 -3.474,0 -6.191,-1.094 -8.153,-3.281 -1.963,-2.189 -2.943,-5.03 -2.943,-8.527 0,-4.105 1.003,-7.218 3.008,-9.338 2.01,-2.12 4.648,-3.178 7.919,-3.178 1.759,0 3.321,0.151 4.684,0.456 1.366,0.303 2.274,0.615 2.726,0.93 L 3.445,-0.926 C 3.445,-0.311 1.821,-0.031 0,0" /></g><g
|
||||
transform="translate(88.9126,11.8398)"
|
||||
id="g3374"><path
|
||||
id="path3376"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -0.187,-0.384 -0.531,-0.735 -1.034,-1.054 -0.502,-0.32 -1.14,-0.479 -1.915,-0.479 -1.022,0 -1.844,0.322 -2.469,0.973 -0.622,0.647 -0.934,1.579 -0.934,2.794 l 0,3.032 c 0,1.189 0.294,2.101 0.883,2.738 0.588,0.632 1.376,0.952 2.359,0.952 0.962,0 1.707,-0.253 2.234,-0.753 C -0.35,7.701 -0.074,7 -0.05,6.104 l -0.013,-0.04 -0.785,0 C -0.876,6.751 -1.075,7.28 -1.45,7.654 -1.823,8.025 -2.377,8.213 -3.11,8.213 -3.851,8.213 -4.438,7.962 -4.868,7.459 -5.296,6.957 -5.51,6.229 -5.51,5.273 l 0,-3.048 c 0,-0.992 0.231,-1.747 0.693,-2.268 0.461,-0.517 1.083,-0.775 1.868,-0.775 0.574,0 1.034,0.101 1.379,0.309 0.346,0.205 0.587,0.455 0.722,0.752 l 0,2.655 -2.115,0 0,0.739 L 0,3.637 0,0 Z" /></g><g
|
||||
transform="translate(92.7988,11.0645)"
|
||||
id="g3378"><path
|
||||
id="path3380"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0.465,0 0.88,0.132 1.242,0.4 0.362,0.27 0.616,0.611 0.767,1.026 l 0,1.638 -1.346,0 C 0.091,3.064 -0.368,2.902 -0.711,2.578 -1.055,2.256 -1.225,1.854 -1.225,1.375 -1.225,0.971 -1.119,0.639 -0.903,0.383 -0.688,0.126 -0.387,0 0,0 M 2.135,-0.611 C 2.093,-0.349 2.06,-0.136 2.04,0.031 2.02,0.201 2.009,0.37 2.009,0.542 1.779,0.166 1.483,-0.146 1.116,-0.39 0.75,-0.636 0.343,-0.758 -0.105,-0.758 c -0.627,0 -1.109,0.195 -1.45,0.583 -0.34,0.391 -0.511,0.917 -0.511,1.581 0,0.702 0.247,1.266 0.741,1.684 0.494,0.418 1.166,0.627 2.011,0.627 l 1.323,0 0,0.93 C 2.009,5.183 1.873,5.604 1.604,5.909 1.331,6.21 0.954,6.362 0.468,6.362 0.017,6.362 -0.356,6.219 -0.649,5.928 -0.94,5.639 -1.085,5.285 -1.085,4.864 l -0.786,0.007 -0.014,0.041 c -0.022,0.571 0.194,1.076 0.65,1.524 0.454,0.446 1.036,0.668 1.745,0.668 0.701,0 1.265,-0.213 1.696,-0.638 0.428,-0.429 0.643,-1.04 0.643,-1.835 l 0,-3.715 c 0,-0.27 0.012,-0.533 0.036,-0.784 0.024,-0.254 0.063,-0.499 0.125,-0.743 l -0.875,0 z" /></g><g
|
||||
transform="translate(98.2871,18.0273)"
|
||||
id="g3382"><path
|
||||
id="path3384"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0.072,-1.176 c 0.199,0.421 0.466,0.745 0.796,0.976 0.332,0.227 0.722,0.341 1.171,0.341 0.457,0 0.843,-0.133 1.154,-0.403 0.311,-0.268 0.541,-0.675 0.687,-1.22 0.186,0.503 0.451,0.902 0.794,1.19 0.343,0.289 0.759,0.433 1.242,0.433 0.664,0 1.179,-0.269 1.544,-0.807 0.367,-0.539 0.55,-1.366 0.55,-2.483 l 0,-4.425 -0.846,0 0,4.439 c 0,0.929 -0.128,1.583 -0.378,1.959 -0.252,0.377 -0.612,0.567 -1.078,0.567 -0.491,0 -0.874,-0.207 -1.149,-0.628 C 4.285,-1.658 4.116,-2.185 4.054,-2.82 l 0,-0.197 0,-4.557 -0.842,0 0,4.434 c 0,0.908 -0.127,1.557 -0.387,1.945 -0.259,0.387 -0.619,0.58 -1.081,0.58 -0.442,0 -0.8,-0.135 -1.068,-0.403 C 0.407,-1.286 0.215,-1.654 0.099,-2.121 l 0,-5.453 -0.841,0 0,7.574 L 0,0 Z" /></g><g
|
||||
transform="translate(110.499,17.4268)"
|
||||
id="g3386"><path
|
||||
id="path3388"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -0.527,0 -0.959,-0.24 -1.299,-0.72 -0.339,-0.481 -0.514,-1.074 -0.529,-1.781 l 3.495,0 0,0.324 c 0,0.625 -0.147,1.146 -0.441,1.559 C 0.931,-0.205 0.523,0 0,0 m 0.119,-7.12 c -0.817,0 -1.485,0.307 -2.003,0.921 -0.517,0.612 -0.777,1.395 -0.777,2.349 l 0,1.258 c 0,0.956 0.26,1.753 0.78,2.387 0.521,0.631 1.147,0.946 1.881,0.946 0.793,0 1.408,-0.281 1.847,-0.845 0.44,-0.566 0.66,-1.326 0.66,-2.279 l 0,-0.831 -4.335,0 0,-0.63 c 0,-0.733 0.176,-1.344 0.525,-1.831 0.35,-0.488 0.826,-0.73 1.422,-0.73 0.414,0 0.775,0.073 1.075,0.217 0.301,0.147 0.558,0.353 0.773,0.624 L 2.311,-6.16 C 2.083,-6.45 1.786,-6.685 1.424,-6.858 1.063,-7.031 0.627,-7.12 0.119,-7.12" /></g><g
|
||||
transform="translate(119.8403,17.4268)"
|
||||
id="g3390"><path
|
||||
id="path3392"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -0.528,0 -0.962,-0.24 -1.301,-0.72 -0.337,-0.481 -0.513,-1.074 -0.528,-1.781 l 3.495,0 0,0.324 c 0,0.625 -0.146,1.146 -0.442,1.559 C 0.93,-0.205 0.522,0 0,0 m 0.118,-7.12 c -0.817,0 -1.484,0.307 -2.001,0.921 -0.52,0.612 -0.78,1.395 -0.78,2.349 l 0,1.258 c 0,0.956 0.262,1.753 0.78,2.387 C -1.36,0.426 -0.734,0.741 0,0.741 0.792,0.741 1.409,0.46 1.847,-0.104 2.286,-0.67 2.505,-1.43 2.505,-2.383 l 0,-0.831 -4.334,0 0,-0.63 c 0,-0.733 0.176,-1.344 0.527,-1.831 0.348,-0.488 0.822,-0.73 1.42,-0.73 0.416,0 0.775,0.073 1.074,0.217 0.302,0.147 0.559,0.353 0.776,0.624 L 2.31,-6.16 C 2.081,-6.45 1.786,-6.685 1.423,-6.858 1.063,-7.031 0.627,-7.12 0.118,-7.12" /></g><g
|
||||
transform="translate(124.5659,18.0273)"
|
||||
id="g3394"><path
|
||||
id="path3396"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0.069,-1.252 c 0.202,0.444 0.469,0.789 0.804,1.029 0.332,0.242 0.723,0.364 1.172,0.364 0.677,0 1.196,-0.25 1.556,-0.753 0.363,-0.502 0.544,-1.283 0.544,-2.341 l 0,-4.621 -0.847,0 0,4.613 c 0,0.865 -0.127,1.47 -0.379,1.82 -0.251,0.351 -0.619,0.526 -1.098,0.526 -0.43,0 -0.791,-0.14 -1.08,-0.424 C 0.451,-1.32 0.234,-1.695 0.09,-2.168 l 0,-5.406 -0.84,0 L -0.75,0 0,0 Z" /></g><g
|
||||
transform="translate(131.1768,13.5771)"
|
||||
id="g3398"><path
|
||||
id="path3400"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-0.769 0.146,-1.38 0.441,-1.835 0.292,-0.459 0.736,-0.686 1.33,-0.686 0.406,0 0.748,0.109 1.029,0.331 0.28,0.221 0.501,0.53 0.664,0.921 l 0,3.752 C 3.307,2.887 3.091,3.213 2.818,3.464 2.545,3.711 2.2,3.835 1.785,3.835 1.193,3.835 0.746,3.577 0.448,3.06 0.149,2.541 0,1.865 0,1.035 L 0,0 Z m -0.849,1.035 c 0,1.073 0.217,1.936 0.652,2.585 0.432,0.647 1.033,0.971 1.8,0.971 0.425,0 0.798,-0.104 1.117,-0.312 C 3.039,4.075 3.303,3.776 3.515,3.396 l 0.082,1.054 0.714,0 0,-7.581 c 0,-0.971 -0.226,-1.723 -0.678,-2.255 -0.452,-0.53 -1.095,-0.799 -1.926,-0.799 -0.298,0 -0.619,0.047 -0.962,0.138 -0.344,0.091 -0.648,0.21 -0.915,0.359 l 0.233,0.739 c 0.227,-0.148 0.481,-0.262 0.763,-0.342 0.279,-0.083 0.568,-0.123 0.867,-0.123 0.602,0 1.049,0.193 1.337,0.579 0.289,0.391 0.434,0.956 0.434,1.704 l 0,0.916 C 3.25,-2.556 2.986,-2.817 2.673,-2.998 2.362,-3.18 1.998,-3.271 1.588,-3.271 c -0.761,0 -1.358,0.298 -1.789,0.894 -0.431,0.595 -0.648,1.388 -0.648,2.377 l 0,1.035 z" /></g><path
|
||||
id="path3402"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 138.318,10.453 -0.848,0 0,7.574 0.848,0 0,-7.574 z m 0,9.731 -0.848,0 0,1.193 0.848,0 0,-1.193 z" /><g
|
||||
transform="translate(141.0552,18.0273)"
|
||||
id="g3404"><path
|
||||
id="path3406"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0.069,-1.252 c 0.202,0.444 0.468,0.789 0.803,1.029 0.334,0.242 0.725,0.364 1.173,0.364 0.677,0 1.197,-0.25 1.558,-0.753 0.363,-0.502 0.542,-1.283 0.542,-2.341 l 0,-4.621 -0.847,0 0,4.613 c 0,0.865 -0.127,1.47 -0.378,1.82 -0.253,0.351 -0.618,0.526 -1.099,0.526 -0.43,0 -0.79,-0.14 -1.079,-0.424 C 0.453,-1.32 0.235,-1.695 0.092,-2.168 l 0,-5.406 -0.842,0 L -0.75,0 0,0 Z" /></g><g
|
||||
transform="translate(149.4155,17.4268)"
|
||||
id="g3408"><path
|
||||
id="path3410"
|
||||
style="fill:#6d6e71;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -0.528,0 -0.961,-0.24 -1.299,-0.72 -0.338,-0.481 -0.514,-1.074 -0.53,-1.781 l 3.495,0 0,0.324 c 0,0.625 -0.145,1.146 -0.44,1.559 C 0.932,-0.205 0.523,0 0,0 m 0.12,-7.12 c -0.819,0 -1.486,0.307 -2.002,0.921 -0.518,0.612 -0.778,1.395 -0.778,2.349 l 0,1.258 c 0,0.956 0.26,1.753 0.78,2.387 0.521,0.631 1.148,0.946 1.88,0.946 0.793,0 1.41,-0.281 1.85,-0.845 0.438,-0.566 0.657,-1.326 0.657,-2.279 l 0,-0.831 -4.336,0 0,-0.63 c 0,-0.733 0.177,-1.344 0.527,-1.831 0.349,-0.488 0.823,-0.73 1.422,-0.73 0.414,0 0.773,0.073 1.072,0.217 0.304,0.147 0.56,0.353 0.777,0.624 L 2.313,-6.16 C 2.082,-6.45 1.787,-6.685 1.425,-6.858 1.064,-7.031 0.628,-7.12 0.12,-7.12" /></g><g
|
||||
transform="translate(64.312,21.7949)"
|
||||
id="g3412"><path
|
||||
id="path3414"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0,-3.942 c 0,-0.39 -0.25,-0.734 -0.621,-0.852 L -6.835,-6.8 c -0.273,-0.091 -0.57,-0.042 -0.8,0.128 -0.232,0.168 -0.37,0.437 -0.37,0.721 l 0,4.305 -5.818,-1.108 0,-4.381 c 0,-0.447 -0.332,-0.824 -0.775,-0.885 l -8.41,-1.152 c -0.039,-0.003 -0.081,-0.008 -0.121,-0.008 -0.214,0 -0.424,0.078 -0.588,0.22 -0.195,0.172 -0.306,0.416 -0.306,0.676 l 0,4.638 -4.341,-0.018 0,-10e-4 -0.318,10e-4 -0.319,-10e-4 0,10e-4 -4.34,0.018 0,-4.638 c 0,-0.26 -0.112,-0.504 -0.307,-0.676 -0.164,-0.142 -0.374,-0.22 -0.587,-0.22 -0.041,0 -0.082,0.005 -0.123,0.008 l -8.41,1.152 c -0.442,0.061 -0.774,0.438 -0.774,0.885 l 0,4.381 -5.819,1.108 0,-4.305 c 0,-0.284 -0.137,-0.553 -0.368,-0.721 -0.232,-0.17 -0.529,-0.219 -0.802,-0.128 l -6.215,2.006 c -0.369,0.118 -0.619,0.462 -0.619,0.852 l 0,3.942 -3.837,1.29 c -0.19,-0.811 -0.295,-1.642 -0.295,-2.481 0,-10.301 14.512,-18.252 32.448,-18.309 l 0.022,0 0.023,0 c 17.936,0.057 32.448,8.008 32.448,18.309 0,0.766 -0.088,1.521 -0.247,2.266 L 0,0 Z" /></g><g
|
||||
transform="translate(5.9634,40.0615)"
|
||||
id="g3416"><path
|
||||
id="path3418"
|
||||
style="fill:#478cbf;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 0,-16.047 2.163,-0.729 c 0.364,-0.122 0.61,-0.462 0.61,-0.847 l 0,-3.936 4.426,-1.428 0,4.154 c 0,0.27 0.118,0.52 0.323,0.689 0.206,0.172 0.474,0.241 0.739,0.192 l 7.608,-1.452 c 0.422,-0.079 0.728,-0.448 0.728,-0.877 l 0,-4.338 6.62,-0.904 0,4.509 c 0,0.241 0.096,0.467 0.264,0.635 0.167,0.166 0.394,0.259 0.633,0.259 l 0.002,0 5.551,-0.022 5.549,0.022 c 0.245,-10e-4 0.468,-0.093 0.635,-0.259 0.169,-0.168 0.264,-0.394 0.264,-0.635 l 0,-4.509 6.621,0.904 0,4.338 c 0,0.429 0.304,0.798 0.726,0.877 l 7.609,1.452 c 0.262,0.049 0.533,-0.02 0.738,-0.192 0.205,-0.169 0.325,-0.419 0.325,-0.689 l 0,-4.154 4.425,1.428 0,3.936 c 0,0.385 0.245,0.725 0.609,0.847 l 1.475,0.497 0,16.279 0.04,0 c 1.437,1.834 2.767,3.767 4.042,5.828 -1.694,2.883 -3.768,5.459 -5.986,7.846 -2.057,-1.035 -4.055,-2.208 -5.942,-3.456 -0.944,0.938 -2.008,1.706 -3.052,2.509 -1.027,0.824 -2.183,1.428 -3.281,2.132 0.327,2.433 0.489,4.828 0.554,7.327 -2.831,1.424 -5.85,2.369 -8.903,3.047 -1.219,-2.048 -2.334,-4.267 -3.304,-6.436 -1.152,0.192 -2.309,0.264 -3.467,0.277 l 0,0.002 c -0.008,0 -0.015,-0.002 -0.022,-0.002 -0.008,0 -0.015,0.002 -0.022,0.002 l 0,-0.002 c -1.16,-0.013 -2.316,-0.085 -3.468,-0.277 -0.97,2.169 -2.084,4.388 -3.305,6.436 C 19.475,24.555 16.456,23.61 13.626,22.186 13.69,19.687 13.852,17.292 14.18,14.859 13.081,14.155 11.925,13.551 10.898,12.727 9.855,11.924 8.79,11.156 7.846,10.218 5.958,11.466 3.961,12.639 1.904,13.674 -0.314,11.287 -2.388,8.711 -4.082,5.828 -2.807,3.767 -1.477,1.834 -0.04,0 L 0,0 Z" /></g><g
|
||||
transform="translate(26.8428,32.3604)"
|
||||
id="g3420"><path
|
||||
id="path3422"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-3.611 -2.926,-6.537 -6.537,-6.537 -3.608,0 -6.535,2.926 -6.535,6.537 0,3.609 2.927,6.533 6.535,6.533 C -2.926,6.533 0,3.609 0,0" /></g><g
|
||||
transform="translate(25.27,31.9727)"
|
||||
id="g3424"><path
|
||||
id="path3426"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-2.396 -1.941,-4.337 -4.339,-4.337 -2.396,0 -4.339,1.941 -4.339,4.337 0,2.396 1.943,4.339 4.339,4.339 C -1.941,4.339 0,2.396 0,0" /></g><g
|
||||
transform="translate(35.6816,25.2285)"
|
||||
id="g3428"><path
|
||||
id="path3430"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c -1.162,0 -2.104,0.856 -2.104,1.912 l 0,6.018 c 0,1.054 0.942,1.912 2.104,1.912 1.162,0 2.106,-0.858 2.106,-1.912 l 0,-6.018 C 2.106,0.856 1.162,0 0,0" /></g><g
|
||||
transform="translate(44.5215,32.3604)"
|
||||
id="g3432"><path
|
||||
id="path3434"
|
||||
style="fill:#ffffff;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-3.611 2.926,-6.537 6.537,-6.537 3.609,0 6.535,2.926 6.535,6.537 0,3.609 -2.926,6.533 -6.535,6.533 C 2.926,6.533 0,3.609 0,0" /></g><g
|
||||
transform="translate(46.0947,31.9727)"
|
||||
id="g3436"><path
|
||||
id="path3438"
|
||||
style="fill:#414042;fill-opacity:1;fill-rule:nonzero;stroke:none"
|
||||
d="m 0,0 c 0,-2.396 1.941,-4.337 4.336,-4.337 2.398,0 4.339,1.941 4.339,4.337 0,2.396 -1.941,4.339 -4.339,4.339 C 1.941,4.339 0,2.396 0,0" /></g></g></g></g></svg>
|
After Width: | Height: | Size: 18 KiB |
@ -98,6 +98,9 @@ static int video_driver_idx=-1;
|
||||
static int audio_driver_idx=-1;
|
||||
static String locale;
|
||||
|
||||
static bool init_maximized=false;
|
||||
static int init_screen=-1;
|
||||
|
||||
static String unescape_cmdline(const String& p_str) {
|
||||
|
||||
return p_str.replace("%20"," ");
|
||||
@ -384,7 +387,7 @@ Error Main::setup(const char *execpath,int argc, char *argv[],bool p_second_phas
|
||||
} else if (I->get()=="-e" || I->get()=="-editor") { // fonud editor
|
||||
|
||||
editor=true;
|
||||
|
||||
init_maximized=true;
|
||||
} else if (I->get()=="-nowindow") { // fullscreen
|
||||
|
||||
OS::get_singleton()->set_no_window_mode(true);
|
||||
@ -789,6 +792,13 @@ Error Main::setup2() {
|
||||
show_logo=false;
|
||||
#endif
|
||||
|
||||
if (init_screen!=-1) {
|
||||
OS::get_singleton()->set_current_screen(init_screen);
|
||||
}
|
||||
if (init_maximized) {
|
||||
OS::get_singleton()->set_window_maximized(true);
|
||||
}
|
||||
|
||||
if (show_logo) { //boot logo!
|
||||
String boot_logo_path=GLOBAL_DEF("application/boot_splash",String());
|
||||
bool boot_logo_scale=GLOBAL_DEF("application/boot_splash_fullsize",true);
|
||||
@ -1320,8 +1330,8 @@ bool Main::iteration() {
|
||||
double step=(double)ticks_elapsed / 1000000.0;
|
||||
float frame_slice=1.0/OS::get_singleton()->get_iterations_per_second();
|
||||
|
||||
//if (time_accum+step < frame_slice)
|
||||
// return false;
|
||||
// if (time_accum+step < frame_slice)
|
||||
// return false;
|
||||
|
||||
frame+=ticks_elapsed;
|
||||
|
||||
@ -1356,6 +1366,8 @@ bool Main::iteration() {
|
||||
message_queue->flush();
|
||||
|
||||
PhysicsServer::get_singleton()->step(frame_slice*time_scale);
|
||||
|
||||
Physics2DServer::get_singleton()->end_sync();
|
||||
Physics2DServer::get_singleton()->step(frame_slice*time_scale);
|
||||
|
||||
time_accum-=frame_slice;
|
||||
@ -1378,6 +1390,8 @@ bool Main::iteration() {
|
||||
SpatialSound2DServer::get_singleton()->update( step*time_scale );
|
||||
|
||||
|
||||
VisualServer::get_singleton()->sync(); //sync if still drawing from previous frames.
|
||||
|
||||
if (OS::get_singleton()->can_draw()) {
|
||||
|
||||
if ((!force_redraw_requested) && OS::get_singleton()->is_in_low_processor_usage_mode()) {
|
||||
@ -1390,8 +1404,6 @@ bool Main::iteration() {
|
||||
OS::get_singleton()->frames_drawn++;
|
||||
force_redraw_requested = false;
|
||||
}
|
||||
} else {
|
||||
VisualServer::get_singleton()->flush(); // flush visual commands
|
||||
}
|
||||
|
||||
if (AudioServer::get_singleton())
|
||||
|
1
makerel.bat
Normal file
@ -0,0 +1 @@
|
||||
"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\vcvarsall.bat" && c:\python27\scons p=windows target=debug_release tools=no
|
@ -747,7 +747,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
|
||||
//}
|
||||
} break;
|
||||
case MotionEvent.ACTION_POINTER_UP: {
|
||||
final int indexPointUp = event.getAction() >> MotionEvent.ACTION_POINTER_INDEX_SHIFT;
|
||||
final int indexPointUp = event.getActionIndex();
|
||||
final int pointer_idx = event.getPointerId(indexPointUp);
|
||||
GodotLib.touch(4,pointer_idx,evcount,arr);
|
||||
//System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
|
||||
|
@ -163,7 +163,8 @@ void OS_Android::initialize(const VideoMode& p_desired,int p_video_driver,int p_
|
||||
//
|
||||
physics_server = memnew( PhysicsServerSW );
|
||||
physics_server->init();
|
||||
physics_2d_server = memnew( Physics2DServerSW );
|
||||
//physics_2d_server = memnew( Physics2DServerSW );
|
||||
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
input = memnew( InputDefault );
|
||||
|
@ -37,6 +37,7 @@
|
||||
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
||||
#include "servers/audio/audio_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
#include "servers/visual/rasterizer.h"
|
||||
|
||||
|
||||
|
@ -51,6 +51,12 @@ public:
|
||||
|
||||
Error post_score(Variant p_score);
|
||||
Error award_achievement(Variant p_params);
|
||||
void reset_achievements();
|
||||
void request_achievements();
|
||||
void request_achievement_descriptions();
|
||||
Error show_game_center(Variant p_params);
|
||||
|
||||
void game_center_closed();
|
||||
|
||||
int get_pending_event_count();
|
||||
Variant pop_pending_event();
|
||||
|
@ -32,6 +32,7 @@
|
||||
|
||||
extern "C" {
|
||||
#import <GameKit/GameKit.h>
|
||||
#import "app_delegate.h"
|
||||
};
|
||||
|
||||
GameCenter* GameCenter::instance = NULL;
|
||||
@ -42,6 +43,10 @@ void GameCenter::_bind_methods() {
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("post_score"),&GameCenter::post_score);
|
||||
ObjectTypeDB::bind_method(_MD("award_achievement"),&GameCenter::award_achievement);
|
||||
ObjectTypeDB::bind_method(_MD("reset_achievements"),&GameCenter::reset_achievements);
|
||||
ObjectTypeDB::bind_method(_MD("request_achievements"),&GameCenter::request_achievements);
|
||||
ObjectTypeDB::bind_method(_MD("request_achievement_descriptions"),&GameCenter::request_achievement_descriptions);
|
||||
ObjectTypeDB::bind_method(_MD("show_game_center"),&GameCenter::show_game_center);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("get_pending_event_count"),&GameCenter::get_pending_event_count);
|
||||
ObjectTypeDB::bind_method(_MD("pop_pending_event"),&GameCenter::pop_pending_event);
|
||||
@ -50,23 +55,41 @@ void GameCenter::_bind_methods() {
|
||||
|
||||
Error GameCenter::connect() {
|
||||
|
||||
//if this class isn't available, game center isn't implemented
|
||||
if ((NSClassFromString(@"GKLocalPlayer")) == nil) {
|
||||
GameCenter::get_singleton()->connected = false;
|
||||
return ERR_UNAVAILABLE;
|
||||
}
|
||||
|
||||
GKLocalPlayer* player = [GKLocalPlayer localPlayer];
|
||||
[player authenticateWithCompletionHandler:^(NSError* error) {
|
||||
ERR_FAIL_COND_V(![player respondsToSelector:@selector(authenticateHandler)], ERR_UNAVAILABLE);
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "authentication";
|
||||
if (player.isAuthenticated) {
|
||||
ret["result"] = "ok";
|
||||
GameCenter::get_singleton()->connected = true;
|
||||
} else {
|
||||
ret["result"] = "error";
|
||||
ret["error_code"] = error.code;
|
||||
ret["error_description"] = [error.localizedDescription UTF8String];
|
||||
GameCenter::get_singleton()->connected = false;
|
||||
};
|
||||
ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
|
||||
ERR_FAIL_COND_V(!root_controller, FAILED);
|
||||
|
||||
//this handler is called serveral times. first when the view needs to be shown, then again after the view is cancelled or the user logs in. or if the user's already logged in, it's called just once to confirm they're authenticated. This is why no result needs to be specified in the presentViewController phase. in this case, more calls to this function will follow.
|
||||
player.authenticateHandler = (^(UIViewController *controller, NSError *error) {
|
||||
if (controller) {
|
||||
[root_controller presentViewController:controller animated:YES completion:nil];
|
||||
}
|
||||
else {
|
||||
Dictionary ret;
|
||||
ret["type"] = "authentication";
|
||||
if (player.isAuthenticated) {
|
||||
ret["result"] = "ok";
|
||||
GameCenter::get_singleton()->connected = true;
|
||||
} else {
|
||||
ret["result"] = "error";
|
||||
ret["error_code"] = error.code;
|
||||
ret["error_description"] = [error.localizedDescription UTF8String];
|
||||
GameCenter::get_singleton()->connected = false;
|
||||
};
|
||||
|
||||
pending_events.push_back(ret);
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
pending_events.push_back(ret);
|
||||
}];
|
||||
return OK;
|
||||
};
|
||||
|
||||
@ -85,7 +108,9 @@ Error GameCenter::post_score(Variant p_score) {
|
||||
GKScore* reporter = [[[GKScore alloc] initWithCategory:cat_str] autorelease];
|
||||
reporter.value = score;
|
||||
|
||||
[reporter reportScoreWithCompletionHandler:^(NSError* error) {
|
||||
ERR_FAIL_COND_V([GKScore respondsToSelector:@selector(reportScores)], ERR_UNAVAILABLE);
|
||||
|
||||
[GKScore reportScores:@[reporter] withCompletionHandler:^(NSError* error) {
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "post_score";
|
||||
@ -114,8 +139,15 @@ Error GameCenter::award_achievement(Variant p_params) {
|
||||
GKAchievement* achievement = [[[GKAchievement alloc] initWithIdentifier: name_str] autorelease];
|
||||
ERR_FAIL_COND_V(!achievement, FAILED);
|
||||
|
||||
ERR_FAIL_COND_V([GKAchievement respondsToSelector:@selector(reportAchievements)], ERR_UNAVAILABLE);
|
||||
|
||||
achievement.percentComplete = progress;
|
||||
[achievement reportAchievementWithCompletionHandler:^(NSError* error) {
|
||||
achievement.showsCompletionBanner = NO;
|
||||
if (params.has("show_completion_banner")) {
|
||||
achievement.showsCompletionBanner = params["show_completion_banner"] ? YES : NO;
|
||||
}
|
||||
|
||||
[GKAchievement reportAchievements:@[achievement] withCompletionHandler:^(NSError *error) {
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "award_achievement";
|
||||
@ -132,6 +164,168 @@ Error GameCenter::award_achievement(Variant p_params) {
|
||||
return OK;
|
||||
};
|
||||
|
||||
void GameCenter::request_achievement_descriptions() {
|
||||
|
||||
[GKAchievementDescription loadAchievementDescriptionsWithCompletionHandler:^(NSArray *descriptions, NSError *error) {
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "achievement_descriptions";
|
||||
if (error == nil) {
|
||||
ret["result"] = "ok";
|
||||
StringArray names;
|
||||
StringArray titles;
|
||||
StringArray unachieved_descriptions;
|
||||
StringArray achieved_descriptions;
|
||||
IntArray maximum_points;
|
||||
Array hidden;
|
||||
Array replayable;
|
||||
|
||||
for (int i=0; i<[descriptions count]; i++) {
|
||||
|
||||
GKAchievementDescription* description = [descriptions objectAtIndex:i];
|
||||
|
||||
const char* str = [description.identifier UTF8String];
|
||||
names.push_back(String::utf8(str != NULL ? str : ""));
|
||||
|
||||
str = [description.title UTF8String];
|
||||
titles.push_back(String::utf8(str != NULL ? str : ""));
|
||||
|
||||
str = [description.unachievedDescription UTF8String];
|
||||
unachieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
|
||||
|
||||
str = [description.achievedDescription UTF8String];
|
||||
achieved_descriptions.push_back(String::utf8(str != NULL ? str : ""));
|
||||
|
||||
maximum_points.push_back(description.maximumPoints);
|
||||
|
||||
hidden.push_back(description.hidden == YES);
|
||||
|
||||
replayable.push_back(description.replayable == YES);
|
||||
}
|
||||
|
||||
ret["names"] = names;
|
||||
ret["titles"] = titles;
|
||||
ret["unachieved_descriptions"] = unachieved_descriptions;
|
||||
ret["achieved_descriptions"] = achieved_descriptions;
|
||||
ret["maximum_points"] = maximum_points;
|
||||
ret["hidden"] = hidden;
|
||||
ret["replayable"] = replayable;
|
||||
|
||||
} else {
|
||||
ret["result"] = "error";
|
||||
ret["error_code"] = error.code;
|
||||
};
|
||||
|
||||
pending_events.push_back(ret);
|
||||
}];
|
||||
};
|
||||
|
||||
|
||||
void GameCenter::request_achievements() {
|
||||
|
||||
[GKAchievement loadAchievementsWithCompletionHandler:^(NSArray *achievements, NSError *error) {
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "achievements";
|
||||
if (error == nil) {
|
||||
ret["result"] = "ok";
|
||||
StringArray names;
|
||||
RealArray percentages;
|
||||
|
||||
for (int i=0; i<[achievements count]; i++) {
|
||||
|
||||
GKAchievement* achievement = [achievements objectAtIndex:i];
|
||||
const char* str = [achievement.identifier UTF8String];
|
||||
names.push_back(String::utf8(str != NULL ? str : ""));
|
||||
|
||||
percentages.push_back(achievement.percentComplete);
|
||||
}
|
||||
|
||||
ret["names"] = names;
|
||||
ret["progress"] = percentages;
|
||||
|
||||
} else {
|
||||
ret["result"] = "error";
|
||||
ret["error_code"] = error.code;
|
||||
};
|
||||
|
||||
pending_events.push_back(ret);
|
||||
}];
|
||||
};
|
||||
|
||||
void GameCenter::reset_achievements() {
|
||||
|
||||
[GKAchievement resetAchievementsWithCompletionHandler:^(NSError *error)
|
||||
{
|
||||
Dictionary ret;
|
||||
ret["type"] = "reset_achievements";
|
||||
if (error == nil) {
|
||||
ret["result"] = "ok";
|
||||
} else {
|
||||
ret["result"] = "error";
|
||||
ret["error_code"] = error.code;
|
||||
};
|
||||
|
||||
pending_events.push_back(ret);
|
||||
}];
|
||||
};
|
||||
|
||||
Error GameCenter::show_game_center(Variant p_params) {
|
||||
|
||||
ERR_FAIL_COND_V(!NSProtocolFromString(@"GKGameCenterControllerDelegate"), FAILED);
|
||||
|
||||
Dictionary params = p_params;
|
||||
|
||||
GKGameCenterViewControllerState view_state = GKGameCenterViewControllerStateDefault;
|
||||
if (params.has("view")) {
|
||||
String view_name = params["view"];
|
||||
if (view_name == "default") {
|
||||
view_state = GKGameCenterViewControllerStateDefault;
|
||||
}
|
||||
else if (view_name == "leaderboards") {
|
||||
view_state = GKGameCenterViewControllerStateLeaderboards;
|
||||
}
|
||||
else if (view_name == "achievements") {
|
||||
view_state = GKGameCenterViewControllerStateAchievements;
|
||||
}
|
||||
else if (view_name == "challenges") {
|
||||
view_state = GKGameCenterViewControllerStateChallenges;
|
||||
}
|
||||
else {
|
||||
return ERR_INVALID_PARAMETER;
|
||||
}
|
||||
}
|
||||
|
||||
GKGameCenterViewController *controller = [[GKGameCenterViewController alloc] init];
|
||||
ERR_FAIL_COND_V(!controller, FAILED);
|
||||
|
||||
ViewController *root_controller=(ViewController *)((AppDelegate *)[[UIApplication sharedApplication] delegate]).window.rootViewController;
|
||||
ERR_FAIL_COND_V(!root_controller, FAILED);
|
||||
|
||||
controller.gameCenterDelegate = root_controller;
|
||||
controller.viewState = view_state;
|
||||
if (view_state == GKGameCenterViewControllerStateLeaderboards) {
|
||||
controller.leaderboardIdentifier = nil;
|
||||
if (params.has("leaderboard_name")) {
|
||||
String name = params["leaderboard_name"];
|
||||
NSString* name_str = [[[NSString alloc] initWithUTF8String:name.utf8().get_data()] autorelease];
|
||||
controller.leaderboardIdentifier = name_str;
|
||||
}
|
||||
}
|
||||
|
||||
[root_controller presentViewController: controller animated: YES completion:nil];
|
||||
|
||||
return OK;
|
||||
};
|
||||
|
||||
void GameCenter::game_center_closed() {
|
||||
|
||||
Dictionary ret;
|
||||
ret["type"] = "show_game_center";
|
||||
ret["result"] = "ok";
|
||||
pending_events.push_back(ret);
|
||||
}
|
||||
|
||||
int GameCenter::get_pending_event_count() {
|
||||
|
||||
return pending_events.size();
|
||||
|
@ -352,8 +352,9 @@ static void clear_touches() {
|
||||
// Generate IDs for a framebuffer object and a color renderbuffer
|
||||
UIScreen* mainscr = [UIScreen mainScreen];
|
||||
printf("******** screen size %i, %i\n", (int)mainscr.currentMode.size.width, (int)mainscr.currentMode.size.height);
|
||||
if (mainscr.currentMode.size.width == 640 || mainscr.currentMode.size.width == 960) // modern iphone, can go to 640x960
|
||||
self.contentScaleFactor = 2.0;
|
||||
float minPointSize = MIN(mainscr.bounds.size.width, mainscr.bounds.size.height);
|
||||
float minScreenSize = MIN(mainscr.currentMode.size.width, mainscr.currentMode.size.height);
|
||||
self.contentScaleFactor = minScreenSize / minPointSize;
|
||||
|
||||
glGenFramebuffersOES(1, &viewFramebuffer);
|
||||
glGenRenderbuffersOES(1, &viewRenderbuffer);
|
||||
|
@ -210,7 +210,7 @@ Error InAppStore::request_product_info(Variant p_params) {
|
||||
receipt_to_send = [receipt description];
|
||||
}
|
||||
Dictionary receipt_ret;
|
||||
receipt_ret["receipt"] = String::utf8([receipt_to_send UTF8String]);
|
||||
receipt_ret["receipt"] = String::utf8(receipt_to_send != nil ? [receipt_to_send UTF8String] : "");
|
||||
receipt_ret["sdk"] = sdk_version;
|
||||
ret["receipt"] = receipt_ret;
|
||||
|
||||
|
@ -136,7 +136,8 @@ void OSIPhone::initialize(const VideoMode& p_desired,int p_video_driver,int p_au
|
||||
//
|
||||
physics_server = memnew( PhysicsServerSW );
|
||||
physics_server->init();
|
||||
physics_2d_server = memnew( Physics2DServerSW );
|
||||
//physics_2d_server = memnew( Physics2DServerSW );
|
||||
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
input = memnew( InputDefault );
|
||||
|
@ -38,6 +38,7 @@
|
||||
#include "servers/visual/rasterizer.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
#include "servers/audio/audio_server_sw.h"
|
||||
#include "servers/audio/sample_manager_sw.h"
|
||||
#include "servers/spatial_sound/spatial_sound_server_sw.h"
|
||||
|
@ -27,8 +27,9 @@
|
||||
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
|
||||
/*************************************************************************/
|
||||
#import <UIKit/UIKit.h>
|
||||
#import <GameKit/GameKit.h>
|
||||
|
||||
@interface ViewController : UIViewController {
|
||||
@interface ViewController : UIViewController <GKGameCenterControllerDelegate> {
|
||||
|
||||
};
|
||||
|
||||
|
@ -124,10 +124,15 @@ int add_cmdline(int p_argc, char** p_args) {
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
- (BOOL)prefersStatusBarHidden
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
- (void) gameCenterViewControllerDidFinish:(GKGameCenterViewController*) gameCenterViewController {
|
||||
//[gameCenterViewController dismissViewControllerAnimated:YES completion:^{GameCenter::get_singleton()->game_center_closed();}];//version for signaling when overlay is completely gone
|
||||
GameCenter::get_singleton()->game_center_closed();
|
||||
[gameCenterViewController dismissViewControllerAnimated:YES completion:nil];
|
||||
}
|
||||
|
||||
@end
|
||||
|
@ -240,10 +240,14 @@ MainLoop *OSNacl::get_main_loop() const {
|
||||
return main_loop;
|
||||
};
|
||||
|
||||
OS::Date OSNacl::get_date() const {
|
||||
OS::Date OSNacl::get_date(bool utc) const {
|
||||
|
||||
time_t t=time(NULL);
|
||||
struct tm *lt=localtime(&t);
|
||||
struct tm *lt;
|
||||
if (utc)
|
||||
lt=gmtime(&t);
|
||||
else
|
||||
lt=localtime(&t);
|
||||
Date ret;
|
||||
ret.year=lt->tm_year;
|
||||
ret.month=(Month)lt->tm_mon;
|
||||
@ -254,10 +258,14 @@ OS::Date OSNacl::get_date() const {
|
||||
return ret;
|
||||
};
|
||||
|
||||
OS::Time OSNacl::get_time() const {
|
||||
OS::Time OSNacl::get_time(bool utc) const {
|
||||
|
||||
time_t t=time(NULL);
|
||||
struct tm *lt=localtime(&t);
|
||||
struct tm *lt;
|
||||
if (utc)
|
||||
lt=gmtime(&t);
|
||||
else
|
||||
lt=localtime(&t);
|
||||
Time ret;
|
||||
ret.hour=lt->tm_hour;
|
||||
ret.min=lt->tm_min;
|
||||
@ -265,6 +273,32 @@ OS::Time OSNacl::get_time() const {
|
||||
return ret;
|
||||
};
|
||||
|
||||
OS::TimeZoneInfo OS_Unix::get_time_zone_info() const {
|
||||
time_t t = time(NULL);
|
||||
struct tm *lt = localtime(&t);
|
||||
char name[16];
|
||||
strftime(name, 16, "%Z", lt);
|
||||
name[15] = 0;
|
||||
TimeZoneInfo ret;
|
||||
ret.name = name;
|
||||
|
||||
char bias_buf[16];
|
||||
strftime(bias_buf, 16, "%z", lt);
|
||||
int bias;
|
||||
bias_buf[15] = 0;
|
||||
sscanf(bias_buf, "%d", &bias);
|
||||
|
||||
// convert from ISO 8601 (1 minute=1, 1 hour=100) to minutes
|
||||
int hour = (int)bias / 100;
|
||||
int minutes = bias % 100;
|
||||
if (bias < 0)
|
||||
ret.bias = hour * 60 - minutes;
|
||||
else
|
||||
ret.bias = hour * 60 + minutes;
|
||||
|
||||
return ret;
|
||||
};
|
||||
|
||||
void OSNacl::delay_usec(uint32_t p_usec) const {
|
||||
|
||||
//usleep(p_usec);
|
||||
|
@ -137,8 +137,8 @@ public:
|
||||
|
||||
virtual MainLoop *get_main_loop() const;
|
||||
|
||||
virtual Date get_date() const;
|
||||
virtual Time get_time() const;
|
||||
virtual Date get_date(bool utc) const;
|
||||
virtual Time get_time(bool utc) const;
|
||||
|
||||
virtual void delay_usec(uint32_t p_usec) const;
|
||||
virtual uint64_t get_ticks_usec() const;
|
||||
|
@ -44,6 +44,7 @@
|
||||
#include "drivers/rtaudio/audio_driver_rtaudio.h"
|
||||
#include "drivers/alsa/audio_driver_alsa.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
#include "platform/osx/audio_driver_osx.h"
|
||||
#include <ApplicationServices/ApplicationServices.h>
|
||||
|
||||
|
@ -1015,7 +1015,8 @@ void OS_OSX::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
||||
//
|
||||
physics_server = memnew( PhysicsServerSW );
|
||||
physics_server->init();
|
||||
physics_2d_server = memnew( Physics2DServerSW );
|
||||
//physics_2d_server = memnew( Physics2DServerSW );
|
||||
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
input = memnew( InputDefault );
|
||||
|
@ -201,6 +201,12 @@ def configure(env):
|
||||
|
||||
env.Append(CCFLAGS=['/O2','/DDEBUG_ENABLED'])
|
||||
env.Append(LINKFLAGS=['/SUBSYSTEM:CONSOLE'])
|
||||
elif (env["target"]=="debug_release"):
|
||||
|
||||
env.Append(CCFLAGS=['/Zi','/Od'])
|
||||
env.Append(LINKFLAGS=['/DEBUG'])
|
||||
env.Append(LINKFLAGS=['/SUBSYSTEM:WINDOWS'])
|
||||
env.Append(LINKFLAGS=['/ENTRY:mainCRTStartup'])
|
||||
|
||||
elif (env["target"]=="debug"):
|
||||
|
||||
|
@ -1177,7 +1177,7 @@ void OS_Windows::initialize(const VideoMode& p_desired,int p_video_driver,int p_
|
||||
physics_server = memnew( PhysicsServerSW );
|
||||
physics_server->init();
|
||||
|
||||
physics_2d_server = memnew( Physics2DServerSW );
|
||||
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
if (!is_no_window_mode_enabled()) {
|
||||
@ -1375,6 +1375,9 @@ void OS_Windows::finalize() {
|
||||
physics_2d_server->finish();
|
||||
memdelete(physics_2d_server);
|
||||
|
||||
joystick_change_queue.clear();
|
||||
monitor_info.clear();
|
||||
|
||||
}
|
||||
void OS_Windows::finalize_core() {
|
||||
|
||||
@ -1826,10 +1829,14 @@ String OS_Windows::get_name() {
|
||||
return "Windows";
|
||||
}
|
||||
|
||||
OS::Date OS_Windows::get_date() const {
|
||||
OS::Date OS_Windows::get_date(bool utc) const {
|
||||
|
||||
SYSTEMTIME systemtime;
|
||||
GetSystemTime(&systemtime);
|
||||
if (utc)
|
||||
GetSystemTime(&systemtime);
|
||||
else
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
Date date;
|
||||
date.day=systemtime.wDay;
|
||||
date.month=Month(systemtime.wMonth);
|
||||
@ -1838,10 +1845,13 @@ OS::Date OS_Windows::get_date() const {
|
||||
date.dst=false;
|
||||
return date;
|
||||
}
|
||||
OS::Time OS_Windows::get_time() const {
|
||||
OS::Time OS_Windows::get_time(bool utc) const {
|
||||
|
||||
SYSTEMTIME systemtime;
|
||||
GetLocalTime(&systemtime);
|
||||
if (utc)
|
||||
GetSystemTime(&systemtime);
|
||||
else
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
Time time;
|
||||
time.hour=systemtime.wHour;
|
||||
@ -1850,6 +1860,23 @@ OS::Time OS_Windows::get_time() const {
|
||||
return time;
|
||||
}
|
||||
|
||||
OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
|
||||
TIME_ZONE_INFORMATION info;
|
||||
bool daylight = false;
|
||||
if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT)
|
||||
daylight = true;
|
||||
|
||||
TimeZoneInfo ret;
|
||||
if (daylight) {
|
||||
ret.name = info.DaylightName;
|
||||
} else {
|
||||
ret.name = info.StandardName;
|
||||
}
|
||||
|
||||
ret.bias = info.Bias;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t OS_Windows::get_unix_time() const {
|
||||
|
||||
FILETIME ft;
|
||||
@ -2052,7 +2079,7 @@ String OS_Windows::get_executable_path() const {
|
||||
wchar_t bufname[4096];
|
||||
GetModuleFileNameW(NULL,bufname,4096);
|
||||
String s= bufname;
|
||||
print_line("EXEC PATHP¨®: "+s);
|
||||
print_line("EXEC PATHP??: "+s);
|
||||
return s;
|
||||
}
|
||||
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "servers/spatial_sound_2d/spatial_sound_2d_server_sw.h"
|
||||
#include "drivers/unix/ip_unix.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
|
||||
|
||||
#include <windows.h>
|
||||
@ -258,8 +259,9 @@ public:
|
||||
|
||||
virtual String get_name();
|
||||
|
||||
virtual Date get_date() const;
|
||||
virtual Time get_time() const;
|
||||
virtual Date get_date(bool utc) const;
|
||||
virtual Time get_time(bool utc) const;
|
||||
virtual TimeZoneInfo get_time_zone_info() const;
|
||||
virtual uint64_t get_unix_time() const;
|
||||
|
||||
virtual bool can_draw() const;
|
||||
|
@ -442,10 +442,14 @@ String OSWinrt::get_name() {
|
||||
return "WinRT";
|
||||
}
|
||||
|
||||
OS::Date OSWinrt::get_date() const {
|
||||
OS::Date OSWinrt::get_date(bool utc) const {
|
||||
|
||||
SYSTEMTIME systemtime;
|
||||
GetSystemTime(&systemtime);
|
||||
if (utc)
|
||||
GetSystemTime(&systemtime);
|
||||
else
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
Date date;
|
||||
date.day=systemtime.wDay;
|
||||
date.month=Month(systemtime.wMonth);
|
||||
@ -454,10 +458,13 @@ OS::Date OSWinrt::get_date() const {
|
||||
date.dst=false;
|
||||
return date;
|
||||
}
|
||||
OS::Time OSWinrt::get_time() const {
|
||||
OS::Time OSWinrt::get_time(bool utc) const {
|
||||
|
||||
SYSTEMTIME systemtime;
|
||||
GetSystemTime(&systemtime);
|
||||
if (utc)
|
||||
GetSystemTime(&systemtime);
|
||||
else
|
||||
GetLocalTime(&systemtime);
|
||||
|
||||
Time time;
|
||||
time.hour=systemtime.wHour;
|
||||
@ -466,11 +473,28 @@ OS::Time OSWinrt::get_time() const {
|
||||
return time;
|
||||
}
|
||||
|
||||
OS::TimeZoneInfo OS_Windows::get_time_zone_info() const {
|
||||
TIME_ZONE_INFORMATION info;
|
||||
bool daylight = false;
|
||||
if (GetTimeZoneInformation(&info) == TIME_ZONE_ID_DAYLIGHT)
|
||||
daylight = true;
|
||||
|
||||
TimeZoneInfo ret;
|
||||
if (daylight) {
|
||||
ret.name = info.DaylightName;
|
||||
} else {
|
||||
ret.name = info.StandardName;
|
||||
}
|
||||
|
||||
ret.bias = info.Bias;
|
||||
return ret;
|
||||
}
|
||||
|
||||
uint64_t OSWinrt::get_unix_time() const {
|
||||
|
||||
FILETIME ft;
|
||||
SYSTEMTIME st;
|
||||
GetSystemTime(&st);
|
||||
GetSystemTime(&systemtime);
|
||||
SystemTimeToFileTime(&st, &ft);
|
||||
|
||||
SYSTEMTIME ep;
|
||||
|
@ -198,8 +198,9 @@ public:
|
||||
|
||||
virtual String get_name();
|
||||
|
||||
virtual Date get_date() const;
|
||||
virtual Time get_time() const;
|
||||
virtual Date get_date(bool utc) const;
|
||||
virtual Time get_time(bool utc) const;
|
||||
virtual TimeZoneInfo get_time_zone_info() const;
|
||||
virtual uint64_t get_unix_time() const;
|
||||
|
||||
virtual bool can_draw() const;
|
||||
|
@ -111,9 +111,9 @@ def configure(env):
|
||||
if (env["target"]=="release"):
|
||||
|
||||
if (env["debug_release"]=="yes"):
|
||||
env.Append(CCFLAGS=['-g2','-fomit-frame-pointer'])
|
||||
env.Append(CCFLAGS=['-g2'])
|
||||
else:
|
||||
env.Append(CCFLAGS=['-O2','-ffast-math','-fomit-frame-pointer'])
|
||||
env.Append(CCFLAGS=['-O3','-ffast-math'])
|
||||
|
||||
elif (env["target"]=="release_debug"):
|
||||
|
||||
|
@ -35,6 +35,7 @@
|
||||
#include "print_string.h"
|
||||
#include "servers/physics/physics_server_sw.h"
|
||||
|
||||
|
||||
#include "X11/Xutil.h"
|
||||
|
||||
#include "X11/Xatom.h"
|
||||
@ -426,7 +427,8 @@ void OS_X11::initialize(const VideoMode& p_desired,int p_video_driver,int p_audi
|
||||
//
|
||||
physics_server = memnew( PhysicsServerSW );
|
||||
physics_server->init();
|
||||
physics_2d_server = memnew( Physics2DServerSW );
|
||||
//physics_2d_server = memnew( Physics2DServerSW );
|
||||
physics_2d_server = Physics2DServerWrapMT::init_server<Physics2DServerSW>();
|
||||
physics_2d_server->init();
|
||||
|
||||
input = memnew( InputDefault );
|
||||
|
@ -45,6 +45,7 @@
|
||||
#include "drivers/alsa/audio_driver_alsa.h"
|
||||
#include "drivers/pulseaudio/audio_driver_pulseaudio.h"
|
||||
#include "servers/physics_2d/physics_2d_server_sw.h"
|
||||
#include "servers/physics_2d/physics_2d_server_wrap_mt.h"
|
||||
|
||||
#include <X11/keysym.h>
|
||||
#include <X11/Xlib.h>
|
||||
|
@ -149,11 +149,11 @@ void AnimatedSprite::_notification(int p_what) {
|
||||
|
||||
Size2i s;
|
||||
s = texture->get_size();
|
||||
Point2i ofs=offset;
|
||||
Point2 ofs=offset;
|
||||
if (centered)
|
||||
ofs-=s/2;
|
||||
|
||||
Rect2i dst_rect(ofs,s);
|
||||
Rect2 dst_rect(ofs,s);
|
||||
|
||||
if (hflip)
|
||||
dst_rect.size.x=-dst_rect.size.x;
|
||||
@ -284,7 +284,7 @@ Rect2 AnimatedSprite::get_item_rect() const {
|
||||
return Node2D::get_item_rect();
|
||||
Size2i s = t->get_size();
|
||||
|
||||
Point2i ofs=offset;
|
||||
Point2 ofs=offset;
|
||||
if (centered)
|
||||
ofs-=s/2;
|
||||
|
||||
@ -329,7 +329,7 @@ void AnimatedSprite::_bind_methods() {
|
||||
ADD_SIGNAL(MethodInfo("frame_changed"));
|
||||
|
||||
ADD_PROPERTYNZ( PropertyInfo( Variant::OBJECT, "frames",PROPERTY_HINT_RESOURCE_TYPE,"SpriteFrames"), _SCS("set_sprite_frames"),_SCS("get_sprite_frames"));
|
||||
ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame"), _SCS("set_frame"),_SCS("get_frame"));
|
||||
ADD_PROPERTYNZ( PropertyInfo( Variant::INT, "frame",PROPERTY_HINT_SPRITE_FRAME), _SCS("set_frame"),_SCS("get_frame"));
|
||||
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "centered"), _SCS("set_centered"),_SCS("is_centered"));
|
||||
ADD_PROPERTYNZ( PropertyInfo( Variant::VECTOR2, "offset"), _SCS("set_offset"),_SCS("get_offset"));
|
||||
ADD_PROPERTY( PropertyInfo( Variant::BOOL, "flip_h"), _SCS("set_flip_h"),_SCS("is_flipped_h"));
|
||||
|
@ -52,6 +52,17 @@ bool Area2D::is_gravity_a_point() const{
|
||||
return gravity_is_point;
|
||||
}
|
||||
|
||||
void Area2D::set_gravity_distance_scale(real_t p_scale){
|
||||
|
||||
gravity_distance_scale=p_scale;
|
||||
Physics2DServer::get_singleton()->area_set_param(get_rid(),Physics2DServer::AREA_PARAM_GRAVITY_DISTANCE_SCALE,p_scale);
|
||||
|
||||
}
|
||||
|
||||
real_t Area2D::get_gravity_distance_scale() const{
|
||||
return gravity_distance_scale;
|
||||
}
|
||||
|
||||
void Area2D::set_gravity_vector(const Vector2& p_vec){
|
||||
|
||||
gravity_vec=p_vec;
|
||||
@ -535,6 +546,39 @@ uint32_t Area2D::get_layer_mask() const {
|
||||
return layer_mask;
|
||||
}
|
||||
|
||||
void Area2D::set_collision_mask_bit(int p_bit, bool p_value) {
|
||||
|
||||
uint32_t mask = get_collision_mask();
|
||||
if (p_value)
|
||||
mask|=1<<p_bit;
|
||||
else
|
||||
mask&=~(1<<p_bit);
|
||||
set_collision_mask(mask);
|
||||
|
||||
}
|
||||
|
||||
bool Area2D::get_collision_mask_bit(int p_bit) const{
|
||||
|
||||
return get_collision_mask()&(1<<p_bit);
|
||||
}
|
||||
|
||||
|
||||
void Area2D::set_layer_mask_bit(int p_bit, bool p_value) {
|
||||
|
||||
uint32_t mask = get_layer_mask();
|
||||
if (p_value)
|
||||
mask|=1<<p_bit;
|
||||
else
|
||||
mask&=~(1<<p_bit);
|
||||
set_layer_mask(mask);
|
||||
|
||||
}
|
||||
|
||||
bool Area2D::get_layer_mask_bit(int p_bit) const{
|
||||
|
||||
return get_layer_mask()&(1<<p_bit);
|
||||
}
|
||||
|
||||
|
||||
void Area2D::_bind_methods() {
|
||||
|
||||
@ -550,6 +594,9 @@ void Area2D::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set_gravity_is_point","enable"),&Area2D::set_gravity_is_point);
|
||||
ObjectTypeDB::bind_method(_MD("is_gravity_a_point"),&Area2D::is_gravity_a_point);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_gravity_distance_scale","distance_scale"),&Area2D::set_gravity_distance_scale);
|
||||
ObjectTypeDB::bind_method(_MD("get_gravity_distance_scale"),&Area2D::get_gravity_distance_scale);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_gravity_vector","vector"),&Area2D::set_gravity_vector);
|
||||
ObjectTypeDB::bind_method(_MD("get_gravity_vector"),&Area2D::get_gravity_vector);
|
||||
|
||||
@ -571,6 +618,12 @@ void Area2D::_bind_methods() {
|
||||
ObjectTypeDB::bind_method(_MD("set_layer_mask","layer_mask"),&Area2D::set_layer_mask);
|
||||
ObjectTypeDB::bind_method(_MD("get_layer_mask"),&Area2D::get_layer_mask);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_collision_mask_bit","bit","value"),&Area2D::set_collision_mask_bit);
|
||||
ObjectTypeDB::bind_method(_MD("get_collision_mask_bit","bit"),&Area2D::get_collision_mask_bit);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_layer_mask_bit","bit","value"),&Area2D::set_layer_mask_bit);
|
||||
ObjectTypeDB::bind_method(_MD("get_layer_mask_bit","bit"),&Area2D::get_layer_mask_bit);
|
||||
|
||||
ObjectTypeDB::bind_method(_MD("set_enable_monitoring","enable"),&Area2D::set_enable_monitoring);
|
||||
ObjectTypeDB::bind_method(_MD("is_monitoring_enabled"),&Area2D::is_monitoring_enabled);
|
||||
|
||||
@ -600,6 +653,7 @@ void Area2D::_bind_methods() {
|
||||
|
||||
ADD_PROPERTYNZ( PropertyInfo(Variant::INT,"space_override",PROPERTY_HINT_ENUM,"Disabled,Combine,Replace"),_SCS("set_space_override_mode"),_SCS("get_space_override_mode"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::BOOL,"gravity_point"),_SCS("set_gravity_is_point"),_SCS("is_gravity_a_point"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity_distance_scale", PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_gravity_distance_scale"),_SCS("get_gravity_distance_scale"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::VECTOR2,"gravity_vec"),_SCS("set_gravity_vector"),_SCS("get_gravity_vector"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"gravity",PROPERTY_HINT_RANGE,"-1024,1024,0.01"),_SCS("set_gravity"),_SCS("get_gravity"));
|
||||
ADD_PROPERTY( PropertyInfo(Variant::REAL,"linear_damp",PROPERTY_HINT_RANGE,"0,1024,0.001"),_SCS("set_linear_damp"),_SCS("get_linear_damp"));
|
||||
@ -618,6 +672,7 @@ Area2D::Area2D() : CollisionObject2D(Physics2DServer::get_singleton()->area_crea
|
||||
set_gravity(98);;
|
||||
set_gravity_vector(Vector2(0,1));
|
||||
gravity_is_point=false;
|
||||
gravity_distance_scale=0;
|
||||
linear_damp=0.1;
|
||||
angular_damp=1;
|
||||
locked=false;
|
||||
|
@ -49,6 +49,7 @@ private:
|
||||
Vector2 gravity_vec;
|
||||
real_t gravity;
|
||||
bool gravity_is_point;
|
||||
real_t gravity_distance_scale;
|
||||
real_t linear_damp;
|
||||
real_t angular_damp;
|
||||
uint32_t collision_mask;
|
||||
@ -132,6 +133,9 @@ public:
|
||||
void set_gravity_is_point(bool p_enabled);
|
||||
bool is_gravity_a_point() const;
|
||||
|
||||
void set_gravity_distance_scale(real_t p_scale);
|
||||
real_t get_gravity_distance_scale() const;
|
||||
|
||||
void set_gravity_vector(const Vector2& p_vec);
|
||||
Vector2 get_gravity_vector() const;
|
||||
|
||||
@ -159,6 +163,12 @@ public:
|
||||
void set_layer_mask(uint32_t p_mask);
|
||||
uint32_t get_layer_mask() const;
|
||||
|
||||
void set_collision_mask_bit(int p_bit, bool p_value);
|
||||
bool get_collision_mask_bit(int p_bit) const;
|
||||
|
||||
void set_layer_mask_bit(int p_bit, bool p_value);
|
||||
bool get_layer_mask_bit(int p_bit) const;
|
||||
|
||||
Array get_overlapping_bodies() const; //function for script
|
||||
Array get_overlapping_areas() const; //function for script
|
||||
|
||||
|