sdl

c++ undefined reference to static variable [duplicate]

↘锁芯ラ 提交于 2019-12-06 23:58:49
问题 This question already has answers here : static variable link error (2 answers) Closed 4 years ago . I have no idea why this code isn't working. All the source files compile but when I try to link them the compiler yells at me with an undefined reference error. Here's the code: main.cpp: #include "SDL/SDL.h" #include "Initilize.cpp" int main(int argc, char* args[]) { //Keeps the program looping bool quit = false; SDL_Event exit; //Initilizes, checks for errors if(Initilize::Start() == -1) {

SDL/C++ OpenGL Program, how do I stop SDL from catching SIGINT

柔情痞子 提交于 2019-12-06 21:30:08
问题 I am using SDL for an OpenGL application, running on Linux. My problem is that SDL is catching SIGINT and ignoring it. This is a pain because I am developing through a screen session, and I can't kill the running program with CTRL-C (the program the computer is running on is connected to a projector and has no input devices). Is there a flag or something I can pass to SDL so that it does not capture SIGINT? I really just want the program to stop when it receives the signal (ie when I press

100行代码实现最简单的基于FFMPEG+SDL的视频播放器

允我心安 提交于 2019-12-06 20:05:44
FFMPEG工程浩大,可以参考的书籍又不是很多,因此很多刚学习FFMPEG的人常常感觉到无从下手。我刚接触FFMPEG的时候也感觉不知从何学起。 因此我把自己做项目过程中实现的一个非常简单的视频播放器(大约100行代码)源代码传上来,以作备忘,同时方便新手学习FFMPEG。 该播放器虽然简单,但是几乎包含了使用FFMPEG播放一个视频所有必备的API,并且使用SDL显示解码出来的视频。 并且支持流媒体等多种视频输入,处于简单考虑,没有音频部分,同时视频播放采用直接延时40ms的方式 平台使用VC2010 使用了最新的FFMPEG类库 直接贴代码 int _tmain(int argc, _TCHAR* argv[]) { AVFormatContext *pFormatCtx; int i, videoindex; AVCodecContext *pCodecCtx; AVCodec *pCodec; char filepath[]="nwn.mp4"; av_register_all(); avformat_network_init(); pFormatCtx = avformat_alloc_context(); if(avformat_open_input(&pFormatCtx,filepath,NULL,NULL)!=0){ printf("无法打开文件\n");

How do I suppress '-arch', 'x86_64' flags when compiling an OpenGL/SDL application with Waf on OSX?

一世执手 提交于 2019-12-06 18:29:49
问题 I need to suppress "-arch x86_64 -arch i386" flags Waf is passing to GCC. I am building an SDL/Opengl application. If I link against 32 bit SDL runtime I get error Undefined symbols for architecture i386: "_SDL_Quit", referenced from: __del_video in SDL_functions.c.2.o __init_video in SDL_functions.c.2.o If I link against 64 bit SDL runtime, I get error "Undefined symbols for architecture x86_64" The compiler is apparently using flags -arch x86_64 -arch i386 I understand that this causes GCC

How to disable key repeat in SDL2?

别说谁变了你拦得住时间么 提交于 2019-12-06 18:20:07
问题 There used to be a function named SDL_EnableKeyRepeat() in SDL, but not anymore in SDL2. I searched around in SDL2-wiki but failed to locate anything relevant. Any ideas? 回答1: When handling a keyboard event, just filter out any events that are repeat events, i.e. check the repeat field of the SDL_KeyboardEvent of the SDL_Event union. For example: SDL_Event event; while (SDL_PollEvent(&event)) { if (event.type == SDL_QUIT) { quit = true; } if (event.type == SDL_KEYDOWN && event.key.repeat == 0

SDL: How to blit a surface onto one created with SDL_CreateRGBSurface correctly?

二次信任 提交于 2019-12-06 15:29:25
问题 I'm trying to blit a surface created by IMG_Load (SDL_image) onto one created via SDL_CreateRGBSurface . When both surfaces are loaded with IMG_Load , this works fine, but not when the target surface was created using SDL_CreateRGBSurface . By experimentation, I figured out that if I call SDL_SetAlpha on the source surface, it suddenly works fine. The documentation is a bit lacking, but how I understand it, the way I call it below should clear the SDL_SRCALPHA flag, presumably set by IMG_Load

Segmentation fault using SDL with C++, trying to Blit images

瘦欲@ 提交于 2019-12-06 13:01:40
问题 OK - I have an interesting one here. I'm working on a tetris clone (basically to "level-up" my skills). I was trying to refactor my code to get it abstracted the way I wanted it. While it was working just fine before, now I get a segmentation fault before any images can be blitted. I've tried debugging it to no avail. I have posted my SVN working copy of the project here. It's just a small project and someone with more knowledge than me and a good debugger will probably figure it out in a

No appropriate default constructor available for std::unique_ptr

不羁岁月 提交于 2019-12-06 11:59:57
This is a continuation of my previous post. Since it has already been closed I decided to make a new post. I removed half of the code to make it more readable. Some of the posts I read: Smart pointers with SDL Is it possible to use SDL2 with smart pointers? Couple of questions about SDL_Window and unique_ptr class cGraphics { public: // Creator functions std::unique_ptr<SDL_Window, decltype(&SDL_DestroyWindow)> Create_Window(int xWin, int yWin); // ctor & dtor cGraphics() : m_Window(nullptr, SDL_DestroyWindow) {} cGraphics(int xWin, int yWin); ~cGraphics(); private: std::unique_ptr<SDL_Window,

Set Logitech Steering Wheel position/angle from SDL?

偶尔善良 提交于 2019-12-06 11:00:35
I'm writing C code that controls a Logitech gaming wheel using SDL. So far I have successfully implemented the code that sets the steering wheel in autocenter mode with: SDL_HapticSetAutocenter(haptic, STRENGTH); //set autocenter I would like to be able to use the motor of the steering wheel to rotate it as desired to particular angle positions. After checking in the documentation of the API , I did not find a simple way to do it. I wonder if anyone has some advice on this. 来源: https://stackoverflow.com/questions/50665809/set-logitech-steering-wheel-position-angle-from-sdl

what SDL and OpenGL version and implementation I'm using

时光总嘲笑我的痴心妄想 提交于 2019-12-06 09:44:27
问题 I downloaded SDL 1.2.14 on Windows 7 and I have Mobility Radeon X1800 driver installed. I'm using Microsoft Visual C++ 2010 Express. I added the SDL include and library directories in the "VC++ Directories" I added the following Additional Dependencies: opengl32.lib; glu32.lib; SDL.lib; SDLmain.lib; I added the SDL.dll to my program folder I didn't add any opengl directories! #include "SDL.h" #include "SDL_opengl.h" bool running = true; int main(int argc, char* args[]) { SDL_Init(SDL_INIT