sdl

SDL 2.0 won't initialize. Error: “Failed to connect to the Mir Server”

柔情痞子 提交于 2019-12-01 22:36:52
问题 I am running Ubuntu 14.04, and using Eclipse CDT. In my program, I am trying to initialize SDL and if it doesn't initialize then output the error, but SDL_GetError() returns "Failed to connect to the Mir Server". I am sure SDL is installed correctly since I can successfully initialize SDL on another project. These are the libraries I am using: http://i.imgur.com/SS1mjzQ.png #include <SDL2/SDL.h> #include <iostream> int main(int argc, char* args[]) { if(SDL_Init(SDL_INIT_EVERYTHING) < 0) { std

gcc won't compile SDL C Program (undefined reference to SDL functions)

流过昼夜 提交于 2019-12-01 22:33:57
问题 I recently moved to linux and i'm having an issue with compiling SDL C programs using gcc. The command i'm using: gcc `sdl-config --cflags --libs` -o main main.c Even by seperating sdl-config flags: gcc `sdl-config --cflags` -c main.c gcc `sdl-config --libs` -o main main.o I'm getting the same error: /tmp/ccHYyjKd.o: In function `main': main.c:(.text+0xe): undefined reference to `SDL_SetMainReady' main.c:(.text+0x18): undefined reference to `SDL_Init' main.c:(.text+0x31): undefined reference

gcc won't compile SDL C Program (undefined reference to SDL functions)

瘦欲@ 提交于 2019-12-01 22:03:28
I recently moved to linux and i'm having an issue with compiling SDL C programs using gcc. The command i'm using: gcc `sdl-config --cflags --libs` -o main main.c Even by seperating sdl-config flags: gcc `sdl-config --cflags` -c main.c gcc `sdl-config --libs` -o main main.o I'm getting the same error: /tmp/ccHYyjKd.o: In function `main': main.c:(.text+0xe): undefined reference to `SDL_SetMainReady' main.c:(.text+0x18): undefined reference to `SDL_Init' main.c:(.text+0x31): undefined reference to `SDL_SetVideoMode' main.c:(.text+0x54): undefined reference to `SDL_MapRGB' main.c:(.text+0x6b):

SDL 2.0 won't initialize. Error: “Failed to connect to the Mir Server”

百般思念 提交于 2019-12-01 21:12:27
I am running Ubuntu 14.04, and using Eclipse CDT. In my program, I am trying to initialize SDL and if it doesn't initialize then output the error, but SDL_GetError() returns "Failed to connect to the Mir Server". I am sure SDL is installed correctly since I can successfully initialize SDL on another project. These are the libraries I am using: http://i.imgur.com/SS1mjzQ.png #include <SDL2/SDL.h> #include <iostream> int main(int argc, char* args[]) { if(SDL_Init(SDL_INIT_EVERYTHING) < 0) { std::cout << SDL_GetError() << std::endl; } return 0; } bash$ export DISPLAY=:0 Setting the DISPLAY run

Can't run SDL(2) on Ubuntu, No available video device

心已入冬 提交于 2019-12-01 20:46:41
When i try to run my program i get the following error message: SDL could not initialize! SDL_Error: No available video device I have all the necessary SDL libraries installed and I'm currently running ubuntu 15.10 Here is my simple SDL code: #include <stdio.h> #include "SDL2/SDL.h" //Screen dimension constants const int SCREEN_WIDTH = 640; const int SCREEN_HEIGHT = 480; int main(int argc, char* argv[]) { //The window we'll be rendering to SDL_Window* window = NULL; //The surface contained by the window SDL_Surface* screenSurface = NULL; //Initialize SDL if( SDL_Init( SDL_INIT_VIDEO ) < 0 ) {

SDL_GetTicks() accuracy below the millisecond level

依然范特西╮ 提交于 2019-12-01 20:15:15
I program currently something with SDL2. All works fine, but I have a problem with the SDL_GetTicks() method. Normally it should return the total application time in milliseconds, but it always returns most of the time the value 0 and sometimes the value 1. I initialized SDL with SDL_INIT_EVERYTHING flag. The problem with the following code is the loop is too fast, so the delta time is smaller than 1 ms. Is there a method to achieve a higher precision? #include "Application.hpp" void Application::Initialize() { int sdl_initialize_result = SDL_Init(SDL_INIT_EVERYTHING); if(sdl_initialize_result

No stdout.txt with SDL

谁说我不能喝 提交于 2019-12-01 18:54:05
I'm working on a little game using C++ with SDL2 using Code::Blocks 12.11 under Windows 7. I'm using the mingw32-gcc compiler and downloaded the standard precompiled Windows distribution of SDL2 (2.0.1 now) and use the i686-w64-mingw32 version. So far stuff is working, I'm getting graphical output and the SDL_ttf extension works too. The only thing that has never worked from the beginning is getting my stdout in a txt file from SDL as intended: Regardless of what I do, I NEVER get stdout.txt or stderr.txt anywhere, haven't seen those files created even once. The files also aren't created

Passing pointer-to-member-function as pointer-to-function

空扰寡人 提交于 2019-12-01 18:19:55
So here's the situation: I'm using C++, SDL and GLConsole in conjunction. I have a class, SDLGame , which has the Init() , Loop() , Render() etc - essentially, it holds the logic for my game class. GLConsole is a nice library so far - it lets me define CVars and such, even inside my SDL class. However, when defining commands, I have to specify a ConsoleFunc , which is typedef'd as typedef bool (*ConsoleFunc)( std::vector<std::string> *args); Simple enough. However, like I said, my functions are all in my class, and I know I can't pass pointer-to-class-functions as pointer-to-function arguments

How to use SDL with OGRE?

醉酒当歌 提交于 2019-12-01 17:50:59
When I go to use OGRE with SDL (as described in this article ), I seem to be having trouble with a second window that appears behind my main render window. Basically, the code I'm using is this: SDL_init(SDL_INIT_VIDEO); SDL_Surface *screen = SDL_SetVideoMode(640, 480, 0, SDL_OPENGL); Ogre::Root *root = new Ogre::Root(); root->restoreConfig(); root->initialise(false); Ogre::NameValuePairList windowSettings; windowSettings["currentGLContext"] = Ogre::String("True"); Ogre::RenderWindow *window = root->createRenderWindow("MainRenderWindow", 640, 480, false, &windowSettings); window->setVisible

Cross-platform way of yielding a thread in C/C++?

自作多情 提交于 2019-12-01 17:48:54
In C and C++ is there a cross-platform way of yielding a thread? Something like sched_yield() or Sleep(0)? Does SDL_Delay(0) always yield or will it return immediately in some implementations? James McNellis Given that neither C nor C++ (up to C++98) has "threads," there is no fully cross-platform way for a thread to yield. In C++0x, there is a function std::this_thread::yield() that can be called to yield. That will be the portable way for a thread to yield, once people start using the C++0x threads library. in the c++ case, boost::thread::yield() does what you ask. On platforms with posix