Skip to content

Commit

Permalink
fix more demos to use new viewport api
Browse files Browse the repository at this point in the history
  • Loading branch information
redthing1 committed Jul 16, 2024
1 parent 05e3339 commit 31e2a2c
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 0 deletions.
5 changes: 5 additions & 0 deletions demo/shanpes/source/play.d
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@ import re;
import re.gfx;
import re.gfx.shapes.rect;
import re.ng.camera;
import re.ng.scene;
import re.math;
import comp.input;
import comp.body;
import comp.ai;
static import raylib;

class PlayScene : Scene2D {
SceneCamera2D cam;

override void on_start() {
cam = (cast(Viewport2D) viewports[0]).cam;

auto bg_tween = Tweener.tween(clear_color, Colors.DARKGRAY,
Colors.LIGHTGRAY, 2, &Ease.QuadIn);
bg_tween.start();
Expand Down
3 changes: 3 additions & 0 deletions demo/table/source/play.d
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,15 @@ static import raylib;

/// simple 3d demo scene
class PlayScene : Scene3D {
SceneCamera3D cam;
private PostProcessor glitch_postproc;
private float[2] sample_offset = [0.005, 0];

override void on_start() {
clear_color = Colors.LIGHTGRAY;

cam = (cast(Viewport3D) viewports[0]).cam;

// load shader effects and add as a postprocessor
auto ascii_shd = new Effect(Core.content.load_shader(null, "shader/ascii.frag").front, Colors.WHITE);
ascii_shd.set_shader_var_imm("i_resolution", cast(float[3])[
Expand Down
3 changes: 3 additions & 0 deletions demo/three/source/play.d
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,15 @@ static import raylib;

/// simple 3d demo scene
class PlayScene : Scene3D {
SceneCamera3D cam;
private PostProcessor glitch_postproc;
private float[2] sample_offset = [0.01, 0];

override void on_start() {
clear_color = Colors.LIGHTGRAY;

cam = (cast(Viewport3D) viewports[0]).cam;

// load a shader effect and add it as a postprocessor
auto chrm_abr = new Effect(Core.content.load_shader(null,
"shader/chromatic_aberration.frag").front, color_alpha_white(0.8));
Expand Down

0 comments on commit 31e2a2c

Please sign in to comment.