feat: add android support

This commit is contained in:
2021-11-01 15:24:33 +01:00
parent 8f0e0c48ed
commit 0c68512caf
15 changed files with 38 additions and 29 deletions

View File

@@ -136,7 +136,7 @@ void renderMainMenu() {
static std::string worldFilePath;
ImGui::InputInt("Server Port", &port, -1);
ImGui::Text(std::string("Fichier de monde sélectionné : " + (worldFilePath.empty() ? std::string("Aucun") : worldFilePath)).c_str());
ImGui::Text("%s", std::string("Fichier de monde sélectionné : " + (worldFilePath.empty() ? std::string("Aucun") : worldFilePath)).c_str());
ImGui::SameLine();
if (ImGui::Button("Ouvrir un fichier")) {
ImGui::OpenPopup("WorldFileDialog");
@@ -178,7 +178,7 @@ void showPlayers() {
for (auto pair : client->getGame().getPlayers()) {
const td::game::Player& player = pair.second;
ImGui::PushStyleColor(ImGuiCol_Text, getImGuiTeamColor(player.getTeamColor()));
ImGui::Text(player.getName().c_str());
ImGui::Text("%s", player.getName().c_str());
ImGui::PopStyleColor();
}
ImGui::TreePop();
@@ -321,8 +321,16 @@ void tick() {
lastTime = td::utils::getTime();
}
void pollEvents(){
SDL_Event event;
while(SDL_PollEvent(&event)){
ImGui_ImplSDL2_ProcessEvent(&event);
}
}
void render() {
tick();
pollEvents();
beginFrame();
client->render();
if (client->isConnected())

View File

@@ -107,4 +107,8 @@ namespace ImGui
}
*/
#ifdef ANDROID
#define IMGUI_IMPL_OPENGL_ES3
#else
#define IMGUI_IMPL_OPENGL_LOADER_GLBINDING2
#endif