sdl

SDL/C++/OpenGL graphics display says "Not Responding" on cin from console.

So the story goes, I have an sdl/c++/opengl/win32 program which has a window to display my graphics and a console to get user input. When I tell the console to get input the display will go into a "Not Responding" mode. The program is single threaded and I was hoping that there was a better way around the problem then creating a multi-...

Whats in SDL.dll ?

Hi, I am new to SDL, and I am just curious why does sdl use static and dynamic libraries? I mean, what functions are in sdl.dll, and why is it linked dynamically instead of statically? Thanks. ...

SDL: What is a Blit?

In the SDL wiki it says Use this function to perform a fast blit from the source surface to the destination surface. However that doesn't help me much.. What does the term surface blitting mean in this context? ...

SDL: FPS problems with simple bitmap

I am currently working on a game in SDL which has destructible terrain. At the moment the terrain is one large (5000*500, for testing) bitmap which is randomly generated. Each frame the main surface is cleared and the terrain bitmap is blitted into it. The current resolution is 1200 * 700, so when I was testing 1200 * 500 pixels were vi...

Pixel dilemma: Choosing the right graphics API

I want to make a sidescrolling 2D game with destructible terrain. My approach is having the terrain as a BMP and having access to each pixel. However I have a problem with choosing the right graphics API for my game. I have already considered several options: SDL I started writing the game in SDL, I had the terrain as surface which...

Inputs in SDL (on key pressed)

Hello. I would like to know how can I detect the press of a key or release of a key in a while loop in SDL. Now, I know you can get the events with SDL like OnKeyPressed, OnKeyReleased, OnKeyHit, etc, but I want to know how to build functions like 'KeyPressed' that returns a boolean, instead of being an event. Example: while not KeyHit(...

clearing errors on Eclipse CDT

I'm new to using Eclipse. I'm trying to write some C++ code in it with the CDT but I can't figure out how to tell it to rebuild manually. I did a little test program and accidentally put SDL_EVERYTHING instead of SDL_INIT_EVERYTHING in SDL_Init args. I changed it to the correct name and saved but when I right clicked on the project and c...

initialization discards qualifiers... sdl warning

When I run this bit of code through GCC I get this warning on the line where I set info to SDL_GetVideoInfo(). warning: initialization discards qualifiers from pointer target type int main(int argc, char** argv) { SDL_Init(SDL_INIT_EVERYTHING); SDL_VideoInfo* info = SDL_GetVideoInfo(); int SCREEN_WIDTH = info->current_w; ...

Do I need a visitor for my component ?

I'm trying to do a small and simple GUI in C++ (with SDL). I'm experimenting with the Composite pattern to have a flexible solution. I've got a Widget class, with Component objects : for instance, there is a PaintingComponent ; if I want to draw a box, I'll use a PaintingBoxComponent, that inherits from the PaintingComponent. The ide...

CMake sdl-config

Is there a way to use sdl-config in CMake? ...

Does sdl support ARM lcd video display?

Hi, am new to SDL and I have used the spcaview code to get video stream from a camera to a FriendlyARM LCD but the video display is not good and moves very fast. It however works well on the computer screen. I was wondering if SDL supports LCD display; if yes what am I missing?. If no, what can I do because I need to stream video from a ...

SDL - (Hardware) Pixel Scaling

In my SDL game, I'd like to retain a fixed resolution of the game area, both for gameplay and performance reasons. What I wanted to do was to have a small resolution (e.g. 320 * 240), and when resizing the window / switching to fullscreen mode letting SDL / the graphics card scale each pixel. However the problems that occur are: The ...

Eclipse debugs, but doesn't run c++ application

Hello, I'm trying to programming an application with SDL. I've got some kind of problem. When I debug the application with Eclipse it's works perfectly, but, when I click Run it does nothing. It just prints " Prueba2.exe". I have tried with a "Hello World" template. I use cygwin. And if this is useful, any ideas? Thanks. ...

Using SDL in OS X from C++ without SDLmain

How can I call SDL functions from C++ in OS X without a main method? I'm building a dynamic library that does the initialization. The application that calls it depends only on the library. I realize that I need to somehow create an autorelease pool in Objective-C, because SDL_Init() crashes as it's now, but I don't know how. SDLmain cre...

Vector insert crashes program.

Can anyone tell me why this crashes my program? It's suppose to make it so order has all the elements in the t vector situated by (y + height). Edit: crashes on the lines with "insert" in them. void createDrawOrder(vector<Thing*> t, vector<int> *order) { int min = t[0]->y + t[0]->height; int max = t[0]->y + t[0]->heigh...

ISO C++ forbids declaration of 'Game' with no type - possible include problem?

compiler output: g++ -Wall -g main.cpp `sdl-config --cflags --libs` -lSDL_mixer In file included from Game.h:8, from main.cpp:1: DrawableObject.h:11: error: ISO C++ forbids declaration of ‘Game’ with no type DrawableObject.h:11: error: expected ‘;’ before ‘*’ token DrawableObject.h:13: error: expected ‘)’ before ‘*’ tok...

SDL: Is this safe to do in a multi-threaded program?

I have a thread that does the following: Initializes SDL Stores a pointer to the SDL_Surface Goes into a loop and waits for any mouse events and processes them In another thread there is a function that does the following: Gets the pointer to the SDL_Surface Does a SDL_LockSurface Manipulates the pixels Does a SDL_UnlockSurface Ca...

Why is SDL so slow and how can I get it to run faster?

I have the following test setup: 1024 * 768 screen surface created with SDL_HWSURFACE The main loop consists only of SDL_Flip() and a simple FPS counter The problem is: I am only getting around 1000 FPS with this. Which is really really low when you consider that you do not even draw anything! The FPS drop really fast when I contin...

Fast file copy with progress

Hello, I'm writing an SDL application for Linux, that works from the console (no X server). One function I have is a file copy mechanism, that copies specific files from HDD to USB Flash device, and showing progress of this copy in the UI. To do this, I'm using simple while loop and copying file by 8kB chunks to get copy progress. The p...

sdl app segfaults on sdl_gl_setattribute

Hi, I'm trying to compile this example and play around with it a bit. I've already corrected the main error the people were having with this example where they would call sdl_gl_setattribute before SDL_Init was called but I'm still getting a segfault right after the first SDL_GL_SetAttribute call. I've ran sdl with opengl apps before on ...