Development Environment

The development environment utilizes VSCode, Cmake and the Emscripten SDK to enable an IDE-like workflow that produces a wasm runtime which can be ran in the browser.

Prerequisites

First make sure that the following tools are in the $PATH. To obtain these you can use Brew on macOS, Scoop on Windows, or apt-get on Linux.

Extensions

You’ll also want the following VSCode extensions:

Getting Started

First youre going to want to clone the repository, and update out submodules.

git clone https://github.com/mathewmariani/gpr300-sokol
git submodule update --init --recursive

We’re also going to want to install the Emscripten SDK and add it to the $PATH. This will allow us to compile C++ source code to WebAssembly for execution the browser.

git clone https://github.com/emscripten-core/emsdk
cd emsdk
./emsdk install latest
./emsdk activate --embedded latest
source ./emsdk_env.sh
cd ..

Project Structure

This project was intentionally designed to be *small* and easily comprehensible. Let’s look at some important folders

External Libraries

The first thing we should look at are the external libraries, and what they offer

All of these libraries will be used throughout the course.

Assignments

Each assignment is an individual implementation file (.cpp) that will need to be added to /assignmments/CMakeLists.txt like so

add_subdirectory(my_assignment)

Behind the scenes a compilation target will be created, and the libraries will automatically be linked and included.

/assignmments/boilerplate.cpp is a small implementation file used by all assignments to initialize the platform abstration, and other processes required.

Assets such as models, shaders, and textures MUST be placed in /assets. This directory will be symlinked to the appropriate directory upon being built.