Skip to content

Replace SDL with minifb#20

Merged
facundoolano merged 16 commits into
mainfrom
minifb2
Mar 7, 2022
Merged

Replace SDL with minifb#20
facundoolano merged 16 commits into
mainfrom
minifb2

Conversation

@facundoolano
Copy link
Copy Markdown
Collaborator

This branch explores using the minifb crate instead of SDL for pixel writing and window events.

Pros:

  • minifb is specifically focused on writing pixels to a framebuffer, which is the exact use case of this project.
  • the API requires less boilerplate and doesn't carry the ownership issues of the rust sdl bindings (which required creating a texture manager that couldn't be passed around in structs easily). This change enabled packing most of the code in the Game and Video structs, which hint a possible path to rearranging the codebase (partially explored in this branch).

Cons:

  • minifb doesn't expose primitives for writing lines and rectangles, and because of this I couldn't easily port the ray caster code that was drawing the map and rays on a separate window.
  • it doesn't have sounds support, so if we ever get to that point, we'll have to look for another crate to handle that part.

The performance seems to be more or less the same as sdl (slow on debug, fast on release mode)

@facundoolano facundoolano merged commit 6b36a30 into main Mar 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant