sfml

SFML 2.1 Undefined symbols for architecture x86_64 error

风流意气都作罢 提交于 2019-12-05 15:21:14
I have recently installed SFML 2.1 and am trying to compile and run from the terminal, NOT Xcode, the sample program that they have on their website at http://www.sfml-dev.org/tutorials/2.0/start-linux.php . Path to where I installed SFML: /Users/.../Desktop/C++_Code/SMFL/SFML-2.1-osx-gcc-universal However, I keep getting the error of: Undefined symbols for architecture x86_64: "sf::String::String(char const*, std::__1::locale const&)", referenced from: _main in window-48cb4a.o After googling it, I came across this question: SFML 2.1 RenderWindow linking error In the accepted answer, the

Repeating texture to fit certain size in SFML

牧云@^-^@ 提交于 2019-12-05 10:34:24
I have a file that contains textures. I load it to sf::Texture and split into sprites with setTextureRect . Now lets say one sprite contains part of texture that is 20 pixels wide. How can I render it to fit width of e.g. 213 pixels. The only way I can think about is to render it to sf::RenderTexture and crop it with another sprite. Is there a better way to do this? You can use sf::Texture::setRepeated to do that. However, you'll need to copy that part of your bigger image into an independant texture. Here is an example: #include <SFML/Graphics.hpp> int main(int, char const**) { sf:

Learning to use VBOs properly

痞子三分冷 提交于 2019-12-05 08:33:24
So I've been trying to teach myself to use VBOs, in order to boost the performance of my OpenGL project and learn more advanced stuff than fixed-function rendering. But I haven't found much in the way of a decent tutorial; the best ones I've found so far are Songho's tutorials and the stuff at OpenGL.org , but I seem to be missing some kind of background knowledge to fully understand what's going on, though I can't tell exactly what it is I'm not getting, save the usage of a few parameters. In any case, I've forged on ahead and come up with some cannibalized code that, at least, doesn't crash,

Inheriting from Transformable and Drawable in SFML

两盒软妹~` 提交于 2019-12-05 06:05:16
I'm trying to inherit from Transformable and Drawable in SFML in order to make my objects... well, transformable and drawable. I'm making a simple breakout game, but perhaps I'm going about this the wrong way. Here's my code: #include <SFML/Graphics.hpp> #include <SFML/System.hpp> class Player : public sf::Transformable, public sf::Drawable { public: Player(int x, int y); ~Player() {}; sf::RectangleShape p_rect; void doMovement(const sf::RenderWindow& window); sf::FloatRect getGlobalBounds() const; private: virtual void draw(sf::RenderTarget& target, sf::RenderStates states) const { states

SFML not linking statically to openal32 (links statically to all other dependencies)

别说谁变了你拦得住时间么 提交于 2019-12-05 05:49:19
I compiled SFML using CMake for MinGW. After running "mingw32-make install" everything is built and installed with no errors. But when running the examples - pong.exe, sound.exe, sound-capture.exe and voip.exe all depend upon openal32.dll . I specified SFML_USE_STATIC_LIBS = true when configuring CMake and all other dependencies of the example executables are only upon native windows dlls. Can anyone explain why it has dynamically linked to openal32 (but nothing else)? Edit: I just came across this thread http://en.sfml-dev.org/forums/index.php?topic=262.0 which is discussing exactly the same

sf::Texture applied in a wrong way

笑着哭i 提交于 2019-12-04 17:59:24
问题 In my 2D isometric engine, I have the following classes : `maps(variable)/layers(variable)/cubes(variable)/sides(6)/points(4)/coordinates(3)` Each sides contains 4 points (1 point = 1 coordinate (x, y, z)). Each cubes contains 6 sides. I can create a map with the size i want with cubes(same, the size i want). Folers: assets/numTexture/numLight.png I calcule with numTexture and numLight a number wich is the textureNumberEntry(i loaded all numLight.png(textures) in an array). But texturing

OSX GCC how to specify sfml library source?

人盡茶涼 提交于 2019-12-04 13:39:51
问题 I'm trying to compile a project that uses sfml I installed sfml 2.1 through homebrew like below unknown542696d2a12b:keeperrl kevzettler$ brew list sfml /usr/local/Cellar/sfml/2.1/Frameworks/freetype.framework/ (3 files) /usr/local/Cellar/sfml/2.1/Frameworks/sndfile.framework/ (3 files) /usr/local/Cellar/sfml/2.1/include/SFML/ (87 files) /usr/local/Cellar/sfml/2.1/lib/libsfml-audio.2.1.dylib /usr/local/Cellar/sfml/2.1/lib/libsfml-graphics.2.1.dylib /usr/local/Cellar/sfml/2.1/lib/libsfml

Opening SFML window gives memory read error

浪尽此生 提交于 2019-12-04 06:22:36
问题 I'm trying to open a SFML window, but every time it is launched it says "Access violation reading location: 0xCCCCCCC0." The error is occuring in the init() method. Relevant code: class AirportGame { private: sf::RenderWindow window; public: void init(); int run(); / void AirportGame::init() { window.create(sf::VideoMode(800, 600), "SFML window"); } int AirportGame::run() { init(); while (window.isOpen()) { sf::Event event; while (window.pollEvent(event)) { if (event.type == sf::Event::Closed

Resizing in SFML 2.0

北城余情 提交于 2019-12-04 03:43:41
问题 This may be a simple question but I'm having a hard time finding a straight answer to it: is there a way to resize a loaded Texture in SFML 2.0? For instance, if I have a 3264x2448 png and I want to scale it down to fit a 900x1200 rendered window without cropping, how would I do so? 回答1: Is there a way to scale all rendered windows to fit whatever monitor of whatever system the application is running on? First, here's a way to scale the image to the current RenderWindow size. // assuming the

What is the correct usage of CMake EXTERNALPROJECT_ADD with a Git repository?

妖精的绣舞 提交于 2019-12-03 13:36:38
问题 I would like to learn how to download and compile external libraries using the cmake external project module. For example, lets say that I wanted to download the source from the SFML library https://github.com/LaurentGomila/SFML.git and compile it. I have tried using something like the following. Unfortunately, I can't figure out why it is not compiling after the source gets cloned :( EXTERNALPROJECT_ADD(sfml PREFIX ${sfml_PREFIX} GIT_REPOSITORY https://github.com/LaurentGomila/SFML.git