-
Notifications
You must be signed in to change notification settings - Fork 1
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
1 parent
542bc5b
commit 7a6ef36
Showing
11 changed files
with
95 additions
and
6 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
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
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 |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module engine.core; | ||
|
||
public import engine.core.media; | ||
public import engine.core.physics; | ||
//public import engine.core.physics; | ||
|
||
public import engine.core.Nullpo; | ||
public import engine.core.Vec2; |
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
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 @@ | ||
module engine.extra.WindowParam; | ||
|
||
import std; | ||
import engine; | ||
|
||
class WindowParam: GameObject { | ||
Vec2 size() => ctx.windowSize; | ||
} |
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
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,71 @@ | ||
module game.effects.Fade; | ||
|
||
import std; | ||
import game; | ||
import engine; | ||
|
||
class Fade: GameObject { | ||
Transform tform; | ||
SpriteRenderer sr; | ||
|
||
WindowParam win; | ||
Timer tmr; | ||
|
||
bool isDisplay = false, isChanging = false; | ||
uint fadetime; | ||
ubyte[3] color; | ||
private ubyte tp = 255, changeTo = 0; | ||
|
||
bool display(bool d){ | ||
changeTo = d ? 0 : 255; | ||
isChanging = true; | ||
return (changeTo == 255); | ||
} | ||
|
||
bool swap(){ | ||
changeTo = (changeTo == 255) ? 0 : 255; | ||
isChanging = true; | ||
return (changeTo == 255); | ||
} | ||
|
||
void show(){ | ||
changeTo = 0; | ||
isChanging = true; | ||
} | ||
|
||
void hide(){ | ||
changeTo = 255; | ||
isChanging = true; | ||
} | ||
|
||
this(ubyte[3] color = [0, 0, 0], uint fadetime = 1) { | ||
this.color = color; | ||
this.fadetime = fadetime; | ||
tmr = new Timer; | ||
} | ||
|
||
override void setup() { | ||
tform = register(new Transform); | ||
win = register(new WindowParam); | ||
ubyte[4] ubyuf = color ~ 255; | ||
dbg(ubyuf, ", ", ubyuf.length); | ||
sr = register(new SpriteRenderer(win.size, ubyuf)); | ||
|
||
//win = register(new WindowParam); | ||
//tmr = register(new Timer); | ||
} | ||
|
||
override void loop() { | ||
if(tmr.cur >= fadetime){ | ||
if(!isChanging) goto afterfade; // 表示と変化先が等しい(変化済み) | ||
(changeTo == 0) ? tp-=4 : tp+=4; | ||
if(changeTo == tp){ | ||
isChanging = false; | ||
} | ||
tmr.reset; | ||
} | ||
sr.colorArr = color ~ tp; | ||
dbg(sr.colorArr); | ||
afterfade: | ||
} | ||
} |
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,3 @@ | ||
module game.effects; | ||
|
||
public import game.effects.Fade; |
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
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
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