• takunomi

    play, talk, develop

    • past
    • the girl who kicked a rabbit
    • about
    • contact
  • SDL2 on MacOS with SDL2_image

    2018–06–06

    Above is a video from Craig Forresters Leilani’s Island. I’m pretty sure it’s made in SDL2 + C/C++. Even if it isn’t… look at that shit, it’s amazing.

    Twitter: @ishisoft

    YouTube Video: Gameplay

    Stray Thoughts

    After the tutorial part.

    The Actual Article

    SDL2 is the answer for someone reading a coding tutorial for C or C++ and thinking

    “CLI output is cool, but I want to make programs that run inside Windows and have graphics.”

    This beautiful tutorial by Sarah Edkins gives most of the info needed. She skips mentioning what “brew” actually is. (Home)brew is a way to install and keep tabs on command-line programs on OSX. If you don’t have it, you’ll need it, and in either case, you’ll want it.

    Just follow her tutorial.

    Now that that’s done, some other things I had to google and I want to spare you from:

    • You’re gonna need more than bmp files in your program, so you’re gonna need SDL2_image.h. You install that like you installed SDL2: brew, then copy the files into the same folders as before.
       Brew install SDL2_image
    
    
    • You’ll have to update the make-file to refer to the .h file. After
       -l SDL2-2.0.0
    
    

    add

       -l SDL2_image
    
    

    Notice that the hyphen-plus-l is added again. This is vital. Also remember that you can use \ to make new lines.

    Aforementioned stray thoughts

    With what little sparetime I have, it felt kinda good to sit down for a few hours the other night, just to spend time on a project that didn’t look like it would amount to anything but me feeling good about what I’d done.

    I’d wanted to give SDL2 with plain C another go. Why? The usual reasons of wanting to feel like I’d made something myself, and gain some knowledge of C. After setting everything up, and doing a few parts of LazyFoos tutorials, it occured to me that if I shared this little evening, I could save some people some trouble.

    Return to top. ↺

    Looking for more to read? Try the past section.