Skip to content

Commit

Permalink
Revert "Added preprocessor directives to allow building android witho…
Browse files Browse the repository at this point in the history
…ut imgui. (#72013)"

This reverts commit 19c877c.
  • Loading branch information
katemonster33 committed Mar 9, 2024
1 parent 3601a6a commit 253a772
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 34 deletions.
2 changes: 0 additions & 2 deletions src/cata_imgui.cpp
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if !defined(__ANDROID__)
#include "cata_imgui.h"

#include <stack>
Expand Down Expand Up @@ -476,4 +475,3 @@ cataimgui::bounds cataimgui::window::get_bounds()
{
return { -1.f, -1.f, -1.f, -1.f };
}
#endif // #if defined(__ANDROID__)
2 changes: 0 additions & 2 deletions src/cata_imgui.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#if !defined(__ANDROID__)
#pragma once
#include <string>
#include <vector>
Expand Down Expand Up @@ -107,4 +106,3 @@ void load_colors();
#endif

} // namespace cataimgui
#endif // #if defined(__ANDROID)
7 changes: 3 additions & 4 deletions src/input_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,14 @@
#include "string_input_popup.h"
#include "translations.h"
#include "ui_manager.h"
#if !defined(__ANDROID__)
#include "cata_imgui.h"
#include "imgui/imgui.h"

enum class kb_menu_status {
remove, reset, add, add_global, execute, show
};

#if !defined(__ANDROID__)
#include "cata_imgui.h"
#include "imgui/imgui.h"

class keybindings_ui : public cataimgui::window
{
// colors of the keybindings
Expand Down
2 changes: 0 additions & 2 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -168,9 +168,7 @@ void exit_handler( int s )
} else
#endif
{
#if !defined(__ANDROID__)
imclient.reset();
#endif
exit( exit_status );
}
}
Expand Down
12 changes: 6 additions & 6 deletions src/popup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -525,6 +525,7 @@ std::shared_ptr<query_popup_impl> query_popup::create_or_get_impl()
}
return impl;
}
#endif

query_popup::result query_popup::query_once_imgui()
{
Expand Down Expand Up @@ -620,13 +621,18 @@ query_popup::result query_popup::query_once_imgui()
return res;
}


query_popup::result query_popup::query()
{
#if defined(__ANDROID__)
return query_legacy();
#else
if( get_options().has_option( "USE_IMGUI" ) && get_option<bool>( "USE_IMGUI" ) ) {
return query_imgui();
} else {
return query_legacy();
}
#endif
}

query_popup::result query_popup::query_imgui()
Expand All @@ -639,13 +645,7 @@ query_popup::result query_popup::query_imgui()
} while( res.wait_input );
return res;
}
#else

query_popup::result query_popup::query()
{
return query_legacy();
}
#endif

query_popup::result query_popup::query_legacy()
{
Expand Down
2 changes: 0 additions & 2 deletions src/popup.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,9 +245,7 @@ class query_popup
};

std::weak_ptr<ui_adaptor> adaptor;
#if !defined(__ANDROID__)
std::weak_ptr<query_popup_impl> p_impl;
#endif

// UI caches
mutable catacurses::window win;
Expand Down
5 changes: 1 addition & 4 deletions src/sdl_font.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,7 @@

#include "font_loader.h"
#include "output.h"
#if !defined(__ANDROID)
#include "imgui/imgui.h"
#endif
#include "sdl_utils.h"

#if defined(_WIN32)
Expand Down Expand Up @@ -301,7 +299,7 @@ CachedTTFFont::CachedTTFFont(
throw std::runtime_error( TTF_GetError() );
}
TTF_SetFontStyle( font.get(), TTF_STYLE_NORMAL );
#if !defined(__ANDROID__)

ImGuiIO &io = ImGui::GetIO();
if( io.FontDefault == nullptr && typeface.find( "unifont" ) != std::string::npos ) {
static const std::array<ImWchar, 17> ranges = {
Expand All @@ -317,7 +315,6 @@ CachedTTFFont::CachedTTFFont(
};
io.FontDefault = io.Fonts->AddFontFromFileTTF( typeface.c_str(), fontsize, nullptr, ranges.data() );
}
#endif
}

SDL_Texture_Ptr CachedTTFFont::create_glyph( const SDL_Renderer_Ptr &renderer,
Expand Down
8 changes: 0 additions & 8 deletions src/sdltiles.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -74,9 +74,7 @@
#include "wcwidth.h"
#include "cata_imgui.h"

#if !defined(__ANDROID__)
std::unique_ptr<cataimgui::client> imclient;
#endif

#if defined(__linux__)
# include <cstdlib> // getenv()/setenv()
Expand Down Expand Up @@ -423,11 +421,9 @@ static void WinCreate()
geometry = std::make_unique<DefaultGeometryRenderer>();
}

#if !defined(__ANDROID__)
cataimgui::client::sdl_renderer = renderer.get();
cataimgui::client::sdl_window = window.get();
imclient = std::make_unique<cataimgui::client>();
#endif

//io.Fonts->AddFontDefault();
//io.Fonts->Build();
Expand All @@ -438,9 +434,7 @@ static void WinDestroy()
#if defined(__ANDROID__)
touch_joystick.reset();
#endif
#if !defined(__ANDROID__)
imclient.reset();
#endif
shutdown_sound();
tilecontext.reset();
gamepad::quit();
Expand Down Expand Up @@ -2886,9 +2880,7 @@ static void CheckMessages()
bool render_target_reset = false;

while( SDL_PollEvent( &ev ) ) {
#if !defined(__ANDROID__)
imclient->process_input( &ev );
#endif
switch( ev.type ) {
case SDL_WINDOWEVENT:
switch( ev.window.event ) {
Expand Down
2 changes: 0 additions & 2 deletions src/ui_manager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -455,10 +455,8 @@ void ui_adaptor::redraw_invalidated( )
emscripten_sleep( 1 );
#endif

#if !defined(__ANDROID__)
imclient->end_frame();
imgui_frame_started = false;
#endif
}

void ui_adaptor::screen_resized()
Expand Down
2 changes: 0 additions & 2 deletions src/ui_manager.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,12 @@
#include "cuboid_rectangle.h"
#include "point.h"

#if !defined(__ANDROID__)
namespace cataimgui
{
class client;
} // namespace cataimgui

extern std::unique_ptr<cataimgui::client> imclient;
#endif

namespace catacurses
{
Expand Down

0 comments on commit 253a772

Please sign in to comment.