Code Monkey home page Code Monkey logo

fib's Introduction

SDL2 MinGW VSCode C Template

A starter template for SDL2 projects written in the C language on VSCode and compiled with MinGW on Windows 32-bit.

Minimum requirements:

  • Windows 7
  • Visual Studio Code (aka VSCode)
  • C/C++ extension for VSCode installed and enabled
  • MinGW basic setup (with at least the GNU C compiler/linker)
  • SDL2 library files already installed in their proper locations inside the MinGW folder structure (more instructions at the end of this readme). Note that you should have the development libraries for MinGW (you'll want to download something like SDL2-devel-{version}-mingw.tar.gz in the SDL2 download page)

This starter contains the following features:

  • The template.c file contains some boilerplate code to quickly get a basic SDL2 program up and running with a window, renderer and backing texture (aka pixel buffer), as well as boilerplate code to properly shutdown the application.
  • The run.bat file contains batch commands to automatically compile the template.c file into template.exe by linking with the SDL2 libraries and then execute the sample application.
  • The .vscode folder contains VSCode specific configuration files to work with the C/C++ extension. You might need to tweak some settings so they apply to your actual environment.

To test your setup:

Open this template folder in VSCode, bring up the terminal, type run then press enter. This will execute the batch file run.bat, which will automatically compile/link the code, generate the executable and launch it.

Follow the instructions below if you still don't have SDL2 properly installed in your MinGW setup:

Note: In the SDL2 MinGW development libraries distribution archive you might find the same library files in two different subfolders like i686-w64-mingw32 and x86_64-w64-mingw32. Be sure to pick the files from inside the i686-w64-mingw32 folder only, since this is where the 32-bit stuff is located, or the template will not compile properly.

The proper locations for the SDL2 library files inside your MinGW installation folder should match the following:

  • File SDL2.dll goes into MinGW/bin/
  • Folder include/SDL2 goes into MinGW/include/
  • All files in folder lib/ go into MinGW/lib/

And that's it.

fib's People

Contributors

bear148 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.