Simple DirectMedia Layer (SDL) is a cross-platform multimedia library designed to provide low level access to audio, keyboard, mouse, joystick, 3D hardware via OpenGL, and 2D video framebuffer.
0
votes
0answers
19 views
Getting Started with game dev [on hold]
C is a good language to getting started on game development?
SDL? OpenGL? what library?
i'm programming in C about one year, but i never used these tools.
0
votes
4answers
74 views
Issue translating objects by one unit in the y direction
I'm currently making space invaders (in OpenGL/SDL) and I'm running into an issue with the movement of the aliens. I have a 2-d vector of aliens (5 rows of 11) and I'm translating each in the x ...
0
votes
1answer
70 views
Sprite quickly disappears after rendering
I'm currently making space invaders and I'm using the game loop pattern as described here. I have an entity class from which there is a spaceship derived class. The base entity class contains all of ...
0
votes
1answer
15 views
Simulate Keyboard Button Press [SDL Library]
I am trying to simulate an SDL keyboard button press (using C). I have looked up the SDL info pages online but I still don't have anything that consistently works.
I have the following (removed the ...
0
votes
1answer
43 views
Sprite Sheet Texture not being rendered
I'm making space invaders (in OpenGL/SDL) and I've run into a problem
when trying to draw the sprite for the spaceship from the spritesheet.
In my entity class, I have a pointer for the sprite that ...
0
votes
2answers
114 views
SDL or SFML: which is the best option if I only want to use OpenGL for my graphics? [closed]
I've read a lot about creating graphics with OpenGL in SDL and SFML over the past few days, and I want to know which one I should pick. As mentioned in most of the things that I've read, both allow ...
0
votes
1answer
40 views
Issue with detecting collisions in Pong
I've been working on making Pong in OpenGL and SDL and currently have both paddles and the game ball set up properly. I have an Object (or Entity) class which is used to instantiate each of the ...
1
vote
1answer
64 views
How can I render a texture to a polygon in SDL2? A fake 3D problem
I am working on a fake 3D game recently. The game is based on the perspective principle and using angular perspective. Here is a screen shot:
But the problem is that the walls and floor displayed ...
4
votes
0answers
87 views
Windows vs OSX Performance with SDL, OpenGL [closed]
I have been writing an SDL OpenGL game in c++ for a couple of years now, writing my own engine for the most part (using Box2d for physics). I'm primarily a mac user, so I've been using xCode to write ...
0
votes
3answers
122 views
Cannot load png images to textures with SDL2 in Visual Studio 2015
I'm learning SDL2 with Visual Studio 2015 and I'm trying to draw a 16x16 level with a .map file and 32x32 .png images for tiles (that's 256 tiles) on a 512x512 window. I have both SDL2 and SDL2 Image ...
0
votes
1answer
27 views
SDL Combining text and Geometry Rendering to one texture
Basically I'm trying to end up with a Texture class that can take in text and have it be drawn over simple geometry (such as a letter 'A' over a filled rectangle). However I'm running into issues when ...
1
vote
1answer
79 views
Fixed-Timestep still updating too fast
I'm trying to figure out if I'm approaching my simple fixed-timestep implementation correctly, following examples such as: Gaffer (without RK4), and DeWitters
Currently, I have a game object which ...
0
votes
0answers
23 views
How to parse a and displat TMX map object in SDL using tmxparser ?/How to make a platform game using tiled editor and SDL?
I am newbie in this field getting too much trouble in simple platform game for one of my project module if you guys could help or share some code. This is what I have done till now.
I could parse a ...
-4
votes
1answer
63 views
Can we port any game written in C++ with SDL to Android platform or we would need to change some codes too? [closed]
Just wanted to lean a cross-platform library!!
Since SDL library supports iOS too..
0
votes
1answer
47 views
SDL2 and density-independent pixel
I'm currently using SDL2 on Android and that's my first experience with that library (to be honest, mainly chosen because I'd like to learn it).
What is puzzling me is how to deal with different ...
1
vote
1answer
138 views
Why does SDL_RenderCopy result in a blank screen?
I'm trying to render a texture(picture), but SDL_RenderCopy keeps the window's background black.
Here's the relevant code:
SDL_Rect rect; rect.x = 0, rect.y = 0;
while(!quit)
{
...
1
vote
1answer
108 views
Version 320 is not supported, SDL C++
I have the following four lines before I create the window.
SDL_Init(SDL_INIT_VIDEO);
SDL_GL_SetAttribute(SDL_GL_CONTEXT_PROFILE_MASK, SDL_GL_CONTEXT_PROFILE_CORE);
...
1
vote
0answers
68 views
SDL-2.0 library not working with codeblocks-13.12-mingw-tdm [closed]
I started following lazyfoo's sdl 2.0 tutorials. This is the very first tutorial that explains how to set up SDL 2.0 with code::blocks - SDL 2.0 with code::blocks setup. I am doing exactly what it ...
2
votes
1answer
83 views
OpenGL not rendering textures
i'm using OpenGL 2.1 with SDL2.0 and i'm trying to render a texture, using this steps:
load the image:
Image* image = new Image();
image->image = SDL_LoadBMP(path.c_str());
if ...
3
votes
1answer
114 views
How can I separate processing input and update?
I know that game loop is broken up into three distinct phases: processing inputs, update, and render, but I just can't see how I can make processing input and update independent of each other.
Let's ...
2
votes
0answers
133 views
OpenGL textures make very low fps
I loaded some textures just one time before I go to my mainloop(glutMainLoop).
I am using SDL for the texture loading.
However, when I compile, my game is running at 6-10 fps.
When I don't load the ...
2
votes
1answer
138 views
How to calculate delta time with SDL?
I have heard that you can calculate delta time with two functions called SDL_GetPerformanceCounter and SDL_GetPerformanceFrequency. I'm not sure how they work completely, but I heard it is a bit ...
1
vote
2answers
141 views
OpenGL SDL Texture doing really weird things
I am trying to render a .png image to the screen using C++, SDL and glut.
This the texture I made using paint
This is what I get on the screen:
Does anyone have an idea what could cause this?
...
2
votes
1answer
87 views
Texture Not Rendering in C++ SDL OpenGL(glut)
I don't understand why my texture("texture.bmp"), is not showing on the screen. Please help me.
The whole drawing function:
///HERE EVERYTHING IS BEING RENDERED
void Main::display(){
int ...
4
votes
0answers
69 views
OpenGL: Frame partially jumps back and forth
I'm working on a project with SDL and OpenGL. The game works great on Windows, Linux, OS X and iOS. However, the Android version is showing a problem on my phone in particular. I have tested another ...
2
votes
2answers
73 views
Unable to move character to right position using SDL?
I am currently having problem moving a character right and showing him like he's running but after i press right key it moves right for one time and then when i enter left it goes left again but ...
1
vote
1answer
103 views
Why am I getting these artifacts when rendering polygons with OpenGL and SDL from far distance?
I'm working in a toy BSP (quake3 version) renderer. I started creating the context and handling the input with GLFW but then I switched over SDL. The performance change was amazing with SDL leading ...
0
votes
1answer
70 views
Handling input in ECS for multiple characters
I've been reading into Entity-Component-Systems, and they seem rather handy. However, I don't quite understand how input should be handled and after googling and looking thru GDSE posts, I've become ...
0
votes
1answer
108 views
Zooming In SDL 2.0
I'm currently working on a project in which I render pictures raw. That is I use simple IMG_LoadTexture(), SDL_RenderCopy(). I want the program to be able to zoom in/out and textures to be scaled to ...
1
vote
1answer
42 views
SDL.NET no longer detecting modifier keys
I'm using SDL.NET with C#.
Recently, a bug has appeared where the library does not detect if the shift key is held down; although it used to do so.
private static void KeyboardEventHandler(object ...
0
votes
0answers
31 views
Strange offset when accessing pixels from an SDL surface
I am using a routine to map a triangle from one surface to another.
The problem is that the function below chooses the correct pixel to draw on the destination surface, but the pixel selected from the ...
0
votes
0answers
106 views
Creating A Selectable Object in SDL/C++
I'm trying to create a clickable object. I wrote a pseudo code to try it. When I add a new member to object it works fine, that is when I hold the mouse cursor on the rectangle determined it returns ...
1
vote
3answers
204 views
2D Rendering Based On Y Coordinates
I'm trying to build an RPG worldbuilder. I have seperate classes for images. Like this.
Object1::Object1(int x, int y, CSDL_Setup *sdl_set, int *p_CamX, int *p_CamY)
{
X_pos = x;
Y_pos = y;
...
0
votes
2answers
129 views
Getting if a key was released/pressed this frame (C++/SDL2)
Getting if a key is currently down is easy. Just return keys[scancode]:
switch (ev.type) {
case SDL_KEYDOWN:
keys[ev.key.keysym.scancode] = true;
break;
case SDL_KEYUP:
...
0
votes
1answer
190 views
How to use traditional pixel coordinates system in OpenGL? (with C++/SDL2)
I find the normalized, centralized coordinate system used in OpenGL weird and annoying, is there anything I can do at all to make it work like normal pixel coordinates on everything ever except ...
1
vote
1answer
148 views
Pathfinding with differently-sized objects on tile map [duplicate]
It's my first RTS game and I'm having trouble finding out how to make infantry take less space than tanks.
Right now I have 1 tank and 1 infantry type ready with sprites, pathfinding, selection and ...
-2
votes
1answer
999 views
Porting SDL OpenGL Game to Android and IOS
I am currently learning OpenGL (3.0+) with C++. I am using SDL for input handling, window creation, etc., GLEW to use OpenGL and call OpenGL Functions, and GLM for OpenGL Math stuff.
If I fully ...
1
vote
1answer
95 views
Fastest way to render image data from buffer
Currently I am doing my rendering by using a 3D array window_width x window_height x rgb as a buffer, then looping through the buffer and plotting pixels on screen using SDL2 (SDL_RenderDrawPoint). I ...
1
vote
1answer
113 views
Keyboard input vs character movement encapsulation
In our game created with c++ and sdl we are having difficulty delegating how the main character should be controlled. We have a keyboard class and a sprite class for the main character, but are ...
1
vote
1answer
114 views
Entity to tile collision detection (C++, SDL)
I'm currently trying to handle collisions between entities and a tilemap, but I've hit a problem. My tiles are stored simply as integer tile IDs in a multidimensional array, and I wanted to perform a ...
0
votes
1answer
37 views
Bouncing projectile off of sprite, the sides work but top and bottom do not
I'm having a problem bouncing a projectile off a sprite, we've been asked to move the projectile using the equations of motions which makes things a little more difficult but as far as I can see what ...
2
votes
1answer
177 views
Should I cull off-screen objects in SDL2
My game will have a large number of objects moving offscreen at any given time, can i just render them all with SDL_RenderCopy even though they are off screen or should I only render them if they are ...
1
vote
1answer
100 views
Passing an SDL KeyboardState(Uint8*) to Lua
I'm working on my first big project and I've decided to integrate Lua with my C++ framework. Everything's worked out so far, but the only way I've managed to pass the SDL_GetKeyboardState(NULL) array ...
0
votes
1answer
129 views
Is this a good way to regulate fps?
In all of my tests I always regulate the fps by using this method.
const int fps = 30;
const int msPerFrame = 1000/fps; // 33 ms per frame, so it's more like 30.3030 fps
while(true)
{
const int ...
0
votes
1answer
52 views
Box platform collision
I'm working on a platform game and my collision code is to picky. I can't exactly do aabb(?) because the map is represented as metatiles. (23-24 16x16 tiles make up a 300ish pixel resolution.) My game ...
1
vote
2answers
149 views
SDL draw dynamic select box
this might seem obvious to many, but I'm stuck and I cannot find any tutorial which helped me, so it would be great to find the answer here.
I tried to make a rectangle like you have in RTS games, so ...
0
votes
1answer
196 views
How do I modify textures in SDL with direct pixel access?
I'm trying to use SDL_LockTexture and SDL_UnlockTexture for directly editing pixels in a texture. I'm using SDL 2.0. Setting the pixel value using the following code doesn't modify the texture:
void ...
0
votes
1answer
173 views
SDL pixel access very slow
I'm using SDL and need to plot pixels one by one on the screen. When I do this, it's extremely slow. I followed the tutorial here:
http://www.programmersranch.com/2014/02/sdl2-pixel-drawing.html
...
0
votes
2answers
165 views
Redefining the SDL rect struct
Upon checking the docs of SDL (1.2) I saw that the SDL_Rect struct defines the x and y as Sint16. I'm making a bitmap font text scroller and I need those specifically to be unsigned ints because the ...
0
votes
0answers
93 views
Pixel buffers in SDL
I'm using SDL and c++ and trying to create a class to work on pixel basics. The buffer is a multidimensional char array.
char buff[scW][scH];
The video mode is being set by a ...