Specifically designed for desktop software GameWeaver
.
Created since 2024/09/06
- Support multiple scene switching;
- Built-in components in
UI
module:- Button;
- SimpleText;
- FancyCursor as global cursor setting in game
options
; - statefull
Character
;
- Built-in drawing functions in
shape
module:- drawCircleWithFillStroke;
- drawRotatedFillRect;
- drawGradientRect;
- drawSolidTriangle;
- drawFilledRectNoStroke;
- drawRectWithStroke;
- drawStarWithStroke;
- drawTextWith;
- Sound loader & playing support:
initAudio
with multple sound config objectplaySound
in sub-class ofCursor
&Character
- Complete game:
- whac-a-mole;
Game ==> Scence ==> Character
==> Prop
==> Button
==> SimpleText
==> FancyCursor
import { Game, initStage, startGame } from './lib/gw.js';
import { WelcomeScreen } from './scenes/welcome.js';
import { MainScreen } from './scenes/main.js';
const width = 640, height = 480;
const screens = [new WelcomeScreen(), new MainScreen()];
const game = new Game(screens, { width, height });
initStage('gw-playground', width, height);
startGame(game);
const width = 640, height = 480;
const screens = [new GW.WelcomeScreen(), new GW.MainScreen()];
const game = new GW.Game(screens, { width, height });
GW.initStage('gw-playground', width, height);
GW.startGame(game);
$ npm run dev
then visit demo game: http://localhost:5173/
To use shape maker:
visit: http://localhost:5173/shape-maker.html
v0.0.2
change build tool to vite to support engine libraryESM
/UMD
export, @2024/09/12;v0.0.3
fixSimpleText
bug and separateui.js
fromgw.js
;v0.0.4
ImplementFancyCursor
for mouse cursor replacement inui.js
;v0.0.5
Implement multipe basic shape drawing function & sounds load & play API;