Android update and small improvements
-fixed code do cross compiling to android -fixed build with GCC (workaround) -added little benchmark -several small fixes -updated meson build (demos building, working with GCC, LDC and DMD) -added some meson options -added ImGUI bind for OpenGL3
This commit is contained in:
parent
86edfa4a57
commit
66860b9042
30 changed files with 1358 additions and 173 deletions
|
|
@ -203,12 +203,10 @@ void mainLoop(void* arg)
|
|||
temp_fps = 0;
|
||||
}
|
||||
|
||||
|
||||
SDL_Event event;
|
||||
while (SDL_PollEvent(&event))
|
||||
{
|
||||
version(WebAssembly)ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
else ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
ImGui_ImplSDL2_ProcessEvent(&event);
|
||||
if(launcher.event)launcher.event(&event);
|
||||
if (event.type == SDL_QUIT || (event.type == SDL_KEYDOWN && event.key.keysym.scancode == SDL_SCANCODE_ESCAPE)) {
|
||||
quit();
|
||||
|
|
@ -278,7 +276,8 @@ void mainLoop(void* arg)
|
|||
}
|
||||
else
|
||||
{
|
||||
ImGuiImplOpenGL2NewFrame();
|
||||
//ImGuiImplOpenGL2NewFrame();
|
||||
ImGui_ImplOpenGL3_NewFrame();
|
||||
ImGuiImplSDL2NewFrame(launcher.window);
|
||||
}
|
||||
|
||||
|
|
@ -632,7 +631,9 @@ void mainLoop(void* arg)
|
|||
|
||||
igRender();
|
||||
version(WebAssembly)ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||
else ImGuiImplOpenGL2RenderDrawData(igGetDrawData());
|
||||
else version(Android)ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||
else ImGui_ImplOpenGL3_RenderDrawData(igGetDrawData());
|
||||
//ImGuiImplOpenGL2RenderDrawData(igGetDrawData());
|
||||
|
||||
//launcher.renderer.clear();
|
||||
//launcher.renderer.present();
|
||||
|
|
@ -652,15 +653,48 @@ void quit()
|
|||
version(WebAssembly)emscripten_cancel_main_loop();
|
||||
}
|
||||
|
||||
int main(int argc, char** argv)
|
||||
version(Android)
|
||||
{
|
||||
export extern (C) int SDL_main(int argc, char** args)
|
||||
{
|
||||
return app_main(argc,args);
|
||||
}
|
||||
|
||||
import ldc.attributes;
|
||||
|
||||
extern (C) __gshared
|
||||
{
|
||||
@section(".tdata")
|
||||
int _tlsstart = 0;
|
||||
@section(".tcommon")
|
||||
int _tlsend = 0;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
extern (C) int main(int argc, char** argv)
|
||||
{
|
||||
return app_main(argc,argv);
|
||||
}
|
||||
}
|
||||
|
||||
int app_main(int argc, char** argv)
|
||||
//int main(int argc, char** argv)
|
||||
{
|
||||
|
||||
version(BindSDL_Static){}
|
||||
else
|
||||
{
|
||||
loadSDL();
|
||||
loadSDLImage();
|
||||
}
|
||||
|
||||
if (SDL_Init(SDL_INIT_VIDEO) < 0)
|
||||
{
|
||||
printf("SDL could not initialize! SDL_Error: %s", SDL_GetError());
|
||||
return -1;
|
||||
}
|
||||
|
||||
SDL_version sdl_version;
|
||||
SDL_GetVersion(&sdl_version);
|
||||
printf("SDL version: %u.%u.%u\n",cast(uint)sdl_version.major,cast(uint)sdl_version.minor,cast(uint)sdl_version.patch);
|
||||
|
|
@ -692,6 +726,21 @@ int main(int argc, char** argv)
|
|||
return -3;
|
||||
}
|
||||
}
|
||||
else version(Android)
|
||||
{
|
||||
//gladLoadGL();
|
||||
gladLoadGLES2(x => SDL_GL_GetProcAddress(x));
|
||||
if(!ImGuiImplSDL2InitForOpenGL(launcher.window,launcher.gl_context))
|
||||
{
|
||||
printf("ImGui initialization failed!");
|
||||
return -2;
|
||||
}
|
||||
if(!ImGui_ImplOpenGL3_Init("#version 100"))
|
||||
{
|
||||
printf("ImGui OpenGL initialization failed!");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
gladLoadGL();
|
||||
|
|
@ -700,13 +749,14 @@ int main(int argc, char** argv)
|
|||
printf("ImGui initialization failed!");
|
||||
return -2;
|
||||
}
|
||||
if(!ImGuiImplOpenGL2Init())
|
||||
//if(!ImGuiImplOpenGL2Init())
|
||||
if(!ImGui_ImplOpenGL3_Init("#version 120"))
|
||||
{
|
||||
printf("ImGui OpenGL initialization failed!");
|
||||
return -3;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
ImFontConfig* config = ImFontConfig_ImFontConfig();
|
||||
ImGuiIO* io = igGetIO();
|
||||
const ushort* font_ranges = ImFontAtlas_GetGlyphRangesDefault(io.Fonts);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue