3
votes
3answers
132 views

Make openGL program only update every 1/60 seconds

I'm learning C++ and openGL and have this program as a result from tutorials and playing around. The problem is that the main loop is running at "full speed", making the program unnecessarily cpu ...
5
votes
2answers
221 views

Do I really need to clear the renderer every iteration?

Just a quick question about fine-tuning/optimization. If I'm making a 2D platformer with a parallax-scrolling background (meaning no two frames are the same) do I really need to clear my renderer for ...
2
votes
1answer
111 views

How can I implement a dialogue where the words appear as if they were being typed?

I'm planning on putting a dialogue system into my game, I don't really work with surface so my way of implementing SDL_Ttf is by turning it into a texture, in other words, every paragraph would be ...
1
vote
3answers
186 views

How can I implement a main menu?

I have been following the tutorials at http://lazyfoo.net/tutorials/SDL/index.php and although they are all very well written and I have learned more than I would have on my own, I am not sure how to ...
1
vote
2answers
73 views

How can I render a texture to the screen in SDL2?

I've recently started upgrading my SDL version from 1.2 to 2.0.3, and while on the SDL Wiki, I've come across SDL_Renderer, SDL_Window, and SDL_Texture. I did some research and found a link at ...
1
vote
1answer
98 views

Scrolling with SDL2 & Box2d - My Camera isn't keeping up with my player

I'm trying to get a game on the google play store before I'm 40 (long held dream to publish a game since the days of the speccy), I have just over a month to go so it's not looking good! Foolishly I ...
1
vote
0answers
48 views

How do I make a game object move at an angle in an integer-indexed grid? [duplicate]

I'm making a game in SDL2 and C++. I want a way to make any game object move in a specific direction. I've thought of assigning each object a direction in radians, from 0 until 2 PI where 0 would ...
1
vote
0answers
45 views

SDL_FillRect() causes access violation on palletized surface with specific inputs [closed]

SDL2-2.0.1, Windows 7, MSVC 2008. Originally saw this problem with the release SDL libs, debugging now with the development libs. Following is the entire program I'm running, minus error checking for ...
0
votes
2answers
65 views

Collision detection in seemingly random locations [closed]

I have a square that moves around with user input and should return to top left of screen when it collides with one of the rectangles on the screen. It works fine when the the rectangles are not ...
0
votes
1answer
107 views

Why does this code to filter events with SDL not function properly?

According to the SDL2 wiki, SDL_SetEventFilter : Use this function to set up a filter to process all events before they change internal state and are posted to the internal event queue. ...
0
votes
1answer
72 views

Why does my SDL code crash when I move the mouse over the window?

Whenever I move my mouse below where the image renders in my game, the SDL window crashes and closes down. I have narrowed the crash down to the bit of code where I check to see if the Escape key ...
3
votes
1answer
121 views

How to convert a SDL window to a SDL surface? SDL 2

I am trying to make a paint program and there is a sdl function called IMG_SavePNG() which requires a surface and destination file. How can I turn what I see in the window to a surface?
1
vote
0answers
85 views

Im getting LNK2019 errors using SDL 2.0.1 in visual studio 2013 [closed]

Here are the error codes and Here Is the link to all the code: Error 5 error LNK2019: unresolved external symbol WinMain@16 referenced in function __tmainCRTStartup ...
0
votes
1answer
92 views

How to handle simultaneous mouse and keyboard input with sdl?

I'm making a game in SDL2 that so far is basically just a top down shooter, where the player aims at the mouse. When I run the game, you can move properly and shoot properly, and shoot and move the ...
1
vote
1answer
70 views

Multiple keys being pressed, some being ignored SDL

I'm making a two player pong clone and my problem is that when the second player presses both of his/her buttons at once, the first player locks up and cannot move, even though this does not happen ...
1
vote
1answer
84 views

Why do I get an access violation while reading the pixels of an SDL_Surface as follows?

I'm trying to write a software rasterizer and I'm in the step to texture a triangle. I'm trying to get a pixel from an SDL_Surface which is an image, 100x60 at 24 bits of color depth. I got a read ...
1
vote
2answers
336 views

How can I rotate a bitmap without D3D or OpenGL?

