Skip to content

ASWA Simple Wrapper for SDL3

A lightweight C++20 library for 2D games. Runs on desktop and in the browser.

Lighting example made with ASW

Small and direct ​

A complete program: open a window and move a circle with the arrow keys. The same code runs on desktop and in the browser.

cpp
#include <asw/asw.h>

int main() {
  asw::core::init(320, 240, 2);
  asw::Vec2<float> position(160.0f, 120.0f);

  asw::core::run([&]() {
    asw::core::update();
    const float dt = asw::core::get_delta_time();

    if (asw::input::get_key(asw::input::Key::Left))  position.x -= 120.0f * dt;
    if (asw::input::get_key(asw::input::Key::Right)) position.x += 120.0f * dt;

    asw::display::clear(asw::color::black);
    asw::draw::circle_fill(position, 12.0f, asw::color::cornflowerblue);
    asw::display::present();
  });

  asw::core::shutdown();
}

Made with ASW ​

These are the example programs from the ASW repository. Play them in your browser →

Released under the MIT License.