Skip to content

Commit

Permalink
feat: update renderer
Browse files Browse the repository at this point in the history
  • Loading branch information
load1n9 committed Feb 7, 2023
1 parent bd80870 commit 7ad5834
Show file tree
Hide file tree
Showing 8 changed files with 27 additions and 12 deletions.
2 changes: 1 addition & 1 deletion cli/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "2.6.1";
export const VERSION = "2.6.2";
13 changes: 13 additions & 0 deletions deno.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"tasks": {
"example_atlas": "deno run -A --unstable examples/atlas.ts",
"example_frame": "deno run -A --unstable examples/frame.ts",
"example_godot": "deno run -A --unstable examples/godot.ts",
"example_image": "deno run -A --unstable examples/image.ts",
"example_movingsquare": "deno run -A --unstable examples/movingsquare.ts",
"example_perlin": "deno run -A --unstable examples/perlin.ts",
"example_sprite": "deno run -A --unstable examples/sprite.ts",
"example_texturesprite": "deno run -A --unstable examples/texturesprite.ts",
"example_transparent_window": "deno run -A --unstable examples/transparent_window.ts"
}
}
2 changes: 1 addition & 1 deletion deps.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
// export * from "https://deno.land/x/daybreak@0.1.2/mod.ts";
export { Matrix4 } from "https://deno.land/x/gmath@0.1.11/mod.ts";
export * from "https://raw.githubusercontent.com/deno-windowing/gluten/main/mod.ts";
export * from "https://deno.land/x/gluten@0.1.4/mod.ts";
1 change: 1 addition & 0 deletions examples/image.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const test = new World({
width: 1800,
height: 1600,
resizable: true,
gles: true
}, [Game]);

await test.start();
9 changes: 5 additions & 4 deletions src/World.ts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
import { WindowKeyboardEvent } from "https://raw.githubusercontent.com/deno-windowing/dwm/main/mod.ts";
import { CreateWindowOptions, WindowKeyboardEvent } from "https://deno.land/x/dwm@0.3.0/mod.ts";
import { WebGLCanvas } from "../deps.ts";
import { Scene } from "../mod.ts";
import { KeyManager } from "./events/KeyManager.ts";
import { WebGLRenderer2D } from "./renderers/webgl/2d.ts";
import type { MouseMotionEvent, RGBA, WorldOptions } from "./types.ts";
import type { MouseMotionEvent, RGBA, } from "./types.ts";
import { hexToRGBA, printBanner, sleepSync } from "./utils/mod.ts";
import { VERSION } from "./version.ts";

export class World extends WebGLCanvas {
FPS = 500;
params: WorldOptions;
params: CreateWindowOptions;
scenes: Array<typeof Scene>;
currentScene: Scene;
renderer: WebGLRenderer2D;
Expand All @@ -19,9 +19,10 @@ export class World extends WebGLCanvas {
// deno-lint-ignore no-explicit-any
loadedPlugins: any = [];
reRender = false;
constructor(params: WorldOptions, scenes: Array<typeof Scene>) {
constructor(params: CreateWindowOptions, scenes: Array<typeof Scene>) {
super(params);
this.params = params;
// this.params.glVersion = this.params.glVersion || [3, 3];
this.scenes = scenes;
this.currentScene = new this.scenes[0](this);
this.keyManager = new KeyManager(this);
Expand Down
8 changes: 4 additions & 4 deletions src/renderers/webgl/shader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import {
} from "../../../deps.ts";

export const vertex2d = `
#version 330 core
// #version 330 core
attribute vec2 aVertexPosition;
attribute vec2 aTextureCoord;
Expand All @@ -30,7 +30,7 @@ void main(void) {
`;

export const fragment2d = `
#version 330 core
// #version 330 core
varying vec4 vColor;
varying highp vec2 vTextureCoord;
Expand All @@ -48,7 +48,7 @@ void main(void) {
`;

export const vertex3d = `
#version 330 core
// #version 330 core
attribute vec4 aVertexPosition;
attribute vec4 aVertexColor;
Expand All @@ -64,7 +64,7 @@ void main() {
`;

export const fragment3d = `
#version 330 core
// #version 330 core
varying lowp vec4 vColor;
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "2.6.1";
export const VERSION = "2.6.2";
2 changes: 1 addition & 1 deletion web/src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = "2.6.1";
export const VERSION = "2.6.2";

0 comments on commit 7ad5834

Please sign in to comment.