package debugGames;
import gameCanvasUtil . vector . * ;
import gameCanvasUtil . * ;
import debugger . * ;
public class game extends gameBase {
String classFiles [ ] ;
int cur_select ;
public void initGame ( ) {
classFiles = saveDataUtil . lsCommand ( "samples" , "class" ) ;
debugWindow.getInstance().setObject("game",this);
debugWindow.getInstance().addVar("classFiles",debugVar.TYPE_STRING,classFiles,1);
debugWindow.getInstance().addVar("cur_select",debugVar.TYPE_INT,new Integer(cur_select),0);
debugWindow.getInstance().addVar("bgm",debugVar.TYPE_INT,new Integer(bgm),0);
debugWindow.getInstance().setRunningFlag(true);
}
int bgm = 2 ;
public void updateGame ( ) {
debugWindow.getInstance().setCurrent(this);
if(!debugWindow.getInstance().getRunningFlag()){
debugWindow.getInstance().iterateVarStart();
classFiles = (String[])debugWindow.getInstance().getVarAsObject();
cur_select = (int)debugWindow.getInstance().getVarAsInt();
bgm = (int)debugWindow.getInstance().getVarAsInt();
return;
}
debugWindow.getInstance().iterateVarStart();debugWindow.getInstance().updateVar(classFiles);
debugWindow.getInstance().updateVar(new Integer(cur_select));
debugWindow.getInstance().updateVar(new Integer(bgm));
if ( gc . isKeyPushed ( gc . KEY_DOWN ) || isPushing ( gc . KEY_DOWN ) ) {
cur_select ++ ;
}
else if ( gc . isKeyPushed ( gc . KEY_UP ) || isPushing ( gc . KEY_UP ) ) {
cur_select -- ;
}
if ( cur_select < 0 ) {
cur_select = 0 ;
}
else if ( cur_select >= classFiles . length ) {
cur_select = classFiles . length - 1 ;
}
if ( gc . isKeyPushed ( gc . KEY_ENTER ) ) {
gc . loadGameState ( classFiles [ cur_select ] , true ) ;
}
}
private boolean isPushing ( int code ) {
return ( gc . getKeyPressLength ( code ) > 20 && gc . getKeyPressLength ( code ) % 3 == 0 ) ;
}
public void drawGame ( ) {
gc . clearScreen ( ) ;
gc . setFont ( "" , 0 , 20 ) ;
for ( int i = 0 ;
i < classFiles . length ;
i ++ ) {
gc . setColor ( 0x000000 ) ;
if ( i == cur_select ) {
gc . setColor ( 0xff0000 ) ;
}
gc . drawString ( classFiles [ i ] , 20 , 20 + 20 * i ) ;
}
gc . setColor ( 0x000000 ) ;
gc . drawString ( "" + timerWaitManager . getInstance ( ) . getFps ( ) , 600 , 20 ) ;
}
public void finalGame ( ) {
debugWindow.getInstance().removeObject(this);}
}
