sdl

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

跟風遠走 提交于 2019-12-04 18:16:37
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 snap. The only dependency is SDL . Kudos to the person that can tell me what I'm doing wrong. Edit: As

SDL Error Undefined symbols for architecture x86_64 “_SDL_main”

瘦欲@ 提交于 2019-12-04 18:03:50
问题 I am using C++ with the SDL Cocoa and Foundation framework on my mac os x. I get the following error Undefined symbols for architecture x86_64: "_SDL_main", referenced from: -[SDLMain applicationDidFinishLaunching:] in SDLMain.o ld: symbol(s) not found for architecture x86_64 when I run the following code #import <Foundation/Foundation.h> #import <SDL/SDL.h> #include "SDLMain.h" int main(int argc, const char * argv[]) { SDL_Init(SDL_INIT_EVERYTHING); SDL_SetVideoMode(640,480,32,SDL_DOUBLEBUF)

How to install/compile SDL2 C code on Linux/Ubuntu

人走茶凉 提交于 2019-12-04 17:41:54
I'm currently doing some C programming and I actually want to use the SDL library. I want to build a Small 2D game in C on Linux to sharp my skills a bit. My issue is I'm not a super Makefile user nor library on Linux super user, I just configure things once when on a project and that's it. So I have some trouble compiling SDL2 programs on UBUNTU 14.04. I downloaded the latest SDL library from : http://www.libsdl.org/download-2.0.php Then I installed it with the default step: ./configure make sudo make install After that I can see that there is something in /usr/include/SDL2 so I guess it is

How to create a color gradient in SDL

时间秒杀一切 提交于 2019-12-04 15:56:28
SDL has no function like this, curious if anyone in the past has done it and wouldn't mind heading me in the right direction. I want to create a gradient between two colors to be reflected on the height of a rectangle. Just make a loop over the desired y positions, in which you: Compute the desired color by interpolating between the gradient's endpoint colors. Call SDL_SetRenderDrawColor() to set the color. Call SDL_RenderDrawLine() to draw a horizontal line at the current y position. I was actually pondering over this myself yesterday, and I had an amusing idea. If you set the renderer

what SDL and OpenGL version and implementation I'm using

丶灬走出姿态 提交于 2019-12-04 14:03:23
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_EVERYTHING); SDL_Surface* screen = SDL_SetVideoMode(640,480,32,SDL_OPENGL); glViewport(0,0,640,480);

《Hi3521d移植SDL+FreeType+SDL_ttf》

空扰寡人 提交于 2019-12-04 13:25:47
1. freetype 下载安装 1.1 下载 https://download.savannah.gnu.org/releases/freetype/ 1.2 安装 解压: # tar -xvf freetype-2.4.10.tar.gz 进入freetype文件目录: # cd freetype-2.4.10 执行: # . /configure CC=arm-hisiv600-linux-gcc --host=arm-hisiv600-linux 编译: make && make install 上述命令敲击过后,会在/usr/local/目录下 生成bin目录 生成include目录 生成lib目录 2. SDL 下载安装 2.1下载 http://www.libsdl.org/download-1.2.php 2.2安装 解压: # tar -xvf SDL-1.2.15.tar.gz 进入SDL文件目录: # cd SDL-1.2.15/ 执行: # ./configure CC=arm-hisiv600-linux-gcc --host=arm-hisiv600-linux 问题: ./src/audio/esd/SDL_esdaudio.c:30:17: fatal error: esd.h: 没有那个文件或目录 解决方法: 加上 --enable-esd=no

Why shouldn't you use a handle during component creation or streaming?

时光总嘲笑我的痴心妄想 提交于 2019-12-04 10:50:32
I want to make a custom VCL control that wraps a SDL rendering surface via the SDL_CreateWindowFrom function. SDL_CreateWindowFrom takes an existing HWND handle and puts a high-performance rendering context (it has several backends available, including DirectX and OpenGL) onto it. The helpfile says "Do not refer to the Handle property during component creation or streaming." But it doesn't say why. It says that the first time you try to access the Handle property, it'll call HandleNeeded to ensure that a valid handle exists. So I have two questions. 1: What's the reason why you shouldn't

SDL 1.3/2.0 setting up

时光毁灭记忆、已成空白 提交于 2019-12-04 10:22:23
问题 I have been using sdl 1.2 for the past several months(On windows).I am thinking about migrating to 1.3. So I used cmake and codeblocks to create the static and dynamic libray.now I am confused how to compile the a program.I included the sdl.h header..added the static library in the linker.But when I try to compile lots of undefined errors keep occuring: D:\using font\sdl_2test\main.c||In function 'SDL_main':| D:\using font\sdl_2test\main.c|9|warning: passing argument 6 of 'SDL_CreateWindow'

SDL - Get native Screen Resolution

血红的双手。 提交于 2019-12-04 10:13:27
My code: window.cpp Window::Window(int w, int h, const char *title, const char *icon) { height = h; width = w; if(SDL_Init( SDL_INIT_EVERYTHING ) == 0) { SDL_WM_SetCaption(title, NULL); SDL_WM_SetIcon(SDL_LoadBMP(icon),NULL); screen = SDL_SetVideoMode(width, height, 32, SDL_SWSURFACE | SDL_RESIZABLE | SDL_DOUBLEBUF); if(screen == NULL) { running = false; return; } fullscreen = false; } else running = false; return; } Window::Window() { const SDL_VideoInfo* info = SDL_GetVideoInfo(); screenWidth = info->current_w; screenHeight = info->current_h; Window(640, 480, "Flatgu game", "rsc/img/icon.bmp

Handling window resizing using OpenGL and SDL

谁说胖子不能爱 提交于 2019-12-04 09:39:44
问题 From the code I have of a program that draws and moves a square around an application window, I'm having trouble when resizing the application window. When I handle a resize and alter states accordingly, everything on the screen that should be drawn and was before the resize vanishes. I have no idea why because none of the objects internal coordinates are changed during the window resizing. My question is can anyone point me in the right direction to solve my problem.(The code compiles fine)