How do I render and move .png sprites?


#1

Greetings. I have a Master’s Degree in Software Engineering and am experienced with C++. I also used both LÖVE and PICO-8 in making games, but I want to try to write a Libretro core itself.

I took a look at the Libretro API and got a lot of trouble with figuring out how to actually display graphics. Because I plan on making SNES-style games, my idea was to use .png files of sprites. So far, I figured out that I would use the RGB565 format and software rendering instead of targeting a specific graphics API, but I got stuck here. Apparently, I have to write to either a framebuffer or a backbuffer, but I have no idea how. I actually am still quite new at drawing graphics; I did not even know about the RGB565 format until I saw the libretro.h file! I know that Libretro uses its own png decoder (rpng), but I do not know how to use that, either.

What I want to do specifically is to be able to draw and move the png-based sprites on-screen, preferably while using a physics engine such as Box2D or Chipmunk.

I appreciate everyone’s response here. I am enthusiastic on making a game using this Libretro API.


#2

Hey, welcome :slight_smile: I believe a lot of that would be dictated by the engine that you write. If you would rather not write your own engine from scratch, you might check out our Lutro core, which is very similar to LÖVE but with libretro:


#3

love2d provides you a complete framework. With libretro you start with a blank slate.

So to render a pixel red… you set that color of the framebuffer red.

Of course on top of that you can add any kind of high level framework you may need.

If I was making a game I would do it in OpenGL even if it was 2d, a sprite in GL is basically a quad with a texture on top. I actually made a test with libretroGL and chipmunk physics once and it worked just fine but I can’t find it, only the fixed function sample (that I’m pretty sure I wrote)

I had a demo of a flat textured ball falling on a flat textured rectangle on a slope and then rolling, it was pretty easy to implement IIRC.

If you want to start from an empty state try this:

It’s a starter core that does literally nothing but start.


#4

Thank you.

How do I go around to learning more about framebuffers in the first place, though?