sfml

Cannot call XInitThreads

时间秒杀一切 提交于 2019-12-10 20:44:28
问题 I have written an SFML C++ game, and tried to start using threads, but after a while everything crashes. After searching I found out the fix seems to be to call XInitThreads(); but this does not work somehow. simplified code: #include <X11/Xlib.h> int main() { XInitThreads(); //other stuff return 1337; } The error message I get when i try to compile is "undefined reference to symbol 'XInitThreads'. Could it be that the header file is working but there is no file where that method is

Collision c++ 2d game, preventing player from entering tile

瘦欲@ 提交于 2019-12-10 17:49:30
问题 I've tried for several days and spent hours searching the web to no avail. I'm having trouble with collision, i can detect the collision but my problem is preventing the player from entering the tile. I've tried all i can think of. I'm detecting the collision of my tilemap using 1 for solid and 0 for passive for(int i = 0; i < tiles.size(); i++) { if(colMap[tiles[i].y][tiles[i].x] == 1) { myrect.setFillColor(sf::Color::Red); collide = true; break; } else { collide = false; break; } } This

How to read a bitmap from the Windows Clipboard

谁都会走 提交于 2019-12-10 15:58:01
问题 I am writing an extremely small C++ program to help me animate sprites. I'd like it to take data I copy to the clipboard from photoshop, manipulate it in my program, then overwrite the clipboard with the transform. The problem though is that I'm not sure how to read the initial clipboard from photoshop. I can load the clipboard with GetClipboardData(CF_DIB) , and get a valid handle, but I've no idea how to use that handle. I've tried using SFML's Image::LoadFromMemory(handle, GlobalSize

FreeType error when building in XCode

[亡魂溺海] 提交于 2019-12-10 15:45:42
问题 First some back story: I dont know what im doing. Thats a lie, I know a bit about what I'm doing. I'm a web developer so looking at code isn't all gibberish, but trying to use Xcode is a new book for me. Anyway, I designed a game that was compiled in C++ using SFML on Windows, and now we are trying to bring it over to OS X (I am the only one of the group with a Mac). Using Xcode 4.6.1 and SFML 2.0 I've been trying to get this damn application to build, and so far it's been nothing but

SFML (32-bit VS12) - Unhandled exception at 0x701ADEF8 (msvcr110.dll) in SFML.exe: 0xC0000005: Access violation reading location 0x0526. LoadFromFile

。_饼干妹妹 提交于 2019-12-10 11:45:09
问题 The following code gives me the uncaught exception (specifically txtr.loadFromFile("C:/Users/kidz/Documents/Visual Studio 2012/Projects/SFML/Debug/chessboard.gif"); ): "Unhandled exception at 0x701ADEF8 (msvcr110.dll) in SFML.exe: 0xC0000005: Access violation reading location 0x05260000." int _tmain(int argc, wchar_t* argv[]) { sf::RenderWindow window(sf::VideoMode(512, 512), "ChessPlusPlus", sf::Style::Close); sf::Sprite chessboard; sf::Texture txtr; txtr.loadFromFile("C:/Users/kidz

SFML 2.1 Undefined symbols for architecture x86_64 error

こ雲淡風輕ζ 提交于 2019-12-10 09:34:17
问题 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

Inheriting from Transformable and Drawable in SFML

可紊 提交于 2019-12-10 04:29:35
问题 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()

Visual Studio SFML Linker Error [duplicate]

僤鯓⒐⒋嵵緔 提交于 2019-12-08 10:45:12
问题 This question already has answers here : What is an undefined reference/unresolved external symbol error and how do I fix it? (32 answers) Closed 4 years ago . I am new to SFML and when I tried to compile a basic program, I'd get this error Error 2 error LNK2019: unresolved external symbol "__declspec(dllimport) void >__cdecl sf::sleep(class sf::Time)" (__imp_?sleep@sf@@YAXVTime@1@@Z) referenced in> >function _main C:\Users\asd\documents\visual studio 2013\Projects\OpenGL\OpenGL\Source.obj

Removing Sprites from vector in sfml 2.1

穿精又带淫゛_ 提交于 2019-12-08 06:09:39
问题 I'm trying to remove sprites from a vector, but to no avail and I don't know what's wrong(VS 2010 with SFML 2.1). It simply doesn't compile. Any tips appreciated. Its this line, that seems problematic: SpriteVector.erase(std::remove(SpriteVector.begin(), SpriteVector.end(), SpriteIt), SpriteVector.end()); Full code: #include <SFML/Graphics.hpp> #include <iostream> #include <vector> #include <algorithm> int main() { sf::RenderWindow mMainWindow(sf::VideoMode(1200, 900), "Map"); mMainWindow

SFML fails in multithreading

做~自己de王妃 提交于 2019-12-08 05:02:51
问题 im new to sfml and c++.and I have a project that uses the sfml library's to draw the graphics but when I add an additional thread to my program it fails to execute the code inside the thread. this is my code:(please help me!) #include <SFML\Graphics.hpp> #include <SFML\window.hpp> #include <SFML\system.hpp> #include <iostream> #include <thread> #include <chrono> using namespace std; int h(sf::RenderWindow* win){ //do something win->close(); this_thread::sleep_for(chrono::milliseconds(10));