Conflicts:
	modules/multiscript/register_types.cpp
	platform/android/java/src/com/android/godot/GodotLib.java
This commit is contained in:
Juan Linietsky 2014-03-13 23:14:35 -03:00
commit 0a717ffee2
24 changed files with 598 additions and 87 deletions

11
.gitignore vendored
View File

@ -116,6 +116,11 @@ ipch/
*.vsp
*.vspx
# CodeLite project files
*.project
*.workspace
.codelite/
# TFS 2012 Local Workspace
$tf/
@ -151,6 +156,9 @@ AutoTest.Net/
# Installshield output folder
[Ee]xpress/
# dumpdoc generated files
doc/html/class_list
# DocProject is a documentation generator add-in
DocProject/buildhelp/
DocProject/Help/*.HxT
@ -198,6 +206,9 @@ ClientBin/
*.publishsettings
node_modules/
# KDE
.directory
# RIA/Silverlight projects
Generated_Code/

View File

@ -6,6 +6,16 @@ import os.path
import glob
import sys
import methods
import multiprocessing
# Enable aggresive compile mode if building on a multi core box
# only is we have not set the number of jobs already or we do
# not want it
if ARGUMENTS.get('spawn_jobs', 'yes') == 'yes' and \
int(GetOption('num_jobs')) <= 1:
NUM_JOBS = multiprocessing.cpu_count()
if NUM_JOBS > 1:
SetOption('num_jobs', NUM_JOBS+1)
methods.update_version()

View File

@ -479,6 +479,36 @@ bool test_26() {
return captures.size();
};
struct test_27_data {
char const * data;
char const * begin;
bool expected;
};
bool test_27() {
OS::get_singleton()->print("\n\nTest 26: begins_with\n");
test_27_data tc[] = {
{"res://foobar", "res://", true},
{"res", "res://", false},
{"abc", "abc", true}
};
size_t count = sizeof(tc) / sizeof(tc[0]);
bool state = true;
for (size_t i = 0;state && i < count; ++i) {
String s = tc[i].data;
state = s.begins_with(tc[i].begin) == tc[i].expected;
if (state) {
String sb = tc[i].begin;
state = s.begins_with(sb) == tc[i].expected;
}
if (!state) {
OS::get_singleton()->print("\n\t Failure on:\n\t\tstring: ", tc[i].data, "\n\t\tbegin: ", tc[i].begin, "\n\t\texpected: ", tc[i].expected ? "true" : "false", "\n");
}
};
return state;
};
typedef bool (*TestFunc)(void);
TestFunc test_funcs[] = {
@ -509,6 +539,7 @@ TestFunc test_funcs[] = {
test_24,
test_25,
test_26,
test_27,
0
};

View File

@ -55,7 +55,7 @@ int Compression::compress(uint8_t *p_dst, const uint8_t *p_src, int p_src_size,M
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
if (err==Z_OK)
if (err!=Z_OK)
return -1;
strm.avail_in=p_src_size;
@ -93,7 +93,7 @@ int Compression::get_max_compressed_buffer_size(int p_src_size,Mode p_mode){
strm.zfree = zipio_free;
strm.opaque = Z_NULL;
int err = deflateInit(&strm,Z_DEFAULT_COMPRESSION);
if (err==Z_OK)
if (err!=Z_OK)
return -1;
int aout = deflateBound(&strm,p_src_size);
deflateEnd(&strm);

View File

@ -38,7 +38,7 @@ class MemoryPoolDynamicStatic : public MemoryPoolDynamic {
_THREAD_SAFE_CLASS_
enum {
MAX_CHUNKS=16384
MAX_CHUNKS=65536
};

View File

@ -2501,19 +2501,21 @@ bool String::begins_with(const String& p_string) const {
const CharType *src=&p_string[0];
const CharType *str=&operator[](0);
for (int i=0;i<l;i++) {
int i = 0;
for (;i<l;i++) {
if (src[i]!=str[i])
return false;
}
return true;
// only if i == l the p_string matches the beginning
return i == l;
}
bool String::begins_with(const char* p_string) const {
int l=length();
if (l==0)
if (l==0||!p_string)
return false;
const CharType *str=&operator[](0);

View File

@ -20966,7 +20966,7 @@
<argument index="0" name="linear_velocity" type="Vector2">
</argument>
<description>
Set the body linear velocity. Can be used sporadically, but[b] DONT SET THIS IN EVERY FRAME [b], because physics may be running in another thread and definitely runs at a different granularity. Use [_integrate_forces] as your process loop if you want to have precise control of the body state.
Set the body linear velocity. Can be used sporadically, but[b] DONT SET THIS IN EVERY FRAME [/b], because physics may be running in another thread and definitely runs at a different granularity. Use [_integrate_forces] as your process loop if you want to have precise control of the body state.
</description>
</method>
<method name="get_linear_velocity" qualifiers="const" >
@ -20980,7 +20980,7 @@
<argument index="0" name="angular_velocity" type="real">
</argument>
<description>
Set the body angular velocity. Can be used sporadically, but[b] DONT SET THIS IN EVERY FRAME [b], because physics may be running in another thread and definitely runs at a different granularity. Use [_integrate_forces] as your process loop if you want to have precise control of the body state.
Set the body angular velocity. Can be used sporadically, but[b] DONT SET THIS IN EVERY FRAME [/b], because physics may be running in another thread and definitely runs at a different granularity. Use [_integrate_forces] as your process loop if you want to have precise control of the body state.
</description>
</method>
<method name="get_angular_velocity" qualifiers="const" >

18
doc/make_doc.sh Normal file → Executable file
View File

@ -1,5 +1,17 @@
#! /bin/bash
cd html/class_list
python ../../../tools/docdump/makehtml.py -multipage ../../base/classes.xml
cd ../..
here="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
godotHome=$(dirname "$here")
docTarget=${here}/html/class_list
toolsRoot=${godotHome}/tools
throw() {
echo "$@" >&2
exit 1
}
[ -d "$docTarget" ] || mkdir -p "$docTarget" || throw "Could not create doc target $docTarget"
cd "$docTarget"
python ${toolsRoot}/docdump/makehtml.py -multipage ${here}/base/classes.xml
cd "$here"

30
makefile Normal file
View File

@ -0,0 +1,30 @@
#*************************************************************************/
#* This file is part of: */
#* GODOT ENGINE */
#* http://www.godotengine.org */
#*************************************************************************/
# Simple makefile to give support for external C/C++ IDEs */
#*************************************************************************/
# Default build
all: debug
# Release Build
release:
scons target="release" bin/godot
# Profile Build
profile:
scons target="profile" bin/godot
# Debug Build
debug:
# Debug information (code size gets severely affected):
# g: Default (same as g2)
# g0: no debug info
# g1: minimal info
# g3: maximal info
scons target="debug" CCFLAGS="-g" bin/godot
clean:
scons -c bin/godot

