-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
89 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
.dub | ||
docs.json | ||
__dummy.html | ||
docs/ | ||
/multiscene | ||
multiscene.so | ||
multiscene.dylib | ||
multiscene.dll | ||
multiscene.a | ||
multiscene.lib | ||
multiscene-test-* | ||
*.exe | ||
*.o | ||
*.obj | ||
*.lst |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
name "multiscene" | ||
description "multiple scenes" | ||
authors "redthing1" | ||
copyright "Copyright © 2020, redthing1" | ||
license "proprietary" | ||
dependency "reng" path="../.." | ||
|
||
subConfiguration "reng" "lib-minimal" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import std.stdio; | ||
|
||
import re; | ||
import re.math; | ||
import std.stdio; | ||
import play; | ||
|
||
class Game : Core { | ||
enum WIDTH = 800; | ||
enum HEIGHT = 400; | ||
|
||
this() { | ||
super(WIDTH, HEIGHT, "multiscene"); | ||
} | ||
|
||
override void initialize() { | ||
default_resolution = Vector2(WIDTH / 4, HEIGHT / 4); | ||
content.paths ~= "../content/"; | ||
|
||
load_scenes([new PlayScene()]); | ||
} | ||
} | ||
|
||
void main() { | ||
auto game = new Game(); // init game | ||
game.run(); | ||
game.destroy(); // clean up | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
module play; | ||
|
||
import re; | ||
import re.gfx; | ||
import re.gfx.shapes.rect; | ||
import re.ng.camera; | ||
import re.math; | ||
import re.phys.kin2d; | ||
|
||
static import raylib; | ||
|
||
class PlayScene : Scene2D { | ||
override void on_start() { | ||
resolution = Vector2(100, 100); | ||
output_rect = Rectangle( | ||
0, 0, | ||
Core.window.screen_width / 2, | ||
Core.window.screen_height | ||
); | ||
|
||
auto bg_tween = Tweener.tween(clear_color, Colors.DARKGRAY, | ||
Colors.LIGHTGRAY, 2, &Ease.QuadIn); | ||
bg_tween.start(); | ||
|
||
auto box1 = create_entity("box1", Vector2(20, 20)); | ||
box1.add_component(new ColorRect(Vector2(8, 8), Colors.BLUE)); | ||
auto box1_body = box1.add_component!KinBody2D(); | ||
box1_body.angular_accel = 0.1; | ||
|
||
auto box2 = create_entity("box2", Vector2(40, 20)); | ||
box2.add_component(new ColorRect(Vector2(8, 8), Colors.RED)); | ||
auto box2_body = box2.add_component!KinBody2D(); | ||
box2_body.angular_accel = -0.07; | ||
|
||
// follow the first box | ||
cam.entity.add_component(new CameraFollow2D(box1, 0.05)); | ||
} | ||
} |