From 46b17db96e2651e7b7ea525e987d706845b86c3f Mon Sep 17 00:00:00 2001 From: Vladislav Khorev Date: Tue, 5 Feb 2013 20:40:52 +0000 Subject: [PATCH] ios api --- iOS/ios_api.cpp | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/iOS/ios_api.cpp b/iOS/ios_api.cpp index c949531..92380de 100644 --- a/iOS/ios_api.cpp +++ b/iOS/ios_api.cpp @@ -1,53 +1,56 @@ #include "include/Engine.h" #include "main_code.h" -TMyApplication App; +TMyApplication* App; extern "C" void AppInit() { + CreateEngine(); + App = new TMyApplication; + App->OuterInit(320, 480, 320, 480); - App.OuterInit(320, 480, 320, 480); - //App.OuterInit(480, 320, 480, 320); } - extern "C" void AppDeinit() { - App.OuterDeinit(); + + App->OuterDeinit(); + delete App; + DestroyEngine(); } extern "C" void AppUpdate(int dt) { - App.OuterUpdate(dt); + App->OuterUpdate(dt); } extern "C" void AppDraw() { - App.OuterDraw(); + App->OuterDraw(); } extern "C" void AppOnTapDown(int posx, int posy) { - App.OuterOnTapDown(vec2(posx, posy)); + App->OuterOnTapDown(vec2(posx, posy)); } extern "C" void AppOnTapUp(int posx, int posy) { - App.OuterOnTapUp(vec2(posx, posy)); + App->OuterOnTapUp(vec2(posx, posy)); } extern "C" void AppOnTapUpAfterScroll(int posx, int posy) { - App.OuterOnTapUpAfterShift(vec2(posx, posy)); + App->OuterOnTapUpAfterShift(vec2(posx, posy)); } extern "C" void AppOnScroll(int shiftx, int shifty) { - App.OuterOnMove(vec2(shiftx, shifty)); + App->OuterOnMove(vec2(shiftx, shifty)); }