sfml

How can I fix this Segmentation fault using SFML?

与世无争的帅哥 提交于 2019-12-13 02:32:42
问题 I am having a segmentation fault error when running this code The error is triggered at the draw function of the custom object. I believe that its related to the address of the window. GameObject *obj = new Dummy; //game loop while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); obj->draw(window); window.display(); } return 0; } I pasted the whole code here 回答1: I fixed it. The problem was that I was

Displaying cyrillic text from file

懵懂的女人 提交于 2019-12-13 02:12:37
问题 Well, I have got a file with cyrillic characters. I am loading it, getting a string from it and then trying to display it with sf::Text. That's what my code looks like: #include <iostream> #include <SFML/Graphics.hpp> #include <fstream> #include <string> using namespace std; int main() { sf::RenderWindow window(sf::VideoMode(800,600),"Learn me"); sf::Text before; wifstream lvl; lvl.open("text.txt"); sf::Font font; font.loadFromFile("CODE2000.ttf"); before.setFont(font); before

can't run a program that uses sfml in Linux

荒凉一梦 提交于 2019-12-13 01:43:59
问题 I am running Linux Mint. The version information is as follows: $ cat /etc/*-release DISTRIB_ID=LinuxMint DISTRIB_RELEASE=12 DISTRIB_CODENAME=lisa DISTRIB_DESCRIPTION="Linux Mint 12 Lisa" I installed sfml by downloading the tar file, going into the sfml folder, and running sudo make install . It does not give me any error messages so it seems safe to assume that it installed successfully. I wrote the clock.cpp program given in this tutorial. I compile it using the following commands: $ g++ -c

#include “glm/ext.hpp” makes the compiler report a __declspec(align('16')) won't be aligned

蓝咒 提交于 2019-12-13 01:00:55
问题 I get the compiler error __declspec(align('16')) won't be aligned . When I click the error, Visual Studio sends me to GLM_IMPLEMENT_SCAL_MULT(vec4) , which is on the scalar_multiplication.hpp file. What is the cause for this compiler error? How can I fix it? Note: Could it be some kind of conflict with the includes? I have several includes in a header file. The commented one is the one that gives the error. // OpenGL Math library #include <glm/glm.hpp> #include <glm/gtc/matrix_transform.hpp>

SFML undefined reference to impl

我只是一个虾纸丫 提交于 2019-12-13 00:49:55
问题 I'm getting the following undefined references when using SFML for GCC 4.7 MinGW (DW2) - 32 bits: g++ -std=c++11 -Wall -I$(SFML_INCLUDE) -o pong main.o main.o:main.cpp: undefined reference to `_imp___ZN2sf6StringC1EPKc RKSt6locale' main.o:main.cpp: undefined reference to `_imp___ZN2sf9VideoModeC1E jjj' main.o:main.cpp: undefined reference to `_imp___ZN2sf12RenderWindo wC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE' main.o:main.cpp: undefined reference to `_imp___ZN2sf11CircleShape

Can't redirect error stream from Cython

笑着哭i 提交于 2019-12-12 22:21:23
问题 The SFML library that I'm trying to cythonize defines this function below that allows to change where errors are printed to (by default SFML writes error messages to the console when this function is not called): namespace sf { std::ostream& err() { static DefaultErrStreamBuf buffer; static std::ostream stream(&buffer); return stream; } } My simplified .pxd file for the above function: cdef extern from 'SFML/System.hpp' namespace 'sf': ostream& cerr 'sf::err' () And my .pyx module, which

SFML Error with C++, Entry Point Not Found

白昼怎懂夜的黑 提交于 2019-12-12 17:01:37
问题 I get the error "The procedure point __gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll How can I fix this? I have no idea and any help would be appreciated. 回答1: Your compiler is using a different version of libstdc++-6.dll then the binary of SFML that you downloaded. What this basically means is that when SFML compiled the version of the library you downloaded they used a different version of libstdc++ then you have on your computer which will obviously

Some C++11 features missing when using Code Blocks 13.12, MinGW 4.8.1 and SFML 2.1

浪子不回头ぞ 提交于 2019-12-12 13:02:37
问题 Turning to Stack Overflow after exhausting all my efforts. I'm running Code Blocks 13.12 and MinGW 4.8.1 on a Windows 7 OS 64bit system. I spent two days trying to get the compiler to link (statically) to the SFML 2.1 library. I followed both the SFML tutorial and this video tutorial- reinstalling both Code Blocks and MinGW twice before it finally linked. After that I was relieved that SFML was recognized, but I got 50 errors when I tried to build and run that suggested C++11 features weren't

C++ Sfml text class Unhandled exception at 0x0F58155F (sfml-graphics-d-2.dll)

て烟熏妆下的殇ゞ 提交于 2019-12-12 06:19:18
问题 Hello I add Text Class to my project , where text is fallowing the moving ball i build is successful, but when i trying debuging i receive Unhandled exception at 0x0F58155F (sfml-graphics-d-2.dll) in Lotto.exe: 0xC0000005: Access violation reading location 0xCCCCCD24. My main.cpp #include <iostream> #include <SFML/Graphics.hpp> #include "Ball.h" #include "Line.h" #include "TextBall.h" using namespace std; using namespace sf; int main() { RenderWindow win(VideoMode(800, 600), L"Rozdział 1");

Make Object Move Smoothly In C++-SFML

对着背影说爱祢 提交于 2019-12-12 04:56:46
问题 Hey Guys I'm a Beginner in Game Development with C++ and Sfml I Wrote this code to make that purple Object move,but the problem is that it doesn't move smoothly, it's like the text input, How to fix That ? Here Is My code : #include <SFML/Graphics.hpp> int main() { sf::ContextSettings settings; settings.antialiasingLevel = 12; sf::RenderWindow window(sf::VideoMode(640, 480), "Ala Eddine", sf::Style::Default, settings); sf::CircleShape player(20, 5); player.setFillColor(sf::Color(150, 70, 250)