engine/Templates/SalmonUniversalTemplate/jni/main_code.cpp

96 lines
2.3 KiB
C++
Raw Normal View History

2013-01-19 20:02:34 +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"
void TMyApplication::InnerInit()
{
*Console<<"Inner init go!\n";
#ifdef TARGET_ANDROID
2013-02-21 13:45:27 +00:00
ST::PathToResources = "";
2013-01-19 20:02:34 +00:00
#endif
#ifdef TARGET_WIN32
#ifdef NDEBUG
2013-02-21 13:45:27 +00:00
ST::PathToResources = "resources/";
2013-01-19 20:02:34 +00:00
#else
2013-02-21 13:45:27 +00:00
ST::PathToResources = "../../../assets/";
2013-01-19 20:02:34 +00:00
#endif
#endif
#ifdef TARGET_IOS
2013-02-21 13:45:27 +00:00
ST::PathToResources = "assets/";
2013-01-19 20:02:34 +00:00
#endif
ResourceManager->TexList.AddTexture(CONST_CONSOLE_TEX_NAME);
ResourceManager->ShaderManager.AddShader("DefaultShader", "gui_transparent.vertex", "gui_transparent.fragment");
Renderer->PushShader("DefaultShader");
ResourceManager->FontManager.AddFont("droid_sans14", "droid_sans14_font_bitmap.bmp32", "droid_sans14_font_charmap.txt");
ResourceManager->FontManager.PushFont("droid_sans14");
ResourceManager->SoundManager.LoadMusic("level1ogg.ogg");
ResourceManager->SoundManager.LoadSound("shot.wav");
2013-01-28 13:59:51 +00:00
boost::get<TPanoramicCamera>(Renderer->Camera).MovePhi(pi/6);
boost::get<TPanoramicCamera>(Renderer->Camera).MoveDist(6.f);
2013-01-19 20:02:34 +00:00
2013-01-28 13:59:51 +00:00
boost::get<TPanoramicCamera>(Renderer->Camera).CalcCamVec();
2013-01-19 20:02:34 +00:00
ResourceManager->LightManager.SetLightDirection(vec3(-1,0,-1));
ResourceManager->LightManager.SetLightColor(vec4(1,0,0,1));
ResourceManager->TexList.AddTexture("bt_box_yellow.bmp");
ResourceManager->FlexModelManager.LoadModelFromXml("model.xml");
FlexModel = ResourceManager->FlexModelManager.InstanciateModel("model.xml");
FlexModel.MoveModel(vec3(1, -4, -4));
FlexModel.ScaleModel(0.4f);
FlexModel.RefreshBuffer();
//Uncomment to start music playing
//ResourceManager->SoundManager.PlayMusic("level1ogg.ogg");
2013-01-28 13:59:51 +00:00
Renderer->PushPerspectiveProjectionMatrix(pi/6, Renderer->GetMatrixWidth()/Renderer->GetMatrixHeight(), 1.f, 100.f);
2013-01-19 20:02:34 +00:00
*Console<<"Inner init end!\n";
}
void TMyApplication::InnerDeinit()
{
}
void TMyApplication::InnerDraw()
{
glClearColor(0,0,0,1);
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
Renderer->SetGLCamView();
FlexModel.Draw();
}
void TMyApplication::InnerUpdate(cardinal dt)
{
}