patch ImGui so it supports square textures
in the font atlas
This commit is contained in:
parent
c9b2172c4f
commit
72cd745824
11 changed files with 80 additions and 7 deletions
|
|
@ -4074,6 +4074,9 @@ bool FurnaceGUI::loop() {
|
|||
rend->initGUI(sdlWin);
|
||||
|
||||
logD("building font...");
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error while building font atlas!");
|
||||
showError(_("error while loading fonts! please check your settings."));
|
||||
|
|
@ -4082,7 +4085,12 @@ bool FurnaceGUI::loop() {
|
|||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error again while building font atlas!");
|
||||
}
|
||||
|
|
@ -6692,7 +6700,12 @@ bool FurnaceGUI::loop() {
|
|||
|
||||
applyUISettings();
|
||||
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error while building font atlas!");
|
||||
showError(_("error while loading fonts! please check your settings."));
|
||||
|
|
@ -6701,7 +6714,12 @@ bool FurnaceGUI::loop() {
|
|||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error again while building font atlas!");
|
||||
} else {
|
||||
|
|
@ -6723,7 +6741,12 @@ bool FurnaceGUI::loop() {
|
|||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error again while building font atlas!");
|
||||
} else {
|
||||
|
|
@ -7131,6 +7154,9 @@ bool FurnaceGUI::init() {
|
|||
applyUISettings();
|
||||
|
||||
logD("building font...");
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error while building font atlas!");
|
||||
showError(_("error while loading fonts! please check your settings."));
|
||||
|
|
@ -7139,7 +7165,9 @@ bool FurnaceGUI::init() {
|
|||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error again while building font atlas!");
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1529,6 +1529,7 @@ class FurnaceGUIRender {
|
|||
virtual void drawOsc(float* data, size_t len, ImVec2 pos0, ImVec2 pos1, ImVec4 color, ImVec2 canvasSize, float lineWidth);
|
||||
virtual void present();
|
||||
virtual bool supportsDrawOsc();
|
||||
virtual bool areTexturesSquare();
|
||||
virtual bool getOutputSize(int& w, int& h);
|
||||
virtual int getWindowFlags();
|
||||
virtual int getMaxTextureWidth();
|
||||
|
|
|
|||
|
|
@ -105,6 +105,10 @@ bool FurnaceGUIRender::supportsDrawOsc() {
|
|||
return false;
|
||||
}
|
||||
|
||||
bool FurnaceGUIRender::areTexturesSquare() {
|
||||
return false;
|
||||
}
|
||||
|
||||
int FurnaceGUIRender::getWindowFlags() {
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -469,6 +469,11 @@ void FurnaceGUIRenderDX9::setSwapInterval(int swapInt) {
|
|||
swapInterval=swapInt;
|
||||
}
|
||||
|
||||
// I would use caps but...
|
||||
bool FurnaceGUIRenderDX9::areTexturesSquare() {
|
||||
return true;
|
||||
}
|
||||
|
||||
void FurnaceGUIRenderDX9::preInit(const DivConfig& conf) {
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -59,6 +59,7 @@ class FurnaceGUIRenderDX9: public FurnaceGUIRender {
|
|||
void clear(ImVec4 color);
|
||||
bool newFrame();
|
||||
bool canVSync();
|
||||
bool areTexturesSquare();
|
||||
void createFontsTexture();
|
||||
void destroyFontsTexture();
|
||||
void renderGUI();
|
||||
|
|
|
|||
|
|
@ -225,6 +225,10 @@ int FurnaceGUIRenderGL1::getWindowFlags() {
|
|||
return SDL_WINDOW_OPENGL;
|
||||
}
|
||||
|
||||
bool FurnaceGUIRenderGL1::areTexturesSquare() {
|
||||
return true;
|
||||
}
|
||||
|
||||
int FurnaceGUIRenderGL1::getMaxTextureWidth() {
|
||||
return maxWidth;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -43,6 +43,7 @@ class FurnaceGUIRenderGL1: public FurnaceGUIRender {
|
|||
void clear(ImVec4 color);
|
||||
bool newFrame();
|
||||
bool canVSync();
|
||||
bool areTexturesSquare();
|
||||
void createFontsTexture();
|
||||
void destroyFontsTexture();
|
||||
void renderGUI();
|
||||
|
|
|
|||
|
|
@ -5679,7 +5679,12 @@ void FurnaceGUI::commitSettings() {
|
|||
|
||||
applyUISettings();
|
||||
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error while building font atlas!");
|
||||
showError(_("error while loading fonts! please check your settings."));
|
||||
|
|
@ -5688,7 +5693,12 @@ void FurnaceGUI::commitSettings() {
|
|||
patFont=mainFont;
|
||||
bigFont=mainFont;
|
||||
headFont=mainFont;
|
||||
if (rend) rend->destroyFontsTexture();
|
||||
if (rend) {
|
||||
rend->destroyFontsTexture();
|
||||
if (rend->areTexturesSquare()) {
|
||||
ImGui::GetIO().Fonts->Flags|=ImFontAtlasFlags_Square;
|
||||
}
|
||||
}
|
||||
if (!ImGui::GetIO().Fonts->Build()) {
|
||||
logE("error again while building font atlas!");
|
||||
} else {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue