Advertisement

Latest SDL2 Activity

Advertisement

congrats! keep going. + start by just detecting the edges of the screen instead of a full AABB. 

10,173 views
Aressera
August 08, 2023 08:47 PM

frob said:
Think like Lego blocks, ten or so basic blocks can be used in many ways to build complex creations.

@frob I'd be curious if you could provide some examples of these to help make things more concrete.

2,898 views

@Gnollrunner That sounds like a really interesting project! I just think that it might be too complex for my current skill level, but I will check the videos from your blog for sure. I'll contact you if I still have the courage ?

4,758 views

I used memcpy to get what I needed done.

SDL_LockSurface(surf1);
  memcpy(surf1→pixels, memory, bytes);
SDL_UnlockSurface(surf1);

Hopefully that'll help someone searching later.

5,643 views
Nick72c
July 03, 2022 01:47 AM
Parallax Zoom!! Gone Green!!

With no-one coming forward to offer artistic support I pushed forward and reworked / improved to my limitations, all background graphics.

Then added the remaining lives indicator and improved AI attack patterns,

From very early on in the games development I wanted to use a restricted number of textur…

5,798 views
Nick72c
April 06, 2022 05:38 PM

@joej @fleabay

Thank you both - this has been bugging me (excuse the pun) for days.

Hearing Joe's explanation I was just about to ripe out the vectors and replace them with fixed size arrays, but enemy_image.reserve(20); worked a treat ? thank you!

https://nickchantrell.github.io/Parrallax-Zoom-SDL2/

16,352 views
Nick72c
March 18, 2022 05:55 PM

Thanks again for the tips @frob 

I got it going with a single texture of 4x screens wide, then added some layers for a bit of parallax scrolling.

Again - please ignore the ‘artwork’ which is just a placeholder.

6,240 views
Nick72c
March 05, 2022 07:50 PM

Ah, yes, I had completely forgotten that I was scrolling the background by an entire tile at a time (50 pixels).

So the new code can now scroll one pixel at a time, the problem with this is at 60fps that's only 60 pixels per second!   That turns out to be uncomfortably slow.

Here it's scrolling …

4,973 views

The answer is to use whatever data format you like best, that fulfills your needs. Everything has their pros and cons. The question is if you want it to be human read-/editable or if you have some kind of editor and prefer more compact and faster loading.

The former can be achieved using text based …

6,278 views

I'm no SDL guru but I see a problem in your update (except for that it should be handleEvents and not HandlerEvents). You don't poll for all events but only for 1 and so there might be events in the background which involve those flickering. The usual game loop looks like this

while(run)
{
    while…
4,534 views

jhbardwell said:
I'm new to C++, so having trouble translating this idea into working code.

A common trick is to reduce the scope of the first version a lot (as much as possible, usually). Start with 1 button, hard-coded state, hard-coded size, hard-coded position. Make it work. That gives a lot of s…

5,346 views
2d platformer, patrolling enemy implementation question design

Hi, I am working on a platformer where I want an enemy to ‘patrol’, walk back and forth between edges of a platform. 

Below a screenshot:

Here I would simply like the enemy skeleton to walk back and forth between the whole platform,
turning at the edge on the left and turning again at the wall on…

3,595 views

@Shaarigan SDL has a bunch of pre-canned controller mappings for known controllers (http://hg.libsdl.org/SDL/file/e52d96ea04fc/src/joystick/SDL_gamecontrollerdb.h​).​ The issue here is that the controller mapping for this controller seems to be wrong.

11,345 views

ok ty
If other people want participate you can up this topic or pm me : )

7,684 views
clb
December 31, 2020 11:38 AM

fudgeracoon said:

I'm writing my very first 2D game engine in C++ and SDL2. I wrote a very simplistic RigidBody class that computes the resultant force, applies forces and simulates gravity. I also wrote a BoxCollider class and a QuadTree class which as any game dev would know manages collisions. Ev…

5,946 views
RedBull4
September 06, 2020 09:16 AM

if you have Linux:

#include <SDL2/SDL.h>
#include <SDL2/SDL_opengl.h>

typedef const char *String;

SDL_Window *window;
SDL_Event event;
SDL_GLContext glContext;

struct WindowData{
    int WIDTH=800, HEIGHT=800;
    int POS_X=SDL_WINDOWPOS_CENTERED, POS_Y=SDL_WINDOWPOS_CENTERED;
    Str…
7,450 views
How to rotate a line around a point?

alvaro said:

If you know how to rotate points, you can rotate line segments, just by rotating the ends. If you know how to rotate points around the origin, you can rotate cpstest points around arbitrary points, by first subtracting the coordinates of the center of rotation, then rotating around the …

10,158 views

MikeCyber said:
how would those sdl commands look in OpenGL

One tip you should every try first before asking such things:

  • Read the docs
  • Read the source code if available
  • Set a breakpoint in your favourite IDE and follow the function step by step to se what's going on under the hood

You'll learn more on d…

4,486 views
ZerohBeat
March 31, 2020 05:25 PM
Finally I made a game.

Hi, its Aleks. 

This is my post mortem of making my first game from start to finish and publishing the game.

Game Page: https://zerohbeat.itch.io/zerohbeat-adventure

My game is a very simple and very short Adventure / Visual Novel style game

The game is built using:

  • C++ and SDL (for rendering, wind…
3,855 views
Advertisement
Advertisement