sfml

SFML Giving NonCopyable Error when Initializing a Window Via Class

雨燕双飞 提交于 2019-12-13 13:45:56
问题 I'm making a Game class with a function that makes a window. When I try to execute the function, VS 2012 gives me this error: Error 1 error C2248: 'sf::NonCopyable::operator =' : cannot access private member declared in class 'sf::NonCopyable' C:\SFML-2.0-rc\include\SFML\Window\Window.hpp 476 1 Faceman Here is my Game.h (unfinished): #ifndef FP_MENU #define FP_MENU #include <SFML/Graphics.hpp> class GAME { public: sf::RenderWindow GameWindow; void createWindow(); unsigned int getWindowWidth()

How create a library? [closed]

只谈情不闲聊 提交于 2019-12-13 11:25:59
问题 Closed . This question needs to be more focused. It is not currently accepting answers. Want to improve this question? Update the question so it focuses on one problem only by editing this post. Closed 4 years ago . How can I make my own GUI library e.g. SFML? This question is for the purpose of understanding how GUI libraries work, not to actually make my own library. I asked what I needed to do so. Can I open my editor and write some C++ code, importing some libraries and that's it. Or it's

Placing text in an Image object

≡放荡痞女 提交于 2019-12-13 11:08:30
问题 I am using SFML 2.1 and have an Image with some objects that I would like to number, i.e. I have a set of origin coordinates for each of them so I would place the number there. However, I can't seem to find a good way to do this: the most relevant function seems to be Image::copy() which places a rectangle in the image. To use that, I would have to create a number map image and then do offsets for successive numbers, which seems tedious, cumbersome and unreliable, as an image with too many

Nagle-Like Problem

岁酱吖の 提交于 2019-12-13 08:51:47
问题 so I have this real-time game, with a C++ sever with disabled nagle using SFML library , and client using asyncsocket, also disables nagle. I'm sending 30 packets every 1 second. There is no problem sending from the client to the server, but when sending from the server to the clients, some of the packets are migrating. For example, if I'm sending "a" and "b" in completly different packets, the client reads it as "ab". It's happens just once a time, but it makes a real problem in the game. So

SFML Sprite white square

筅森魡賤 提交于 2019-12-13 06:36:29
问题 I have asked a question about SFML smooth movement yesterday... and that problem was solved, but this time the sprite that im using is showing up as a white square. I have tried to send the sprite to drawship function as reference but since i am using that function on main.cpp i am not able to do what is told on this answer. So Im wondering how I can fix this problem. main.cpp #include <SFML/Audio.hpp> #include <SFML/Graphics.hpp> #include "Spaceship.hpp" #include <vector> #include

Unresolved External Symbol: LNK 2001

老子叫甜甜 提交于 2019-12-13 05:35:32
问题 I just installed SFML packages using NuGET Package Manager. After installing it. I ran a basic program from its official page. Just copy and paste. #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color::Green); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed) window.close(); } window.clear(); window.draw(shape); window

Getting clicked position using SFML

*爱你&永不变心* 提交于 2019-12-13 05:27:31
问题 I'm currently learning SFML on my own, and trying to figure out how to print out the position of the clicked area at bposX and bposY in the pollevent section. Thi s is my codes: sf::RectangleShape smallRectangle (float width = 1.0f, float height = 1.0f, sf::Vector2f position = sf::Vector2f(1.0f,1.0f), const sf::Color& myFillColor = sf::Color(0,51, 51) ) { sf::RectangleShape sboard; sf::Vector2f myRectangleSize(width, height); sboard.setSize(myRectangleSize); sboard.setPosition(position);

SFML 2.1 & “lazy symbol binding failed”

人走茶凉 提交于 2019-12-13 04:30:26
问题 I've compiled my SFML program with g++ and that seems to be working fine now (had issues with it previously), however when I try to run the resulting output, I get the following error message: dyld: lazy symbol binding failed: Symbol not found: __ZN2sf12RenderWindowC1ENS_9VideoModeERKNS_6StringEjRKNS_15ContextSettingsE Referenced from: /Users/fabricecastel/Work/Game_Projects/SFML_tutorials/./a.out Expected in: /usr/local/lib/libsfml-graphics.2.dylib dyld: Symbol not found: _

Where should I store textures for a game?

有些话、适合烂在心里 提交于 2019-12-13 03:21:48
问题 I am currently creating a game in SFML using C++ and I'm wondering: what is good practise for a location for textures? Should I store it with my project? Or my executable? Or even in something like the Documents folder? What would be the most efficient when the game would theoretically be released, as it will not simply include the project but rather a compiled and build version of it? 回答1: Most common game releases have their textures inside a Media folder or similar. Inside that folder are

SFML 2.0 Having the same sprite looped

与世无争的帅哥 提交于 2019-12-13 02:35:15
问题 I am drawing an invader sprite list into my game using SFML 2.0. At the moment I have to keep copy and pasting my code to draw more sprites in: //load the invaders images sf::Texture invaders; sf::Texture invaders2; sf::Texture invaders3; sf::Texture invaders4; sf::Texture invaders5; sf::Texture invaders6; invaders.loadFromFile("images/invaders.png"); invaders2.loadFromFile("images/invaders.png"); invaders3.loadFromFile("images/invaders.png"); invaders4.loadFromFile("images/invaders.png");