sfml

'sf::texture' not a member of 'sf'

岁酱吖の 提交于 2019-12-12 04:39:27
问题 Hey I just started tinkering with SFML. The line of code sf::Texture texture; causes the error: game.cpp:12:2: error: ‘Texture’ is not a member of ‘sf’ sf::Texture texture; I feel like the directory /usr/includes/SFML/Graphics/ should contain a Texture.hpp file, Which it doesn't. Could that be it? 回答1: Here you go: The SFML download page If building from the source is overwhelming for you, that page provides a Linux build. Or if building from the source is what you're aiming for, you'd better

Linking SFML in CodeLite

半腔热情 提交于 2019-12-12 04:15:57
问题 Ok so I am trying to link SFML in a CodeLite project but with no success. So what have I done : Added the include folder of SFML to the IncludePaths of CodeLite. Added the lib folder of SFML to the LibrariesSearchPath of CodeLite. Added SFML_STATIC to Preprocessors in CodeLite. Added the libraries to the LinkerOptions like this : sfml-graphics;sfml-window;sfml-audio;sfml-network;sfml-system Added the 5 dll's(sfml-graphics-2.dll.. etc) to the debug folder and to the project folder This is the

OpenGL lighting changing based on look direction

萝らか妹 提交于 2019-12-12 03:13:59
问题 AKA What am I doing wrong? I've been messing around with OpenGL and I'm just trying to work on lighting a cube right now. I'm not sure if I'm understanding what I'm supposed to do correctly because when I move the camera around, the lighting on the cube changes. For example: Looking at the cube from the top down: Looking at the cube from the side: From searching around all of the answers that I've seen say that this happens when the normal isn't set correctly, but I think they are being set

2D Isometric(diamond shape) game engine - Reversed sprites

倾然丶 夕夏残阳落幕 提交于 2019-12-12 03:06:48
问题 All my sprites are reversed when I try to draw my isometric map. Here is the tileset.png mentionned in the following code : Object.h/Object.cpp I can use them to draw tiles, UI element, etc. ... #pragma once class Object { public: //FUNCTIONS Object(); void addComponent(float value); int getComponent(float index); void editComponent(float index, float value); void deleteComponent(float index); private: vector<int> components; }; #include "Object.cpp" - #pragma once //FUNCTIONS Object::Object(

SFML TCP packet receive

ぐ巨炮叔叔 提交于 2019-12-12 01:35:00
问题 I send a packet as client to server and I want to the server sends that packet forward to all client, here is the code: #include <iostream> #include <SFML/Network.hpp> using namespace std; int main() { int fromID; // receive data from 'fromID' int Message; // fromID's message sf::SocketTCP Listener; if (!Listener.Listen(4567)) return 1; // Create a selector for handling several sockets (the listener + the socket associated to each client) sf::SelectorTCP Selector; Selector.Add(Listener);

C++ SFML Sprite not being drawn through classes

大憨熊 提交于 2019-12-11 23:13:32
问题 (No, I do not mean the very basics of displaying a sprite. I simply could not think of a better title since I do not fully understand what is going wrong.) Simply put, I have a sprite that, when being drawn to the screen, will not show up, but if I do some tests by making temporary sprites in int main() and draw them to the screen, they show up perfectly fine. So I know that I am doing something wrong with the design of my classes or something because they are where the sprites will not show.

SFML Displaying Sprite Error 0xC0000005: Access violation reading location 0x00D54000

血红的双手。 提交于 2019-12-11 19:32:30
问题 I wrote this code while following the tutorial for SFML in C++: #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(600, 400), "Sandstorm"); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(sf::Color::Black); sf::Texture back; if (!back.loadFromFile("greenBack.png")) return 1; sf::Sprite sprite; sprite.setTexture(back); window.draw(sprite); window.display(); } return 0;

Animating sprites in sfml from a sprite sheet

时光总嘲笑我的痴心妄想 提交于 2019-12-11 17:25:07
问题 I am trying to animate a sprite in sfml. At the moment I am able to move the sprite and change it's image when moving in a different direction, but I want to animate it while it is moving. I am thinking that there might be a way to accomplish this with sf::Clock or there might be a better way. All sprites are on the same sprite sheet so I just need to find a way to change the X and Y coordinates of the textureRect based on a time while moving in a direction. If I am missing something or you

How to set fixed drawing speed and world steps in Box2D and SFML?

岁酱吖の 提交于 2019-12-11 16:59:51
问题 There is a simple project, Box2D is engaged in physics, SFML draws. On different machines with different performance speed of the program varies. How to set a fixed speed? So that would on a powerful, average and weak computer the speed of the program (movement of objects) were the same? We need to make Box2D work on different computers at the same speed. It also gives coordinates, and SFML draws a square at the given coordinates. How to solve this problem? 回答1: Constant Frame Rate is what

Why am I getting a procedure entry point error for this simple C++ code?

≯℡__Kan透↙ 提交于 2019-12-11 15:04:28
问题 I'm writing an SFML game and when I try to run the code this is the error I get: The procedure entry point _gxx_personality_v0 could not be located in the dynamic link library libstdc++-6.dll I've linked to all the libraries correctly and the include files are correct. I've even tried what other answers suggested by putting the libstdc++-6.dll inside the directory of my exectable but still nothing. Another answer said to put the MinGW/bin directory before any other directory in the PATH