0.0.1-beta.4 • Published 5 years ago
@swwind/aurora v0.0.1-beta.4
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_mixerThen, you can add @swwind/aurora to you project.
yarn add @swwind/auroraOn 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 fpsTODOs
- SDL2 image
- SDL2 ttf
- SDL2 mixer
- Documents
- Error handler
- Build on windows
- Release method
0.0.1-beta.4
5 years ago
0.0.1-beta.3
5 years ago
0.0.1-beta.2
5 years ago
0.0.1-beta
5 years ago
0.0.0-alpha.3
5 years ago
0.0.0-alpha.2
5 years ago
0.0.0-alpha.1
5 years ago
0.0.0-alpha
5 years ago