sfml

On creation of a new file it shows “<SFML/Graphics.hpp> no such file or directory”

狂风中的少年 提交于 2019-12-11 14:49:52
问题 Whenever I create a new file or class in code blocks and include Graphics header or any sfml header the compiler says no such file or directory. When I work on a single file program works fine but when I create a new file and include the file in the same project then compiler starts showing errors. It is showing this error: E:\codes\sfml_project\main.cpp:1:29: fatal error: SFML/Graphics.hpp: No such file or directory I even tried installing SFML 2.1 again and linking all the files to

Qt Creator is not displaying SFML windows

╄→гoц情女王★ 提交于 2019-12-11 14:28:44
问题 I've recently set up qt creator to work with SFML, and I tried running a piece of code as a test to see if it works. I must note the code bellow works perfectly in Codeblocks IDE but in qt creator it simply displays a console with the text "Press RETURN to close this window..." #include <SFML/System.hpp> #include <SFML/Window.hpp> #include <iostream> using namespace std; using namespace sf; Window w(VideoMode(350,350,32), "Tic Tac Toe"); Event e1; const Input& in1 = w.GetInput(); int main() {

setting up sfml

喜欢而已 提交于 2019-12-11 13:16:07
问题 I'm following the sfml getting started guide for version 2 and codeblocks and did everything the tutorial told me to do : downloaded and unzipped the sdk added the path to the sfml headers and libraries linked the libraries graphics, window and system but the sample code doesnt work. I'm getting the error message that sfml-graphics-d-2.dll is missing. Compilation works, the window opens but remains black and this error pops up. Here's the link to the tutorial http://www.sfml-dev.org/tutorials

cant open file .exe 1104 [duplicate]

为君一笑 提交于 2019-12-11 11:42:19
问题 This question already has answers here : LINK : fatal error LNK1104: cannot open file 'D:\…\MyProj.exe' (15 answers) Closed last month . I'm using sfml 2.0. I know I can ask on there forum but I don't think it has anything to do with linking a library wrong because I compiled an example project fine and it's pretty much the exact same thin I'm just trying to incorporate an external class. I get this when I try to compile 1> LINK : fatal error LNK1104: cannot open file 'C:\Users\brr\documents

Making shader takes vertexArray as canvas instead of the window

☆樱花仙子☆ 提交于 2019-12-11 09:29:09
问题 Currently developing an open source GUI SFML based library, but struggling a bit with shaders. So far I've managed to render shader with no problem, but instead of applying the shader on the current object, it's apply it for the whole window, but only visible in the object range. Here's my simple code: #include <SFML/Window.hpp> #include <SFML/Graphics.hpp> #include <iostream> const char *glsl = R"( #version 330 core uniform vec2 u_resolution; void main() { vec2 pos = gl_FragCoord.xy / u

SFML 2.1 RenderWindow linking error

左心房为你撑大大i 提交于 2019-12-11 08:25:55
问题 My code: #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(800, 600), "SFML window"); while(window.isOpen()) { sf::Event Event; while(window.pollEvent(Event)) { if(Event.type == sf::Event::Closed || Event.key.code == sf::Keyboard::Escape) window.close(); } window.display(); } return 0; } My compiler call: g++ main.cpp -framework SFML -lsfml-graphics -lsfml-window -lsfml-system The error message: Undefined symbols for architecture x86_64: "sf::RenderWindow:

Using tiles in SFML and collision detection

匆匆过客 提交于 2019-12-11 08:17:30
问题 I decided to look a good tileset to use and found some, but the question is how I actually load the tile from the image file as there seem to be more than one tile in one file? Also how do I implement a collision detection for non square tiles? Example: Tileset 回答1: Images(sfml1.6) or Textures (sfml2.0) are usually drawn using sf::Sprite . The usual way to do it is to let all sprites share the same tileset texture/image, and then use sf::Sprite::SetSubRect(const IntRect &SubRect) to set the

SFML 2D game – Smooth spaceship movement

戏子无情 提交于 2019-12-11 08:10:38
问题 I am trying to make a simple game in C++ by using xcode as compiler and SFML as library. So far I have created a GUI, a background and a sprite (for the spaceship). I have also added arrow keys detection in order to be able to move the object, but the problem is that when i move the object it doesn't move smoothly and you can see it is kind of "jumping". main.cpp #include <SFML/Audio.hpp> #include <SFML/Graphics.hpp> #include "Spaceship.hpp" #include <vector> // Here is a small helper for you

Can we make an array of sprites in SFML/C++?

久未见 提交于 2019-12-11 08:09:47
问题 My question is very simple. Can we make an array of sprites or images in SFML. For example: int myArray[] = {1, 2, 3}; Consider index number one, two and three are three different images. How can we do it? Can anyone explain with some code example? 回答1: Try std::vector<sf::Sprite> myArray; or sf::Sprite myArray[3]; Check out the answer of this question. The main part is: // Create a texture sf::Texture invaderTexture; // Load image file into that texture invaderTexture.loadFromFile("images

Errors with SFML on Netbeans C++ project

ぐ巨炮叔叔 提交于 2019-12-11 08:08:28
问题 I'm working on a c++ with Netbeans (on Windows). I'm trying to get SMFL to work. #include <iostream> #include <cstdlib> #include <time.h> #include <SFML/Graphics.hpp> #include <SFML/Window.hpp> using namespace std; /* * */ int main(int argc, char** argv) { RenderWindow window(VideoMode(600, 800), "TITLE"); cout << "Hello World!"; return 0; } When I launch the application I get the following errors. main.cpp:31: undefined reference to `__imp__ZN2sf6StringC1EPKcRKSt6locale' main.cpp:31: