forked from Green-Sky/tomato
add imgui stylign window + change how texture filters are applied
This commit is contained in:
parent
93140231c6
commit
2647c85323
@ -191,6 +191,12 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
if (ImGui::BeginMenu("Settings")) {
|
||||
if (ImGui::MenuItem("ImGui Style Editor")) {
|
||||
_show_tool_style_editor = true;
|
||||
}
|
||||
ImGui::EndMenu();
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
@ -198,6 +204,12 @@ Screen* MainScreen::render(float time_delta, bool&) {
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if (_show_tool_style_editor) {
|
||||
if (ImGui::Begin("Dear ImGui Style Editor", &_show_tool_style_editor)) {
|
||||
ImGui::ShowStyleEditor();
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
||||
if constexpr (false) {
|
||||
ImGui::ShowDemoWindow();
|
||||
|
@ -64,6 +64,8 @@ struct MainScreen final : public Screen {
|
||||
ToxUIUtils tuiu;
|
||||
ToxDHTCapHisto tdch;
|
||||
|
||||
bool _show_tool_style_editor {false};
|
||||
|
||||
bool _window_hidden {false};
|
||||
bool _window_hidden_ts {0};
|
||||
float _time_since_event {0.f};
|
||||
|
@ -17,16 +17,15 @@ uint64_t SDLRendererTextureUploader::uploadRGBA(const uint8_t* data, uint32_t wi
|
||||
);
|
||||
assert(surf); // TODO: add error reporting
|
||||
|
||||
// TODO: this touches global state, reset?
|
||||
if (filter == NEAREST) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
} else if (filter == LINEAR) {
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "linear");
|
||||
}
|
||||
|
||||
SDL_Texture* tex = SDL_CreateTextureFromSurface(renderer, surf);
|
||||
assert(tex); // TODO: add error reporting
|
||||
|
||||
if (filter == NEAREST) {
|
||||
SDL_SetTextureScaleMode(tex, SDL_SCALEMODE_NEAREST);
|
||||
} else if (filter == LINEAR) {
|
||||
SDL_SetTextureScaleMode(tex, SDL_SCALEMODE_LINEAR);
|
||||
}
|
||||
|
||||
SDL_DestroySurface(surf);
|
||||
|
||||
return reinterpret_cast<uint64_t>(tex);
|
||||
|
@ -116,7 +116,6 @@ void SettingsWindow::render(void) {
|
||||
}
|
||||
ImGui::EndMenuBar();
|
||||
}
|
||||
|
||||
}
|
||||
ImGui::End();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user