Giter Site home page Giter Site logo

bencehari / simplesdl2bgfxgame Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 249 KB

Creating a game with SDL2 and bgfx in C++ (but close to C as possible) in the name of make game, not engine.

C 71.57% Batchfile 1.33% C++ 27.10%
bgfx game-development handmade-products sdl2 c

simplesdl2bgfxgame's Introduction

Project goal

Learning 3D game development a little bit lower than start to use a game engine.

Main bullet points of the experiment:

  • 3D game with input handling, animation and audio at least two platforms
  • Use the least number of techs
  • Go for simplicity, embrace new solutions only when a problem arose

UPDATE: looks like I love to know how things work, so when I got to texturing, I had to dive into DDS (it's WiP), and to validate some steps, a simple TGA lib also has been written.

Specs

  • OS: Windows 11 Pro
  • Editor: Notepad++
  • Console: Windows PowerShell/Command Prompt

Set-up

Create a paths.txt in the root of the project (it is .gitignore'd to avoid overriding different paths on different computers with VC).

SDL2

  • download SDL2: Releases · libsdl-org/SDL (github.com) (SDL2-devel-x.y.z-mingw.zip)
  • unzip "x86_64-w64-mingw32" folder
  • copy SDL2.dll into projects bin folder from "x86_64-w64-mingw32\bin"
  • add the path "to\the\SDL2\x86_64-w64-mingw32" to paths.txt (must be first line and don't forget the \ at the end)

bgfx

git clone https://github.com/bkaradzic/bx.git
git clone https://github.com/bkaradzic/bimg.git
git clone https://github.com/bkaradzic/bgfx.git

cd bx
make mingw-gcc-debug64

cd ..
cd bimg
make mingw-gcc-debug64

cd ..
cd bgfx
make mingw-gcc-debug64
  • add the path "to\the\bgfx" (where the bgfx, bimg and bx folders are) to paths.txt (must be second line and don't forget the \ at the end)

Editors

Visual Studio Code

Open File/Preferences/Settings (CTRL+,), select Workspace and search for 'include', then add these items to C_Cpp > Default: Include Path:

  • path/to/SDL2/x86_64-mingw32/include/**
  • path/to/bgfx/include/**
  • path/to/bimg/inlcude/**
  • path/to/bx/include/**

Or add them to the .vscode/settings.json file like this:

{
    "C_Cpp.default.includePath": [
        "path/to/SDL2/x86_64-w64-mingw32/include/**",
        "path/to/bgfx/include/**",
        "path/to/bimg/include/**",
        "path/to/bx/include/**"
    ]
}

Usage

Build

Simply call .\w_build.bat in the root folder of the project.

I don't use any of make/CMake/MakeFile.txt stuff, because I want to reach that point, when I feel I need something like that, then choose a solution for my needs.

w_build.bat

For setting debug mode on or off, change the SET debug_mode= line.

simplesdl2bgfxgame's People

Contributors

bencehari 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.