Skip to content
Snippets Groups Projects
Commit 1e6fdf68 authored by DarkGod's avatar DarkGod
Browse files

Merge branch 'master' of git.net-core.org:darkgod/t-engine4

parents 5282fda8 09dabac1
No related branches found
No related tags found
No related merge requests found
......@@ -310,7 +310,7 @@ end
--- Called by the engine when the user tries to close the window
function _M:onExit()
if core.steam then core.steam.exit() end
os.exit()
core.game.exit_engine()
end
--- Sets up a text flyers
......
......@@ -65,7 +65,7 @@ function _M:init()
d.__showup = nil
tween(1, {a=1}, {a=2}, 'linear', function()
game:unregisterDialog(d)
if i < 500 then i = i + 1 return fct() end
if i < 500 then i = i + 1 return fct() else core.game.exit_engine() end
end)
end
fct()
......
......@@ -297,6 +297,14 @@ void on_event(SDL_Event *event)
case SDL_TEXTINPUT:
if (current_keyhandler != LUA_NOREF)
{
static Uint32 lastts = 0;
static char lastc = 0;
if (event->text.timestamp == lastts) break;
if ((event->text.timestamp - lastts < 5) && (lastc == event->text.text[0])) break;
lastts = event->text.timestamp;
lastc = event->text.text[0];
printf("<==text event %ld : '%s'\n", (long int)event->text.timestamp, event->text.text);
lua_rawgeti(L, LUA_REGISTRYINDEX, current_keyhandler);
lua_pushstring(L, "receiveKey");
lua_gettable(L, -2);
......@@ -313,8 +321,10 @@ void on_event(SDL_Event *event)
lua_pushstring(L, event->text.text);
lua_pushboolean(L, FALSE);
lua_pushnil(L);
lua_pushnil(L);
lua_pushnumber(L, 0);
docall(L, 9, 0);
docall(L, 11, 0);
}
break;
case SDL_KEYDOWN:
......@@ -1232,6 +1242,7 @@ int main(int argc, char *argv[])
if (!strncmp(arg, "--home", 6)) override_home = strdup(argv[++i]);
if (!strncmp(arg, "--no-steam", 10)) no_steam = TRUE;
if (!strncmp(arg, "--type=zygote", 13)) is_zygote = TRUE;
if (!strncmp(arg, "--type=renderer", 15)) is_zygote = TRUE;
}
#ifdef SELFEXE_WINDOWS
......@@ -1493,6 +1504,7 @@ int main(int argc, char *argv[])
}
// Clean up locks.
printf("Cleaning up!\n");
cleanupTimerLock(renderingLock, &display_timer_id, &redraw_pending);
cleanupTimerLock(realtimeLock, &realtime_timer_id, &realtime_pending);
......
......@@ -297,6 +297,7 @@ static void handle_event(WebEvent *event) {
break;
case TE4_WEB_EVENT_DOWNLOAD_REQUEST:
printf("[WEBCORE] download request %ld = %s :: %s :: %s\n", event->data.download_request.id, event->data.download_request.url, event->data.download_request.name, event->data.download_request.mime);
lua_rawgeti(he_L, LUA_REGISTRYINDEX, event->handlers);
lua_pushstring(he_L, "on_download_request");
lua_gettable(he_L, -2);
......@@ -311,6 +312,7 @@ static void handle_event(WebEvent *event) {
break;
case TE4_WEB_EVENT_DOWNLOAD_UPDATE:
printf("[WEBCORE] download update %ld = %ld :: %ld :: %d :: %ld\n", event->data.download_update.id, event->data.download_update.got, event->data.download_update.total, event->data.download_update.percent, event->data.download_update.speed);
lua_rawgeti(he_L, LUA_REGISTRYINDEX, event->handlers);
lua_pushstring(he_L, "on_download_update");
lua_gettable(he_L, -2);
......@@ -326,12 +328,13 @@ static void handle_event(WebEvent *event) {
break;
case TE4_WEB_EVENT_DOWNLOAD_FINISH:
printf("[WEBCORE] download finish %ld\n", event->data.download_finish.id);
lua_rawgeti(he_L, LUA_REGISTRYINDEX, event->handlers);
lua_pushstring(he_L, "on_download_finish");
lua_gettable(he_L, -2);
lua_remove(he_L, -2);
if (!lua_isnil(he_L, -1)) {
lua_pushnumber(he_L, event->data.download_update.id);
lua_pushnumber(he_L, event->data.download_finish.id);
docall(he_L, 1, 0);
} else lua_pop(he_L, 1);
break;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment