initial options scene
This commit is contained in:
parent
bbabf5acf1
commit
93eb97c83e
@ -9,6 +9,7 @@ import sillysagiri.scene.Instruction;
|
|||||||
import sillysagiri.scene.Intro;
|
import sillysagiri.scene.Intro;
|
||||||
import sillysagiri.scene.Leaderboard;
|
import sillysagiri.scene.Leaderboard;
|
||||||
import sillysagiri.scene.MainMenu;
|
import sillysagiri.scene.MainMenu;
|
||||||
|
import sillysagiri.scene.Options;
|
||||||
|
|
||||||
public class DotHack extends MIDlet implements Runnable {
|
public class DotHack extends MIDlet implements Runnable {
|
||||||
public DotHackC game;
|
public DotHackC game;
|
||||||
@ -28,7 +29,7 @@ public class DotHack extends MIDlet implements Runnable {
|
|||||||
thread.setPriority(Thread.MAX_PRIORITY);
|
thread.setPriority(Thread.MAX_PRIORITY);
|
||||||
thread.start();
|
thread.start();
|
||||||
|
|
||||||
sagiri.Set_Scene(new Leaderboard());
|
sagiri.Set_Scene(new Options());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void pauseApp() {}
|
public void pauseApp() {}
|
||||||
|
@ -194,6 +194,7 @@ public class MainMenu extends Scene {
|
|||||||
|
|
||||||
case STATE_MENU_OPTIONS:
|
case STATE_MENU_OPTIONS:
|
||||||
{
|
{
|
||||||
|
sagiri.Set_Scene(new Options());
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
117
src/sillysagiri/scene/Options.java
Normal file
117
src/sillysagiri/scene/Options.java
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
package sillysagiri.scene;
|
||||||
|
|
||||||
|
import javax.microedition.lcdui.Graphics;
|
||||||
|
import javax.microedition.lcdui.Image;
|
||||||
|
import javax.microedition.lcdui.game.Sprite;
|
||||||
|
|
||||||
|
import sillysagiri.BMF;
|
||||||
|
import sillysagiri.Sagiri;
|
||||||
|
import sillysagiri.Scene;
|
||||||
|
import sillysagiri.Utils;
|
||||||
|
|
||||||
|
public class Options extends Scene {
|
||||||
|
|
||||||
|
private BMF bmf_white;
|
||||||
|
private BMF bmf_blue;
|
||||||
|
private BMF bmf_lime;
|
||||||
|
|
||||||
|
private Image img_loop;
|
||||||
|
private Image img_out;
|
||||||
|
private Image img_head;
|
||||||
|
private Image img_arrow;
|
||||||
|
|
||||||
|
private int counter = 0;
|
||||||
|
private int volume = 4;
|
||||||
|
private boolean vibrate = true;
|
||||||
|
|
||||||
|
public void Preload() {
|
||||||
|
try {
|
||||||
|
bmf_white = BMF.Create("/silly/bmf/nds12_0.silly.gz", "/silly/bmf/nds12.fnt", 0xffffffff);
|
||||||
|
bmf_blue = BMF.Create("/silly/bmf/onds12_0.silly.gz", "/silly/bmf/onds12.fnt", 0xff00dbff);
|
||||||
|
bmf_lime = BMF.Create("/silly/bmf/nds12_0.silly.gz", "/silly/bmf/nds12.fnt", 0xffB6FF00);
|
||||||
|
|
||||||
|
img_loop = Image.createImage("/m_2.png");
|
||||||
|
img_out = Image.createImage("/out.png");
|
||||||
|
img_head = Image.createImage("/s_1.png");
|
||||||
|
img_arrow = Image.createImage("/i_0.png");
|
||||||
|
}
|
||||||
|
catch(Exception e)
|
||||||
|
{
|
||||||
|
sagiri.Set_Scene(new DeathError(e));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Destroy() {
|
||||||
|
}
|
||||||
|
|
||||||
|
public void Update(long dt, Graphics g) {
|
||||||
|
Utils.Clear_Screen(g, 255, 108, 0);
|
||||||
|
|
||||||
|
int loopCount = (int)Math.ceil((float)Utils.GetScreenHeight()/img_loop.getHeight());
|
||||||
|
for (int i = 0; i<loopCount; i++)
|
||||||
|
g.drawImage(img_loop, 0, i*img_loop.getHeight(), Graphics.LEFT | Graphics.TOP);
|
||||||
|
|
||||||
|
int size_header = (int)(bmf_blue.lineHeight*1.5);
|
||||||
|
g.setColor(109, 0, 0);
|
||||||
|
g.fillRect(5, 5, Utils.GetScreenWidth()-10, size_header);
|
||||||
|
|
||||||
|
bmf_blue.DrawEx(g, "Options", 10, (size_header/2)+5, Graphics.LEFT | Graphics.VCENTER);
|
||||||
|
g.drawImage(img_out, Utils.GetScreenWidth()-10, (size_header/2)+5, Graphics.RIGHT|Graphics.VCENTER);
|
||||||
|
|
||||||
|
int cursory = size_header+20;
|
||||||
|
g.setColor(0x6d0000);
|
||||||
|
g.fillRect(5, cursory, Utils.GetScreenWidth()-10, bmf_white.lineHeight+10);
|
||||||
|
bmf_white.DrawEx(g, "Volume", 20, cursory+(bmf_white.lineHeight+10)/2, Graphics.VCENTER|Graphics.LEFT);
|
||||||
|
int size_blockw = 4;
|
||||||
|
int size_blockh = (int)((bmf_white.lineHeight+10) * 0.6);
|
||||||
|
int size_blockp = 3;
|
||||||
|
int size_blocktotal = (size_blockw*4) + (size_blockp*3);
|
||||||
|
for (int i=0; i<4; i++)
|
||||||
|
{
|
||||||
|
int h = (int)(size_blockh * (((float)i+1)/4));
|
||||||
|
int y = cursory + (bmf_white.lineHeight+10-size_blockh)/2 + (size_blockh-h);
|
||||||
|
g.setColor(0xffffffff);
|
||||||
|
g.fillRect(
|
||||||
|
Utils.GetScreenWidth()-size_blocktotal-20 + (i*(size_blockw+size_blockp)),
|
||||||
|
y,
|
||||||
|
size_blockw, h
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
cursory += bmf_white.lineHeight+10;
|
||||||
|
g.setColor(0x6d0000);
|
||||||
|
g.fillRect(5, cursory+=15, Utils.GetScreenWidth()-10, bmf_white.lineHeight+10);
|
||||||
|
bmf_white.DrawEx(g, "Vibration", 20, cursory+(bmf_white.lineHeight+10)/2, Graphics.VCENTER|Graphics.LEFT);
|
||||||
|
if (vibrate)
|
||||||
|
bmf_lime.DrawEx(g, "ON", Utils.GetScreenWidth()-20, cursory+(bmf_white.lineHeight+10)/2, Graphics.VCENTER|Graphics.RIGHT);
|
||||||
|
else
|
||||||
|
bmf_lime.DrawEx(g, "OFF", Utils.GetScreenWidth()-20, cursory+(bmf_white.lineHeight+10)/2, Graphics.VCENTER|Graphics.RIGHT);
|
||||||
|
|
||||||
|
counter+=dt;
|
||||||
|
int padding = (int)(Math.sin((float)counter/150) * 3) + 3;
|
||||||
|
|
||||||
|
g.drawRegion(
|
||||||
|
img_arrow,
|
||||||
|
0, 0,
|
||||||
|
img_arrow.getWidth()/2, img_arrow.getHeight(),
|
||||||
|
Sprite.TRANS_NONE,
|
||||||
|
10 - padding,
|
||||||
|
(cursory+(bmf_white.lineHeight+10)/2),
|
||||||
|
Graphics.LEFT | Graphics.VCENTER);
|
||||||
|
|
||||||
|
g.drawRegion(
|
||||||
|
img_arrow,
|
||||||
|
img_arrow.getWidth()/2, 0,
|
||||||
|
img_arrow.getWidth()/2, img_arrow.getHeight(),
|
||||||
|
Sprite.TRANS_NONE,
|
||||||
|
Utils.GetScreenWidth() - 10 + padding,
|
||||||
|
(cursory+(bmf_white.lineHeight+10)/2),
|
||||||
|
Graphics.RIGHT | Graphics.VCENTER);
|
||||||
|
|
||||||
|
if (sagiri.input.IsKeyDown(Sagiri.KEY_CENTER) || sagiri.input.IsKeyDown(Sagiri.KEY_RIGHT_SOFT))
|
||||||
|
{
|
||||||
|
sagiri.Set_Scene(new MainMenu());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
Loading…
x
Reference in New Issue
Block a user