ShatteredSword/src/main.ts

36 lines
1.4 KiB
TypeScript
Raw Normal View History

import Game from "./Wolfie2D/Loop/Game";
2021-02-15 19:44:47 -05:00
import Homework1_Scene from "./hw1/HW1_Scene";
import Registry from "./Wolfie2D/Registry/Registry";
import { Homework1Shaders } from "./hw1/HW1_Enums";
import GradientCircleShaderType from "./hw1/GradientCircleShaderType";
2020-08-03 16:51:20 -04:00
// The main function is your entrypoint into Wolfie2D. Specify your first scene and any options here.
(function main(){
2021-02-15 19:44:47 -05:00
// Set up options
let options = {
2021-02-15 19:44:47 -05:00
canvasSize: {x: 1200, y: 800},
clearColor: {r: 0.1, g: 0.1, b: 0.1},
inputs: [
2021-02-15 19:44:47 -05:00
{ name: "forward", keys: ["w"] },
{ name: "backward", keys: ["s"] },
{ name: "turn_ccw", keys: ["a"] },
{ name: "turn_cw", keys: ["d"] },
],
useWebGL: true,
showDebug: false
}
2021-02-15 19:44:47 -05:00
// We have a custom shader, so lets add it to the registry and preload it
Registry.shaders.registerAndPreloadItem(
Homework1Shaders.GRADIENT_CIRCLE, // The key of the shader program
GradientCircleShaderType, // The constructor of the shader program
"hw1_assets/shaders/gradient_circle.vshader", // The path to the vertex shader
"hw1_assets/shaders/gradient_circle.fshader"); // the path to the fragment shader
2021-02-15 19:44:47 -05:00
// Create a game with the options specified
const game = new Game(options);
2020-08-03 16:51:20 -04:00
2021-02-15 19:44:47 -05:00
// Start our game
game.start();
game.getSceneManager().addScene(Homework1_Scene, {});
})();