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);
|
g.drawImage(this.bG, 0, 0, 20);
|
||||||
if (this.counter100 % 3 < 2)
|
if (this.counter100 % 3 < 2)
|
||||||
g.drawImage(Image.createImage("/pEZ.png"), 33, 107, 20);
|
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) {
|
if (this.bool_preload) {
|
||||||
this.imgS_1 = Image.createImage("/pEZ.png");
|
this.imgS_1 = Image.createImage("/pEZ.png");
|
||||||
bgPaint(this.state_main);
|
bgPaint(this.state_main);
|
||||||
|
@ -26,4 +26,16 @@ public final class Utils {
|
|||||||
{
|
{
|
||||||
return Global.app.game.getHeight();
|
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;
|
import sillysagiri.Utils;
|
||||||
|
|
||||||
public class Intro extends Scene {
|
public class Intro extends Scene {
|
||||||
private int counter = 0;
|
private long counter = 0;
|
||||||
private int state = 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
|
public Intro() throws IOException
|
||||||
{
|
{
|
||||||
img_logo = Image.createImage("/t_1.png");
|
img_logo = Image.createImage("/t_1.png");
|
||||||
|
img_ez = Image.createImage("/pEZ.png");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Destroy()
|
public void Destroy()
|
||||||
{
|
{
|
||||||
img_logo = null;
|
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 += dt;
|
||||||
counter++;
|
|
||||||
if (counter > 100) counter = 0;
|
|
||||||
|
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case 0:
|
case 0:
|
||||||
{
|
{
|
||||||
if (counter > 25)
|
if (counter > 1800)
|
||||||
{
|
{
|
||||||
// img_logo = Image.createImage("/pEZ.png");
|
|
||||||
counter = 0;
|
counter = 0;
|
||||||
state = 1;
|
state = 1;
|
||||||
}
|
|
||||||
}
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default: break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Draw(Graphics g)
|
|
||||||
{
|
|
||||||
Utils.Clear_Screen(g, 73, 0, 0);
|
Utils.Clear_Screen(g, 73, 0, 0);
|
||||||
switch (state) {
|
|
||||||
case 0:
|
|
||||||
{
|
|
||||||
int halfW = img_logo.getWidth()/2;
|
int halfW = img_logo.getWidth()/2;
|
||||||
int halfH = img_logo.getHeight()/2;
|
int halfH = img_logo.getHeight()/2;
|
||||||
float r = Easing.CubicEaseOut((float)counter/25);
|
float r = Easing.CubicEaseInOut((float)counter/1800);
|
||||||
int pos = (int)(((Utils.GetScreenWidth()/2)+halfW) * r) - halfW;
|
int pos = (int)Math.ceil(((Utils.GetScreenWidth()/2)+halfW) * r) - halfW;
|
||||||
|
|
||||||
g.drawRegion(
|
g.drawRegion(
|
||||||
img_logo,
|
img_logo,
|
||||||
@ -69,24 +66,53 @@ public class Intro extends Scene {
|
|||||||
0, halfH, img_logo.getWidth(), img_logo.getHeight()-halfH, Sprite.TRANS_NONE,
|
0, halfH, img_logo.getWidth(), img_logo.getHeight()-halfH, Sprite.TRANS_NONE,
|
||||||
Utils.GetScreenWidth() - pos, Utils.GetScreenHeight()/2,
|
Utils.GetScreenWidth() - pos, Utils.GetScreenHeight()/2,
|
||||||
Graphics.TOP | Graphics.HCENTER);
|
Graphics.TOP | Graphics.HCENTER);
|
||||||
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
{
|
{
|
||||||
|
if (counter > 500)
|
||||||
|
{
|
||||||
|
counter = 0;
|
||||||
|
state = 2;
|
||||||
|
|
||||||
|
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) {}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
case 2:
|
||||||
|
{
|
||||||
|
Utils.Clear_Screen(g, 146, 36, 0);
|
||||||
g.drawImage(
|
g.drawImage(
|
||||||
img_logo,
|
img_logo,
|
||||||
Utils.GetScreenWidth()/2,
|
Utils.GetScreenWidth()/2, Utils.GetScreenHeight()/2-35,
|
||||||
Utils.GetScreenHeight()/2,
|
Graphics.HCENTER | Graphics.VCENTER);
|
||||||
Graphics.VCENTER | Graphics.HCENTER
|
|
||||||
);
|
|
||||||
|
|
||||||
|
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;
|
break;
|
||||||
}
|
|
||||||
|
|
||||||
default: return;
|
default: break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user