I've just figured out on my own how to scale a portion of a bitmap using PutPixel. I would like to know the mathematical theory behind rotating a bitmap on my own, using per-pixel operations like ...
1
vote
2answers
265 views

SDL 2.0 filtering mouse events

I have a simple 2-D breakout clone. It works fine, except for one bug. If I move mouse over game window, it will get input from mouse(mouse movement), and event queue will instantly be flooded with ...
0
votes
0answers
47 views

Powder physics, how to efficiently find out where other particles are [duplicate]

You might be familiar with games like powder toy or powder game or some variation of it. I'm working on a very basic and similar game with just sand and water to learn a bit how it on works. I use ...
5
votes
2answers
433 views

Rotating object around moving object/player in 2D

I am trying to implement a camera which rotates around the world around the player. I have found many solutions online to the task of rotating an object about the origin, or about an arbitrary point. ...
1
vote
1answer
115 views

Brief pause after keypress

After i press and hold the key it goes forward once then pauses for a second or less then goes forward on forever. My problem is the brief pause I cant locate the issue. Thanks for your help. ...
0
votes
2answers
887 views

Altering pixel value in an SDL2 texture

Alright, I have spent a lot of time on this one, so I need some help. I like the ability to draw pixels directly to the screen, sometimes I do this to trace the path of objects for debugging etc. In ...
2
votes
1answer
185 views

How to implement scripted events?

I'm building a game in C++ (using SDL) for a college project, I'm trying to figure out how to script events that happens when a player does something, or some time passes etc. I have a and idea of ...
-1
votes
2answers
201 views

Pixel size for clips in retro NES-like game?

I'm making a retro videogame, currently I'm using 32px x 32px tiles for the map and 64px x 32px for the characters. However the game looks extremely small, I could increase the tile size to something ...
0
votes
0answers
235 views

How do I use Opengl in conjunction with SDL?

I've been using SDL for a while in simple 2D games but have been limited as to what I can do graphics wise. I would like to start using Opengl. Does anyone know of any web tutorials for using Opengl ...
0
votes
2answers
214 views

How to move player based on existing Game state?

I'm trying to build a basic platforming game in C++ using SDL, and I've encountered this issue enough to know that there's something I'm missing. What I'm working with, at the most basic level, is ...
7
votes
2answers
2k views

Input management techniques in large games

