crystal-of-rhylil/jni/main_code.cpp

142 lines
3.9 KiB
C++
Raw Normal View History

2013-01-19 22:25:53 +00:00
#include "main_code.h"
#ifdef TARGET_ANDROID
#include "android_api.h"
#endif
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
#include <time.h>
#include "include/Engine.h"
#include "main_code.h"
#ifndef TARGET_IOS
boost::shared_ptr<TMyApplication> App(new TMyApplication);
#endif
bool animPaused = false;
struct TOnClickTest
{
void operator()()
{
//ResourceManager->ScriptManager.RunScript("5+5;");
if (animPaused)
{
//animPaused = false;
//ResourceManager->HalibutAnimationManager.StartAnimation("test_anim");
//ResourceManager->HalibutAnimationManager.ShowAnimation("test_anim");
//ResourceManager->SoundManager.PlayMusic("finalogg.ogg");
//App->Match3Controller.Match3Field->StartAnimateChip(4,1);
//App->Match3Controller.Match3Field->HighlightMatch3();
}
else
{
//animPaused = true;
//ResourceManager->HalibutAnimationManager.StopAnimation("test_anim");
//ResourceManager->HalibutAnimationManager.HideAnimation("test_anim");
//ResourceManager->SoundManager.StopMusic("finalogg.ogg");
//App->Match3Controller.Match3Field->StopAnimateChip(4,1);
//App->Match3Controller.Match3Field->HighlightMatch3();
}
}
};
//What to do on init
void TMyApplication::InnerInit()
{
#ifdef TARGET_ANDROID
ResourceManager->PathToResources = "";
#endif
#ifdef TARGET_WIN32
#ifdef DEBUG
ResourceManager->PathToResources = "../../assets/";
#else
ResourceManager->PathToResources = "res/";
#endif
#endif
#ifdef TARGET_IOS
ResourceManager->PathToResources = "assets/";
#endif
boost::shared_ptr<boost::property_tree::ptree> px = FileToPropertyTree("function_info_list.xml");
ResourceManager->ScriptManager.Serialize(*px);
px = FileToPropertyTree("shaders.xml");
ResourceManager->ShaderManager.Serialize(*px);
HalibutRender->PushShader("DefaultShader");
px = FileToPropertyTree("textures.xml");
ResourceManager->TexList.Serialize(*px);
px = FileToPropertyTree("fonts.xml");
ResourceManager->FontManager.Serialize(*px);
ResourceManager->FontManager.PushFont("droid_sans14");
ResourceManager->GUIManager.AddWidgetAndFill(boost::shared_ptr<TInstancingWidgetAncestor>(new TSquareButton),
"ololo", "group1",
boost::shared_ptr<TTriangleListFillerAncestor>(new TSquareButtonTriangleListFiller(vec2(100, 100), vec2(200, 200), "button_normal", "button_pressed")));
ResourceManager->GUIManager.AddWidgetAndFill(boost::shared_ptr<TInstancingWidgetAncestor>(new TSquareStatic),
"Background", "group1",
boost::shared_ptr<TSquareStaticTriangleListFiller>(new TSquareStaticTriangleListFiller(vec2(0, 0), vec2(800, 480), "cave_hd")));
ResourceManager->GUIManager.AddWidget(boost::shared_ptr<TInstancingWidgetAncestor>(new TMatch3Field(Match3Controller)),
"match3", "group1");
ResourceManager->GUIManager.MoveWidget("ololo", vec2(-100, 0));
TOnClickTest OnClickTest;
//ResourceManager->GUIManager.GetOnClickSignal("ololo").connect(OnClickTest);
//testAnimObject.Serialize(FileToPropertyTree("test_animation_xml.xml"));
//ResourceManager->HalibutAnimationManager.AddAnimationObject("test_anim", testAnimObject);
//ResourceManager->HalibutAnimationManager.StartAnimation("test_anim");
//ResourceManager->ShaderManager.AddShader("DefaultShader", "shader_vertex.txt", "shader_fragment.txt");
/*HalibutRender->PushShader("DefaultShader");
ResourceManager->TexList.AddTexture(CONST_CONSOLE_TEX_NAME);
ResourceManager->FontManager.AddFont("droid_sans14", "droid_sans14_font_bitmap.bmp32", "droid_sans14_font_charmap.txt");
ResourceManager->FontManager.PushFont("droid_sans14");*/
}
//What to do on deinit
void TMyApplication::InnerDeinit()
{
Inited = false;
}
//What to do on draw
void TMyApplication::InnerDraw()
{
}
//What to do on update. timer means how many ms passed since last update
void TMyApplication::InnerUpdate(cardinal timer)
{
}