sfml

SFML Window Resizing is very ugly

时光总嘲笑我的痴心妄想 提交于 2021-02-11 15:53:32
问题 When I resize my sfml window, when I cut resize to make it smaller and resize to make it larger, it gives you a really weird effect. How do I make the resizing more prettier? The code is from the installation tutorial for code::blocks. Code (same as the code in the installation tutorial for code::blocks on the sfml website): #include <SFML/Graphics.hpp> int main() { sf::RenderWindow window(sf::VideoMode(200, 200), "SFML works!"); sf::CircleShape shape(100.f); shape.setFillColor(sf::Color:

How to “set the origin” of a Transform in sfml

試著忘記壹切 提交于 2021-02-10 18:22:39
问题 I have a problem using sfml where it seems sf::Transform s get applied relative to the origin of whole coordinate system and not the origin of the sprite/thing being transformed. For example in the two following example I expect the same behavior and it's not what happens. (differences in bold, most of rest just serves to actually display a sfml window with a circle that gets scaled down when space is pressed) First Example : here the circle is scaled down towards the top left corner of the

CMake+SFML Linker error, even though library is specified in CMakeLists.txt

空扰寡人 提交于 2021-02-10 17:30:13
问题 I am making a project using SFML and CMake. To do that, I followed the guide from SFML's GitHub. I am adding the following lines to my CMakeLists.txt: set(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake_modules" ${CMAKE_MODULE_PATH}) find_package(SFML 2 REQUIRED network audio graphics window system) if(SFML_FOUND) include_directories(${SFML_INCLUDE_DIR}) target_link_libraries(${EXECUTABLE_NAME} ${SFML_LIBRARIES} ${SFML_DEPENDENCIES}) else() message("SFML WAS NOT FOUND") endif() These lines are

CMake 64-bit with SFML 64-bit

两盒软妹~` 提交于 2021-02-10 12:34:24
问题 I'm trying to build a C++ project with CMake 64-bit for Windows and SFML 2.5.1 64-bit. When I run cmake on the project I'm getting an error message. The only way I can get it to work is to change the CMAKE_PREFIX_PATH to point to a 32-bit version of SFML but that's not what I want. CMakeLists.txt: cmake_minimum_required (VERSION 3.8) #project(GameOfLife) set(CMAKE_PREFIX_PATH "D:\\Program Files\\SFML-2.5.1\\lib\\cmake\\SFML") find_package(SFML 2.5 COMPONENTS graphics window REQUIRED) # Add

CMake 64-bit with SFML 64-bit

情到浓时终转凉″ 提交于 2021-02-10 12:34:10
问题 I'm trying to build a C++ project with CMake 64-bit for Windows and SFML 2.5.1 64-bit. When I run cmake on the project I'm getting an error message. The only way I can get it to work is to change the CMAKE_PREFIX_PATH to point to a 32-bit version of SFML but that's not what I want. CMakeLists.txt: cmake_minimum_required (VERSION 3.8) #project(GameOfLife) set(CMAKE_PREFIX_PATH "D:\\Program Files\\SFML-2.5.1\\lib\\cmake\\SFML") find_package(SFML 2.5 COMPONENTS graphics window REQUIRED) # Add

Transformations igrnores sf::Sprite's origin

有些话、适合烂在心里 提交于 2021-02-10 05:12:45
问题 Transforming a sprite in SFML, does not regard it's new origin. In my case sf::Sprite is rotating around the axis that is in the left top corner ({0,0}) regardless its origin. Setting new origin with .setOrigin() earlier takes no effect. I am sure that sprite is getting the right origin position earlier which is center of rectangle. My code: In each of my Card class constructors I set the origin of my sprite. card_sprite.setOrigin(Card::get_default_single_card_size().x*Game::get_scale()/2

Loading a texture in sfml

社会主义新天地 提交于 2021-02-05 06:26:07
问题 I started to learn SFML, I want to create sprite to load an image from a file, so I just followed the tutorial and made the obvious thing. sf::Texture texture; texture.loadFromFile("C:\image.png"); sf::Sprite sprite; sprite.setTexture(texture); window.draw(sprite); And when I start the program I just get a white screen and "Unhandled exception at 0x50CEDEDA (msvcr110.dll) in itsprgps.exe: 0xC0000005: Access violation reading location 0x00524000.", also the console gets filled with random

C++ xstring _Large_string_engaged() const exception

给你一囗甜甜゛ 提交于 2021-01-29 20:35:52
问题 Hope everyone is doing ok. So I am making a simulation of a shop where a customer enters a shop, does shopping, cashes out and then de-spawns. A customer is spawned after a random amount of time. I am using Linked List to store these customers. This program uses SFML for graphics. So I wanted to test my code to have a look at my progress and in order to speed things up, I reduced the amount of time taken for a customer to spawn, the customers started spawning at a fast rate. So somewhere

animation of sfml by using array of objects

♀尐吖头ヾ 提交于 2021-01-29 14:31:26
问题 How to animate sprite with this code?I know what i should to add time delay,but how do it? I use array of objects to they's fast changing. or is it an irrational way of animating? #include <SFML/Graphics.hpp> #include <iostream> using namespace std; sf::RenderWindow window(sf::VideoMode(600, 400), "!!!"); void animation() { sf::Texture arrayOfTexture[9]; sf::Sprite imageOfLamp; arrayOfTexture[0].loadFromFile("1.png"); arrayOfTexture[1].loadFromFile("2.png"); arrayOfTexture[2].loadFromFile("3

Undefined reference to (SFML)

百般思念 提交于 2021-01-29 06:05:06
问题 I am trying to link SFML with CMake, but I have some issues with make: /home/ishidex2/Documents/QtCreator/CMakeExample/main.cpp:-1: error: undefined reference to `sf::String::String(char const*, std::locale const&)' And some kind of errors like this. First of all, I installed SFML by this command: sudo apt-get install libsfml-dev And then followed this tutorial : https://github.com/SFML/SFML/wiki/Tutorial:-Build-your-SFML-project-with-CMake I think this is a problem with linking, but I don't