implementing dt
This commit is contained in:
parent
df0183d2f5
commit
48cfca9f63
@ -309,7 +309,9 @@ public class DotHackC extends Canvas {
|
||||
g.drawImage(this.bG, 0, 0, 20);
|
||||
if (this.counter100 % 3 < 2)
|
||||
g.drawImage(Image.createImage("/pEZ.png"), 33, 107, 20);
|
||||
} else if (this.state_main == 11) {
|
||||
}
|
||||
|
||||
else if (this.state_main == 11) {
|
||||
if (this.bool_preload) {
|
||||
this.imgS_1 = Image.createImage("/pEZ.png");
|
||||
bgPaint(this.state_main);
|
||||
|
@ -26,4 +26,16 @@ public final class Utils {
|
||||
{
|
||||
return Global.app.game.getHeight();
|
||||
}
|
||||
|
||||
public static int clamp(int value, int min, int max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
|
||||
public static float clamp(float value, float min, float max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
|
||||
public static double clamp(double value, double min, double max) {
|
||||
return Math.max(min, Math.min(value, max));
|
||||
}
|
||||
}
|
||||
|
@ -10,53 +10,50 @@ import sillysagiri.Scene;
|
||||
import sillysagiri.Utils;
|
||||
|
||||
public class Intro extends Scene {
|
||||
private int counter = 0;
|
||||
private long counter = 0;
|
||||
private int state = 0;
|
||||
|
||||
private Image img_logo;
|
||||
private Image img_logo = null;
|
||||
private Image img_ez = null;
|
||||
private Image img_theworld = null;
|
||||
private Image img_vol1 = null;
|
||||
private Image img_project = null;
|
||||
|
||||
public Intro() throws IOException
|
||||
{
|
||||
img_logo = Image.createImage("/t_1.png");
|
||||
img_ez = Image.createImage("/pEZ.png");
|
||||
}
|
||||
|
||||
public void Destroy()
|
||||
{
|
||||
img_logo = null;
|
||||
img_ez = null;
|
||||
img_theworld = null;
|
||||
img_vol1 = null;
|
||||
img_project = null;
|
||||
}
|
||||
|
||||
public void Update()
|
||||
public void Update(long dt, Graphics g)
|
||||
{
|
||||
// TODO: use time based counter instead
|
||||
counter++;
|
||||
if (counter > 100) counter = 0;
|
||||
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
if (counter > 25)
|
||||
{
|
||||
// img_logo = Image.createImage("/pEZ.png");
|
||||
counter = 0;
|
||||
state = 1;
|
||||
}
|
||||
}
|
||||
break;
|
||||
counter += dt;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
public void Draw(Graphics g)
|
||||
{
|
||||
Utils.Clear_Screen(g, 73, 0, 0);
|
||||
switch (state) {
|
||||
case 0:
|
||||
{
|
||||
if (counter > 1800)
|
||||
{
|
||||
counter = 0;
|
||||
state = 1;
|
||||
break;
|
||||
}
|
||||
|
||||
Utils.Clear_Screen(g, 73, 0, 0);
|
||||
|
||||
int halfW = img_logo.getWidth()/2;
|
||||
int halfH = img_logo.getHeight()/2;
|
||||
float r = Easing.CubicEaseOut((float)counter/25);
|
||||
int pos = (int)(((Utils.GetScreenWidth()/2)+halfW) * r) - halfW;
|
||||
float r = Easing.CubicEaseInOut((float)counter/1800);
|
||||
int pos = (int)Math.ceil(((Utils.GetScreenWidth()/2)+halfW) * r) - halfW;
|
||||
|
||||
g.drawRegion(
|
||||
img_logo,
|
||||
@ -69,24 +66,53 @@ public class Intro extends Scene {
|
||||
0, halfH, img_logo.getWidth(), img_logo.getHeight()-halfH, Sprite.TRANS_NONE,
|
||||
Utils.GetScreenWidth() - pos, Utils.GetScreenHeight()/2,
|
||||
Graphics.TOP | Graphics.HCENTER);
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case 1:
|
||||
{
|
||||
g.drawImage(
|
||||
img_logo,
|
||||
Utils.GetScreenWidth()/2,
|
||||
Utils.GetScreenHeight()/2,
|
||||
Graphics.VCENTER | Graphics.HCENTER
|
||||
);
|
||||
if (counter > 500)
|
||||
{
|
||||
counter = 0;
|
||||
state = 2;
|
||||
|
||||
break;
|
||||
try {
|
||||
img_logo = Image.createImage("/t_0.png");
|
||||
img_theworld = Image.createImage("/t_2.png");
|
||||
img_project = Image.createImage("/t_3.png");
|
||||
img_vol1 = Image.createImage("/t_4.png");
|
||||
}
|
||||
catch(IOException e) {}
|
||||
}
|
||||
}
|
||||
|
||||
default: return;
|
||||
break;
|
||||
|
||||
case 2:
|
||||
{
|
||||
Utils.Clear_Screen(g, 146, 36, 0);
|
||||
g.drawImage(
|
||||
img_logo,
|
||||
Utils.GetScreenWidth()/2, Utils.GetScreenHeight()/2-35,
|
||||
Graphics.HCENTER | Graphics.VCENTER);
|
||||
|
||||
g.drawImage(
|
||||
img_theworld,
|
||||
Utils.GetScreenWidth()/2, Utils.GetScreenHeight()/2,
|
||||
Graphics.HCENTER | Graphics.TOP);
|
||||
|
||||
g.drawImage(img_project, 5, Utils.GetScreenHeight()-5, Graphics.LEFT | Graphics.BOTTOM);
|
||||
g.drawImage(img_vol1, 5, 5, Graphics.LEFT | Graphics.TOP);
|
||||
|
||||
if (counter >= 1000) counter = 0;
|
||||
if (counter < 600)
|
||||
g.drawImage(
|
||||
img_ez,
|
||||
Utils.GetScreenWidth()/2, (int)(Utils.GetScreenHeight()*0.75),
|
||||
Graphics.VCENTER | Graphics.HCENTER);
|
||||
}
|
||||
break;
|
||||
|
||||
default: break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user