0.0.1-beta.4 • Published 3 years ago

@swwind/aurora v0.0.1-beta.4

Weekly downloads
-
License
MIT
Repository
-
Last release
3 years ago

Aurora

This is a game engine based on SDL2.

WIP

Install

You need to install SDL2, SDL2_image, SDL2_ttf and SDL2_mixer first.

On ArchLinux, just install them by using pacman:

sudo pacman -S sdl2 sdl2_image sdl2_ttf sdl2_mixer

Then, you can add @swwind/aurora to you project.

yarn add @swwind/aurora

On Windows, I don't know how to build it.

Try it yourself!

Usage

const aurora = require('@swwind/aurora');

// initialize the window
// more configs see aurora.d.ts
const success = aurora.init({
  title: 'hello world',
  w: 1280,
  h: 720,
});

// handle error
if (!success) {
  console.error('failed to initialize');
  process.exit(1);
}

// listen window events
aurora.bindWindowEventCallback((e) => {
  // handle quit event
  if (e.type === 'quit') {
    // quit event loop
    aurora.quit();
  }
});

// start event loop
aurora.startEventLoop(() => {
  // callback when event loop quitted

  // close the window manually
  aurora.close();
  // and exit the process
  process.exit(0);
});

// render interval
// like requestAnimationFrame
setInterval(() => {
  // fill the whole window with white color
  aurora.fillRect({ x: 0, y: 0, w: 1280, h: 720 }, aurora.color.white);
  // render to window
  aurora.render();
}, 1000 / 60); // 60 fps

TODOs

  • SDL2 image
  • SDL2 ttf
  • SDL2 mixer
  • Documents
  • Error handler
  • Build on windows
  • Release method
0.0.1-beta.4

3 years ago

0.0.1-beta.3

3 years ago

0.0.1-beta.2

3 years ago

0.0.1-beta

4 years ago

0.0.0-alpha.3

4 years ago

0.0.0-alpha.2

4 years ago

0.0.0-alpha.1

4 years ago

0.0.0-alpha

4 years ago