Comments (4)
I've found it.
You have to resetGLStates for SFML window, otherwise this happens.
from sfgui.
Hi there,
Could you provide a bit more info to help narrow down the cause of your problem?
- SFML libraries: static/shared and version
- SFGUI libraries: static/shared (You kind of already provided the version: 0.4.0, I assume compiled with Visual Studio 15 2017, was it 64 bits or 32 bits?)
- The code that is failing
- A font file that is failing for you, if possible.
I don't think hardware info would be relevant, however, any compilation warning, OpenGL warnings or else would be welcome.
from sfgui.
Ok.
SFML 2.5.1 binary release for Visual Studio 15 32 bit, static
SFGUI 0.4.0, compiled with Visual Studio 15, in 32 bit as static lib.
As for the font, I have used "lato" from google fonts, "arial" from my system, "linden_hill" shipped with sfgui, some random font from web, and of course sfgui default font. They work if I use them in example project, so I doubt it is the matter. Code is almost copy/paste from exemple so the same here. I currently test for my project configuration differences.
The code:
#include <SFML/GpuPreference.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <SFGUI/SFGUI.hpp>
#include <SFGUI/Desktop.hpp>
class App {
public:
App();
void run();
private:
void handleEvents();
void update(const sf::Time & dt);
void render();
sf::RenderWindow m_renderWindow;
sfg::SFGUI m_gui;
sfg::Desktop m_guiDesktop;
};
App::App() : m_renderWindow(sf::VideoMode(1280, 720), "FPS: 0", sf::Style::Close) {
m_renderWindow.setVerticalSyncEnabled(true);
m_guiDesktop.SetProperties(
"Window, Button {"
" FontName: assets/fonts/linden_hill.otf;"
" FontSize: 24;"
"}"
);
auto guiWindow = sfg::Window::Create();
guiWindow->SetTitle("This is the window title!");
auto button = sfg::Button::Create("Hello");
guiWindow->Add(button);
m_guiDesktop.Add(guiWindow);
}
void App::run() {
sf::Clock clock;
while (m_renderWindow.isOpen()) {
handleEvents();
update(clock.restart());
render();
}
}
void App::handleEvents() {
sf::Event e;
while (m_renderWindow.pollEvent(e)) {
m_guiDesktop.HandleEvent(e);
switch (e.type) {
case sf::Event::Closed:
m_renderWindow.close();
break;
}
}
}
void App::update(const sf::Time & dt) {
m_guiDesktop.Update(dt.asSeconds());
// .. stuff updating fps counter ..
}
void App::render() {
m_renderWindow.clear();
m_gui.Display(m_renderWindow);
m_renderWindow.display();
}
And these are errors I'm getting when I close sfml window. I do not get them when closing example.
EDIT:
I run through project configuration of my project, example project and sfgui project, I checked every compiler and linker switch and problem still occures. I've created new project within cmake generated solution and problem occures also. I'm runnign out of ideas.
from sfgui.
Awesome! Glad you figured it out. I also noticed that the samples were chronically sending a lot of GL errors on closing BTW, in my project I solved that by making sure no draw
calls were called after the window is closed. (In my case, that meant leaving the main loop after polling event, before updating or drawing.)
from sfgui.
Related Issues (20)
- Can't expand ScrolledWindow children
- No obvious way to prevent window dragging. HOT 2
- sfgui apps crash immediately HOT 9
- Errors while batch build HOT 2
- Better integration in modern workflow HOT 4
- Trying to use with codeblocks HOT 13
- Update include/SFGUI/Config.hpp Version Information HOT 1
- Clipboard support HOT 1
- Undefined reference while trying to static linking with mingw32 HOT 1
- Sample projects crash when run in debug on Windows HOT 4
- Can't build on macOS 10.15 HOT 1
- Global state HOT 4
- Create The Style Reference
- How can I set the size of a widget or of a button? HOT 1
- Examples are miniature on Mac OS (Retina) HOT 2
- Password cursor moves away from current typing point HOT 2
- feature request: color picker
- Naming of engine's source files
- Problem on RenderBatch.hpp could not be found!
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sfgui.