View File

@ -215,6 +215,7 @@ GDParser::Node* GDParser::_parse_expression(Node *p_parent,bool p_static,bool p_
String path = tokenizer->get_token_constant();
if (!path.is_abs_path() && base_path!="")
path=base_path+"/"+path;
path = path.replace("///","//");
Ref<Resource> res = ResourceLoader::load(path);
if (!res.is_valid()) {

View File

@ -303,13 +303,44 @@ public class Godot extends Activity implements SensorEventListener
return true;
}
@Override public boolean onKeyMultiple(final int inKeyCode, int repeatCount, KeyEvent event) {
String s = event.getCharacters();
if (s == null || s.length() == 0)
return super.onKeyMultiple(inKeyCode, repeatCount, event);
final char[] cc = s.toCharArray();
int cnt = 0;
for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0);
if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event);
final Activity me = this;
queueEvent(new Runnable() {
// This method will be called on the rendering thread:
public void run() {
for (int i = 0, n = cc.length; i < n; i++) {
int keyCode;
if ((keyCode = cc[i]) != 0) {
// Simulate key down and up...
GodotLib.key(0, keyCode, true);
GodotLib.key(0, keyCode, false);
}
}
}
});
return true;
}
private void queueEvent(Runnable runnable) {
// TODO Auto-generated method stub
}
@Override public boolean onKeyUp(int keyCode, KeyEvent event) {
GodotLib.key(event.getUnicodeChar(0), false);
GodotLib.key(keyCode, event.getUnicodeChar(0), false);
return super.onKeyUp(keyCode, event);
};
@Override public boolean onKeyDown(int keyCode, KeyEvent event) {
GodotLib.key(event.getUnicodeChar(0), true);
GodotLib.key(keyCode, event.getUnicodeChar(0), true);
return super.onKeyDown(keyCode, event);
}

View File