Is there a standard technique for managing input in large games. Currently, in my project, all input handling is done in the game loop, like so: while(SDL_PollEvent(&event)){ ...
0
votes
2answers
515 views

SDL Function for Loading PNGs

I'm learning SDL 2.0 at the moment and I've seen this method for loading BMPs: SDL_Texture* LoadImage(std::string file) { SDL_Surface *loadedImage = nullptr; SDL_Texture *texture = nullptr; ...
2
votes
2answers
4k views

SDL 2.0 setup on code::blocks using gcc(MinGW) on win7 [closed]

I have recently installed code::blocks on my system running windows 7 home premium 64-bit, and wanted to start learning SDL. The code::blocks executable is the one installed by the ...
2
votes
1answer
237 views

2D Circular View/Background Wrapping SDL for Game

In the games such as Defender (1980 arcade) and Defcon, the player can move/scroll in one direction infinitely because the level/terrain simply wraps over and over again(like if it was wrapped around ...
0
votes
1answer
670 views

OpenGL + SDL Linking Problem [closed]

So I'm trying to write a simple application with SDL 1.2 and OpenGL. This a stripped down version of the code containing the one problem I'm having. //The headers #include "SDL.h" #include ...
0
votes
1answer
122 views

SDL 1.3 on Windows 7. Better hardware,lower FPS [closed]

I've just moved from one PC to another.I've been developing a game in SDL with SDL_image and SDL_ttf for about one year. On my old pc, I had about 90 FPS on my game, but now I have about 30, witch I ...
1
vote
0answers
57 views

Glowing Effect and Blending [duplicate]

I am using C++ and SDL and I am trying to get lines with a glowing effect as provided by the image of the game Defcon on the continental outlines. How could I achieve this glow and blend of the ...
2
votes
3answers
286 views

Efficient Collision Detection With Numerous Objects at Once [duplicate]

I am developing a 2D game with very large levels in which two teams(around 200 objects per team) fight against each other in planes, tanks, turrets,...etc. With every entity shooting bullets at their ...
0
votes
1answer
63 views

SDL - BlitSurfaced Background Slowing Time Based Movement

Whenever I use BlitSurface to apply a background image, the movement of my characters is slowed drastically even though I have movement based on time: SDL_BlitSurface( background, camera, screen, ...
1
vote
2answers
2k views

How to implement SDL Button/Menu GUI with callbacks?

I have been reading Bjarne Stroustrup's Programming Principles and Practice Using C++ for a while now and am nearing the end of the book. I have to tried to make a very simple game using the SDL ...
3
votes
1answer
275 views

Does SDL running on Mac OS not recognize Xbox controllers?

I'm trying to learn a bit of SDL, and have been bouncing between Windows and Mac platforms, but am noticing that an SDL program running on my Macbook doesn't recognize the presence of the Xbox ...
-1
votes
1answer
367 views

OpenGL/SDL2 window stopped rendering [closed]

I have been working on a game engine for a couple of days now and I've had it rendering a colourful cube and playing sounds in OGG format, but, after refactoring my code-base to make things easier; it ...
-1
votes
1answer
225 views

SDL Access Violation

I've created a SDL game project and this window popped up while trying to compile: First-chance exception at 0x00000000 in SDL_Game.exe: 0xC0000005: Access violation executing location 0x00000000. ...
-4
votes
1answer
220 views

C++ SDL/SFML advancing help [closed]

I've been playing around programming using SDL and SFML for a while now and done all the basic tutorials I can find(love lazyfoo). but I'm stuck and not sure how to move on from simple games like ...
2
votes
1answer
151 views

sdl: unlock mouse in fullscreen mode and make it useable on another monitor

Is it possible to unlock the mouse in fullscreen mode so that you can use it on a another monitor? I read trough the SDL documentation, but I couldn't find anything related to my problem.
1
vote
2answers
519 views

My SDL Game executable cannot run outside codeblocks

After compiling and running SDL programs successfully inside CodeBlocks, when I run them outside CodeBlocks (by clicking .exe file) my program does not run. Instead, it says that libstdc++6.dll is ...
-2
votes
1answer
326 views

SDL_BlitSurface does not works

I have an issue with the SDL_BlitSurface... When I blit (SDL_BlitSurface) in a transparent (background) surface, it does not blits, actually I tried all the existants functions ...
2
votes
1answer
1k views

Is basic SDL hardware accelerated?

I'm going over some SDL tutorials aimed at creating 2D games. However, when I create a basic SDL program - is it hardware accelerated? Or is hardware acceleration only relevant when it comes to 3D ...
0
votes
1answer
216 views

SDL.NET vs SDL C++

I am currently transitioning from XNA to SDL, and was wondering if SDL.NET provides the same benefits as SDL C++. Considering that SDL.NET uses the .NET framework as a wrapper to the SDL base ...
1
vote
1answer
528 views

SDL2 focus lost = massive gain in FPS

Whenever I lose focus from my game window, I go from ~60FPS to 6000+, then when the window gains focus again, I go back to around 60 frames per second. And yes, this happens every time I run my game, ...
-2
votes
2answers
933 views

making a game in 2D(C++). SDL or openGL? Or, why not both? [closed]

I'm trying to make a platform game in 2D and I want to know what tool should I use to make it happen. I understand that I can use SDL with openGL. However, if I want to make a solid 2D platform game, ...
1
vote
1answer
182 views

Implementing a Menu System and Buttons (Waiting in a whle loop)

I have a menu system with four screens and six buttons. I have created a button class and it works great. I even have events for the buttons working. The problem is that I have to run the events ...
0
votes
1answer
548 views

Does SFML render it's graphics using OpenGL internally?

By that, I mean that SFML has an abstraction for OpenGL? Sort of like SDL's blit functions, but using OpenGL internally? "Yes SFML uses OpenGL for all the graphical stuff. " Received this comment ...
4
votes
3answers
6k views

How to draw 2D images using OpenGL, in SDL?

After everything, I managed to find a simple piece of code that shows how to draw a 2D image with openGL: #include "SDL/SDL.h" #include "SDL/SDL_opengl.h" #include "SDL/SDL_image.h" ...