@ -51,7 +51,11 @@ public class GodotLib {
public static native void step();
public static native void touch(int what,int pointer,int howmany, int[] arr);
public static native void accelerometer(float x, float y, float z);
<<<<<<< HEAD
public static native void key(int p_unicode_char, boolean p_pressed);
=======
public static native void key(int p_scancode, int p_unicode_char, boolean p_pressed);
>>>>>>> 81757d2e977d959e6b0bc26f9fa990417ca91de9
public static native void focusin();
public static native void focusout();
public static native void audio();

View File

@ -38,6 +38,7 @@
#include "globals.h"
#include "thread_jandroid.h"
#include "core/os/keyboard.h"
static OS_Android *os_android=NULL;
@ -965,14 +966,280 @@ JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_touch(JNIEnv * env, jobje
}
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint ev, jint p_unicode_char, jboolean p_pressed) {
/*
* Android Key codes.
*/
enum {
AKEYCODE_UNKNOWN = 0,
AKEYCODE_SOFT_LEFT = 1,
AKEYCODE_SOFT_RIGHT = 2,
AKEYCODE_HOME = 3,
AKEYCODE_BACK = 4,
AKEYCODE_CALL = 5,
AKEYCODE_ENDCALL = 6,
AKEYCODE_0 = 7,
AKEYCODE_1 = 8,
AKEYCODE_2 = 9,
AKEYCODE_3 = 10,
AKEYCODE_4 = 11,
AKEYCODE_5 = 12,
AKEYCODE_6 = 13,
AKEYCODE_7 = 14,
AKEYCODE_8 = 15,
AKEYCODE_9 = 16,
AKEYCODE_STAR = 17,
AKEYCODE_POUND = 18,
AKEYCODE_DPAD_UP = 19,
AKEYCODE_DPAD_DOWN = 20,
AKEYCODE_DPAD_LEFT = 21,
AKEYCODE_DPAD_RIGHT = 22,
AKEYCODE_DPAD_CENTER = 23,
AKEYCODE_VOLUME_UP = 24,
AKEYCODE_VOLUME_DOWN = 25,
AKEYCODE_POWER = 26,
AKEYCODE_CAMERA = 27,
AKEYCODE_CLEAR = 28,
AKEYCODE_A = 29,
AKEYCODE_B = 30,
AKEYCODE_C = 31,
AKEYCODE_D = 32,
AKEYCODE_E = 33,
AKEYCODE_F = 34,
AKEYCODE_G = 35,
AKEYCODE_H = 36,
AKEYCODE_I = 37,
AKEYCODE_J = 38,
AKEYCODE_K = 39,
AKEYCODE_L = 40,
AKEYCODE_M = 41,
AKEYCODE_N = 42,
AKEYCODE_O = 43,
AKEYCODE_P = 44,
AKEYCODE_Q = 45,
AKEYCODE_R = 46,
AKEYCODE_S = 47,
AKEYCODE_T = 48,
AKEYCODE_U = 49,
AKEYCODE_V = 50,
AKEYCODE_W = 51,
AKEYCODE_X = 52,
AKEYCODE_Y = 53,
AKEYCODE_Z = 54,
AKEYCODE_COMMA = 55,
AKEYCODE_PERIOD = 56,
AKEYCODE_ALT_LEFT = 57,
AKEYCODE_ALT_RIGHT = 58,
AKEYCODE_SHIFT_LEFT = 59,
AKEYCODE_SHIFT_RIGHT = 60,
AKEYCODE_TAB = 61,
AKEYCODE_SPACE = 62,
AKEYCODE_SYM = 63,
AKEYCODE_EXPLORER = 64,
AKEYCODE_ENVELOPE = 65,
AKEYCODE_ENTER = 66,
AKEYCODE_DEL = 67,
AKEYCODE_GRAVE = 68,
AKEYCODE_MINUS = 69,
AKEYCODE_EQUALS = 70,
AKEYCODE_LEFT_BRACKET = 71,
AKEYCODE_RIGHT_BRACKET = 72,
AKEYCODE_BACKSLASH = 73,
AKEYCODE_SEMICOLON = 74,
AKEYCODE_APOSTROPHE = 75,
AKEYCODE_SLASH = 76,
AKEYCODE_AT = 77,
AKEYCODE_NUM = 78,
AKEYCODE_HEADSETHOOK = 79,
AKEYCODE_FOCUS = 80, // *Camera* focus
AKEYCODE_PLUS = 81,
AKEYCODE_MENU = 82,
AKEYCODE_NOTIFICATION = 83,
AKEYCODE_SEARCH = 84,
AKEYCODE_MEDIA_PLAY_PAUSE= 85,
AKEYCODE_MEDIA_STOP = 86,
AKEYCODE_MEDIA_NEXT = 87,
AKEYCODE_MEDIA_PREVIOUS = 88,
AKEYCODE_MEDIA_REWIND = 89,
AKEYCODE_MEDIA_FAST_FORWARD = 90,
AKEYCODE_MUTE = 91,
AKEYCODE_PAGE_UP = 92,
AKEYCODE_PAGE_DOWN = 93,
AKEYCODE_PICTSYMBOLS = 94,
AKEYCODE_SWITCH_CHARSET = 95,
AKEYCODE_BUTTON_A = 96,
AKEYCODE_BUTTON_B = 97,
AKEYCODE_BUTTON_C = 98,
AKEYCODE_BUTTON_X = 99,
AKEYCODE_BUTTON_Y = 100,
AKEYCODE_BUTTON_Z = 101,
AKEYCODE_BUTTON_L1 = 102,
AKEYCODE_BUTTON_R1 = 103,
AKEYCODE_BUTTON_L2 = 104,
AKEYCODE_BUTTON_R2 = 105,
AKEYCODE_BUTTON_THUMBL = 106,
AKEYCODE_BUTTON_THUMBR = 107,
AKEYCODE_BUTTON_START = 108,
AKEYCODE_BUTTON_SELECT = 109,
AKEYCODE_BUTTON_MODE = 110,
// NOTE: If you add a new keycode here you must also add it to several other files.
// Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list.
};
struct _WinTranslatePair {
unsigned int keysym;
unsigned int keycode;
};
static _WinTranslatePair _ak_to_keycode[]={
{ KEY_TAB, AKEYCODE_TAB },
{ KEY_ENTER, AKEYCODE_ENTER },
{ KEY_SHIFT, AKEYCODE_SHIFT_LEFT },
{ KEY_SHIFT, AKEYCODE_SHIFT_RIGHT },
{ KEY_ALT, AKEYCODE_ALT_LEFT },
{ KEY_ALT, AKEYCODE_ALT_RIGHT },
{ KEY_MENU, AKEYCODE_MENU },
{ KEY_PAUSE, AKEYCODE_MEDIA_PLAY_PAUSE },
{ KEY_ESCAPE, AKEYCODE_BACK },
{ KEY_SPACE, AKEYCODE_SPACE },
{ KEY_PAGEUP, AKEYCODE_PAGE_UP },
{ KEY_PAGEDOWN, AKEYCODE_PAGE_DOWN },
{ KEY_HOME, AKEYCODE_HOME },//(0x24)
{ KEY_LEFT, AKEYCODE_DPAD_LEFT },
{ KEY_UP, AKEYCODE_DPAD_UP },
{ KEY_RIGHT, AKEYCODE_DPAD_RIGHT },
{ KEY_DOWN, AKEYCODE_DPAD_DOWN},
{ KEY_PERIODCENTERED, AKEYCODE_DPAD_CENTER },
{ KEY_BACKSPACE, AKEYCODE_DEL},
{ KEY_0, AKEYCODE_0 },////0 key
{ KEY_1, AKEYCODE_1 },////1 key
{ KEY_2, AKEYCODE_2 },////2 key
{ KEY_3, AKEYCODE_3 },////3 key
{ KEY_4, AKEYCODE_4 },////4 key
{ KEY_5, AKEYCODE_5 },////5 key
{ KEY_6, AKEYCODE_6 },////6 key
{ KEY_7, AKEYCODE_7 },////7 key
{ KEY_8, AKEYCODE_8 },////8 key
{ KEY_9, AKEYCODE_9 },////9 key
{ KEY_A, AKEYCODE_A },////A key
{ KEY_B, AKEYCODE_B },////B key
{ KEY_C, AKEYCODE_C },////C key
{ KEY_D, AKEYCODE_D },////D key
{ KEY_E, AKEYCODE_E },////E key
{ KEY_F, AKEYCODE_F },////F key
{ KEY_G, AKEYCODE_G },////G key
{ KEY_H, AKEYCODE_H },////H key
{ KEY_I, AKEYCODE_I },////I key
{ KEY_J, AKEYCODE_J },////J key
{ KEY_K, AKEYCODE_K },////K key
{ KEY_L, AKEYCODE_L },////L key
{ KEY_M, AKEYCODE_M },////M key
{ KEY_N, AKEYCODE_N },////N key
{ KEY_O, AKEYCODE_O },////O key
{ KEY_P, AKEYCODE_P },////P key
{ KEY_Q, AKEYCODE_Q },////Q key
{ KEY_R, AKEYCODE_R },////R key
{ KEY_S, AKEYCODE_S },////S key
{ KEY_T, AKEYCODE_T },////T key
{ KEY_U, AKEYCODE_U },////U key
{ KEY_V, AKEYCODE_V },////V key
{ KEY_W, AKEYCODE_W },////W key
{ KEY_X, AKEYCODE_X },////X key
{ KEY_Y, AKEYCODE_Y },////Y key
{ KEY_Z, AKEYCODE_Z },////Z key
{ KEY_HOMEPAGE, AKEYCODE_EXPLORER},
{ KEY_LAUNCH0, AKEYCODE_BUTTON_A},
{ KEY_LAUNCH1, AKEYCODE_BUTTON_B},
{ KEY_LAUNCH2, AKEYCODE_BUTTON_C},
{ KEY_LAUNCH3, AKEYCODE_BUTTON_X},
{ KEY_LAUNCH4, AKEYCODE_BUTTON_Y},
{ KEY_LAUNCH5, AKEYCODE_BUTTON_Z},
{ KEY_LAUNCH6, AKEYCODE_BUTTON_L1},
{ KEY_LAUNCH7, AKEYCODE_BUTTON_R1},
{ KEY_LAUNCH8, AKEYCODE_BUTTON_L2},
{ KEY_LAUNCH9, AKEYCODE_BUTTON_R2},
{ KEY_LAUNCHA, AKEYCODE_BUTTON_THUMBL},
{ KEY_LAUNCHB, AKEYCODE_BUTTON_THUMBR},
{ KEY_LAUNCHC, AKEYCODE_BUTTON_START},
{ KEY_LAUNCHD, AKEYCODE_BUTTON_SELECT},
{ KEY_LAUNCHE, AKEYCODE_BUTTON_MODE},
{ KEY_VOLUMEMUTE, AKEYCODE_MUTE},
{ KEY_VOLUMEDOWN, AKEYCODE_VOLUME_DOWN},
{ KEY_VOLUMEUP, AKEYCODE_VOLUME_UP},
{ KEY_BACK, AKEYCODE_MEDIA_REWIND },
{ KEY_FORWARD, AKEYCODE_MEDIA_FAST_FORWARD },
{ KEY_MEDIANEXT, AKEYCODE_MEDIA_NEXT },
{ KEY_MEDIAPREVIOUS, AKEYCODE_MEDIA_PREVIOUS },
{ KEY_MEDIASTOP, AKEYCODE_MEDIA_STOP },
{ KEY_PLUS, AKEYCODE_PLUS },
{ KEY_EQUAL, AKEYCODE_EQUALS},// the '+' key
{ KEY_COMMA, AKEYCODE_COMMA},// the ',' key
{ KEY_MINUS, AKEYCODE_MINUS},// the '-' key
{ KEY_SLASH, AKEYCODE_SLASH},// the '/?' key
{ KEY_BACKSLASH, AKEYCODE_BACKSLASH},
{ KEY_BRACKETLEFT, AKEYCODE_LEFT_BRACKET},
{ KEY_BRACKETRIGHT, AKEYCODE_RIGHT_BRACKET},
{ KEY_UNKNOWN, 0} };
/*
TODO: map these android key:
AKEYCODE_SOFT_LEFT = 1,
AKEYCODE_SOFT_RIGHT = 2,
AKEYCODE_CALL = 5,
AKEYCODE_ENDCALL = 6,
AKEYCODE_STAR = 17,
AKEYCODE_POUND = 18,
AKEYCODE_POWER = 26,
AKEYCODE_CAMERA = 27,
AKEYCODE_CLEAR = 28,
AKEYCODE_SYM = 63,
AKEYCODE_ENVELOPE = 65,
AKEYCODE_GRAVE = 68,
AKEYCODE_SEMICOLON = 74,
AKEYCODE_APOSTROPHE = 75,
AKEYCODE_AT = 77,
AKEYCODE_NUM = 78,
AKEYCODE_HEADSETHOOK = 79,
AKEYCODE_FOCUS = 80, // *Camera* focus
AKEYCODE_NOTIFICATION = 83,
AKEYCODE_SEARCH = 84,
AKEYCODE_PICTSYMBOLS = 94,
AKEYCODE_SWITCH_CHARSET = 95,
*/
static unsigned int android_get_keysym(unsigned int p_code) {
for(int i=0;_ak_to_keycode[i].keysym!=KEY_UNKNOWN;i++) {
if (_ak_to_keycode[i].keycode==p_code) {
//print_line("outcode: " + _ak_to_keycode[i].keysym);
return _ak_to_keycode[i].keysym;
}
}
return KEY_UNKNOWN;
}
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed) {
InputEvent ievent;
ievent.type = InputEvent::KEY;
ievent.device = 0;
int val = p_unicode_char;
ievent.key.scancode = val;
int scancode = android_get_keysym(p_scancode);
ievent.key.scancode = scancode;
ievent.key.unicode = val;
ievent.key.pressed = p_pressed;
print_line("Scancode: " + String::num(p_scancode) + ":" + String::num(ievent.key.scancode) + " Unicode: " + String::num(val));
ievent.key.mod.shift=false;
ievent.key.mod.alt=false;
ievent.key.mod.control=false;
ievent.key.echo=false;
if (val == 61448) {
ievent.key.scancode = KEY_BACKSPACE;
ievent.key.unicode = KEY_BACKSPACE;

View File

@ -42,7 +42,7 @@ extern "C" {
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_step(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_quit(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_touch(JNIEnv * env, jobject obj, jint ev,jint pointer, jint count, jintArray positions);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint ev, jint p_unicode_char, jboolean p_pressed);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_key(JNIEnv * env, jobject obj, jint p_scancode, jint p_unicode_char, jboolean p_pressed);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_audio(JNIEnv * env, jobject obj);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_accelerometer(JNIEnv * env, jobject obj, jfloat x, jfloat y, jfloat z);
JNIEXPORT void JNICALL Java_com_android_godot_GodotLib_focusin(JNIEnv * env, jobject obj);

View File

@ -29,6 +29,7 @@
#include "os_windows.h"
#include "main/main.h"
#include <stdio.h>
#include <locale.h>
PCHAR*
CommandLineToArgvA(
@ -114,15 +115,42 @@ PCHAR*
return argv;
}
char* mb_to_utf8(const char* mbs) {
int wlen = MultiByteToWideChar(CP_ACP,0,mbs,-1,NULL,0); // returns 0 if failed
wchar_t *wbuf = new wchar_t[wlen + 1];
MultiByteToWideChar(CP_ACP,0,mbs,-1,wbuf,wlen);
wbuf[wlen]=0;
int ulen = WideCharToMultiByte(CP_UTF8,0,wbuf,-1,NULL,0,NULL,NULL);
char * ubuf = new char[ulen + 1];
WideCharToMultiByte(CP_UTF8,0,wbuf,-1,ubuf,ulen,NULL,NULL);
ubuf[ulen] = 0;
return ubuf;
}
int main(int argc, char** argv) {
OS_Windows os(NULL);
Main::setup(argv[0], argc - 1, &argv[1]);
setlocale(LC_CTYPE, "");
char ** argv_utf8 = new char*[argc];
for(int i=0; i<argc; ++i) {
argv_utf8[i] = mb_to_utf8(argv[i]);
}
Main::setup(argv_utf8[0], argc - 1, &argv_utf8[1]);
if (Main::start())
os.run();
Main::cleanup();
for (int i=0; i<argc; ++i) {
delete[] argv_utf8[i];
}
delete[] argv_utf8;
return os.get_exit_code();
};

View File

@ -608,6 +608,28 @@ void OS_Windows::process_key_events() {
switch(ke.uMsg) {
case WM_CHAR: {
if ((i==0 && ke.uMsg==WM_CHAR) || (i>0 && key_event_buffer[i-1].uMsg==WM_CHAR))
{
InputEvent event;
event.type=InputEvent::KEY;
event.ID=++last_id;
InputEventKey &k=event.key;
k.mod=ke.mod_state;
k.pressed=true;
k.scancode=KeyMappingWindows::get_keysym(ke.wParam);
k.unicode=ke.wParam;
if (k.unicode && gr_mem) {
k.mod.alt=false;
k.mod.control=false;
}
if (k.unicode<32)
k.unicode=0;
input->parse_input_event(event);
}
//do nothing
} break;

View File

@ -748,6 +748,11 @@ bool LineEdit::is_secret() const {
void LineEdit::select(int p_from, int p_to) {
if (p_from==0 && p_to==0) {
selection_clear();
return;
}
int len = text.length();
if (p_from<0)
p_from=0;
@ -786,7 +791,7 @@ void LineEdit::_bind_methods() {
ObjectTypeDB::bind_method(_MD("is_editable"),&LineEdit::is_editable);
ObjectTypeDB::bind_method(_MD("set_secret","enabled"),&LineEdit::set_secret);
ObjectTypeDB::bind_method(_MD("is_secret"),&LineEdit::is_secret);
ObjectTypeDB::bind_method(_MD("select","from","to"),&LineEdit::is_secret,DEFVAL(0),DEFVAL(-1));
ObjectTypeDB::bind_method(_MD("select","from","to"),&LineEdit::select,DEFVAL(0),DEFVAL(-1));
ADD_SIGNAL( MethodInfo("text_changed", PropertyInfo( Variant::STRING, "text" )) );
ADD_SIGNAL( MethodInfo("text_entered", PropertyInfo( Variant::STRING, "text" )) );

View File

@ -1,31 +1,32 @@
/*************************************************************************/
/* space_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
/*************************************************************************/
/* space_sw.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "globals.h"
#include "space_sw.h"
#include "collision_solver_sw.h"
#include "physics_server_sw.h"
@ -351,8 +352,8 @@ void SpaceSW::set_param(PhysicsServer::SpaceParameter p_param, real_t p_value) {
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: contact_recycle_radius=p_value; break;
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: contact_max_separation=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: contact_max_allowed_penetration=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_treshold=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_treshold=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: body_linear_velocity_sleep_threshold=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: body_angular_velocity_sleep_threshold=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: body_time_to_sleep=p_value; break;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: body_angular_velocity_damp_ratio=p_value; break;
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: constraint_bias=p_value; break;
@ -366,8 +367,8 @@ real_t SpaceSW::get_param(PhysicsServer::SpaceParameter p_param) const {
case PhysicsServer::SPACE_PARAM_CONTACT_RECYCLE_RADIUS: return contact_recycle_radius;
case PhysicsServer::SPACE_PARAM_CONTACT_MAX_SEPARATION: return contact_max_separation;
case PhysicsServer::SPACE_PARAM_BODY_MAX_ALLOWED_PENETRATION: return contact_max_allowed_penetration;
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_treshold;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_treshold;
case PhysicsServer::SPACE_PARAM_BODY_LINEAR_VELOCITY_SLEEP_TRESHOLD: return body_linear_velocity_sleep_threshold;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_SLEEP_TRESHOLD: return body_angular_velocity_sleep_threshold;
case PhysicsServer::SPACE_PARAM_BODY_TIME_TO_SLEEP: return body_time_to_sleep;
case PhysicsServer::SPACE_PARAM_BODY_ANGULAR_VELOCITY_DAMP_RATIO: return body_angular_velocity_damp_ratio;
case PhysicsServer::SPACE_PARAM_CONSTRAINT_DEFAULT_BIAS: return constraint_bias;
@ -404,8 +405,8 @@ SpaceSW::SpaceSW() {
contact_max_allowed_penetration= 0.01;
constraint_bias = 0.01;
body_linear_velocity_sleep_treshold=0.01;
body_angular_velocity_sleep_treshold=(8.0 / 180.0 * Math_PI);
body_linear_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_linear",0.1);
body_angular_velocity_sleep_threshold=GLOBAL_DEF("physics/sleep_threshold_angular", (8.0 / 180.0 * Math_PI) );
body_time_to_sleep=0.5;
body_angular_velocity_damp_ratio=10;

View File

@ -1,31 +1,31 @@
/*************************************************************************/
/* space_sw.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
/*************************************************************************/
/* space_sw.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* http://www.godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2014 Juan Linietsky, Ariel Manzur. */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#ifndef SPACE_SW_H
#define SPACE_SW_H
@ -87,8 +87,8 @@ class SpaceSW {
CollisionObjectSW *intersection_query_results[INTERSECTION_QUERY_MAX];
int intersection_query_subindex_results[INTERSECTION_QUERY_MAX];
float body_linear_velocity_sleep_treshold;
float body_angular_velocity_sleep_treshold;
float body_linear_velocity_sleep_threshold;
float body_angular_velocity_sleep_threshold;
float body_time_to_sleep;
float body_angular_velocity_damp_ratio;
@ -129,8 +129,8 @@ public:
_FORCE_INLINE_ real_t get_contact_max_separation() const { return contact_max_separation; }
_FORCE_INLINE_ real_t get_contact_max_allowed_penetration() const { return contact_max_allowed_penetration; }
_FORCE_INLINE_ real_t get_constraint_bias() const { return constraint_bias; }
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_treshold; }
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_treshold; }
_FORCE_INLINE_ real_t get_body_linear_velocity_sleep_treshold() const { return body_linear_velocity_sleep_threshold; }
_FORCE_INLINE_ real_t get_body_angular_velocity_sleep_treshold() const { return body_angular_velocity_sleep_threshold; }
_FORCE_INLINE_ real_t get_body_time_to_sleep() const { return body_time_to_sleep; }
_FORCE_INLINE_ real_t get_body_angular_velocity_damp_ratio() const { return body_angular_velocity_damp_ratio; }

View File

@ -410,6 +410,8 @@ public:
static void add_editor_plugin(EditorPlugin *p_editor);
static void remove_editor_plugin(EditorPlugin *p_editor);
static EditorNode * get_singleton() { return singleton; }
void edit_node(Node *p_node);
void edit_resource(const Ref<Resource>& p_resource);

View File

@ -1507,7 +1507,7 @@ ScriptEditorPlugin::ScriptEditorPlugin(EditorNode *p_node) {
EDITOR_DEF("external_editor/use_external_editor",false);
EDITOR_DEF("external_editor/exec_path","");
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_FILE));
EditorSettings::get_singleton()->add_property_hint(PropertyInfo(Variant::STRING,"external_editor/exec_path",PROPERTY_HINT_GLOBAL_FILE));
EDITOR_DEF("external_editor/exec_flags","");
}

View File

@ -51,7 +51,7 @@ void CustomPropertyEditor::_notification(int p_what) {
VisualServer::get_singleton()->canvas_item_add_rect(ci, Rect2( 10,10,60, get_size().height-20 ), v );
}*/
}
}
}
@ -1397,6 +1397,53 @@ void CustomPropertyEditor::_modified(String p_string) {
updating=false;
}
void CustomPropertyEditor::_focus_enter() {
switch(type) {
case Variant::REAL:
case Variant::STRING:
case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::PLANE:
case Variant::QUAT:
case Variant::_AABB:
case Variant::MATRIX32:
case Variant::MATRIX3:
case Variant::TRANSFORM: {
for (int i=0;i<MAX_VALUE_EDITORS;++i) {
if (value_editor[i]->has_focus()) {
value_editor[i]->select_all();
break;
}
}
} break;
default: {}
}
}
void CustomPropertyEditor::_focus_exit() {
switch(type) {
case Variant::REAL:
case Variant::STRING:
case Variant::VECTOR2:
case Variant::RECT2:
case Variant::VECTOR3:
case Variant::PLANE:
case Variant::QUAT:
case Variant::_AABB:
case Variant::MATRIX32:
case Variant::MATRIX3:
case Variant::TRANSFORM: {
for (int i=0;i<MAX_VALUE_EDITORS;++i) {
value_editor[i]->select(0, 0);
}
} break;
default: {}
}
}
void CustomPropertyEditor::config_action_buttons(const List<String>& p_strings) {
int w=100;
@ -1456,6 +1503,8 @@ void CustomPropertyEditor::config_value_editors(int p_amount, int p_columns,int
void CustomPropertyEditor::_bind_methods() {
ObjectTypeDB::bind_method("_focus_enter", &CustomPropertyEditor::_focus_enter);
ObjectTypeDB::bind_method("_focus_exit", &CustomPropertyEditor::_focus_exit);
ObjectTypeDB::bind_method("_modified",&CustomPropertyEditor::_modified);
ObjectTypeDB::bind_method("_scroll_modified",&CustomPropertyEditor::_scroll_modified);
ObjectTypeDB::bind_method("_action_pressed",&CustomPropertyEditor::_action_pressed);
@ -1487,6 +1536,8 @@ CustomPropertyEditor::CustomPropertyEditor() {
value_editor[i]->hide();
value_label[i]->hide();
value_editor[i]->connect("text_entered", this,"_modified");
value_editor[i]->connect("focus_enter", this, "_focus_enter");
value_editor[i]->connect("focus_exit", this, "_focus_exit");
}
for(int i=0;i<4;i++) {

View File

@ -105,6 +105,8 @@ class CustomPropertyEditor : public Popup {
void _file_selected(String p_file);
void _scroll_modified(double p_value);
void _modified(String p_string);
void _focus_enter();
void _focus_exit();
void _action_pressed(int p_which);
void _type_create_selected(int p_idx);

View File

@ -715,7 +715,8 @@ void SceneTreeDialog::_cancel() {
void SceneTreeDialog::_select() {
if (tree->get_selected()) {
emit_signal("selected",tree->get_selected()->get_path());
Node *scene = EditorNode::get_singleton()->get_edited_scene();
emit_signal("selected","/root/" + scene->get_parent()->get_path_to(tree->get_selected()));
hide();
}
}