Java Code Examples for com.watabou.utils.SystemTime#now()

The following examples show how to use com.watabou.utils.SystemTime#now() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Game.java    From YetAnotherPixelDungeon with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDrawFrame( GL10 gl ) {
	
	if (width == 0 || height == 0) {
		return;
	}
	
	SystemTime.tick();
	long rightNow = SystemTime.now;
	step = (now == 0 ? 0 : rightNow - now);
	now = rightNow;
	
	step();

	NoosaScript.get().resetCamera();
	GLES20.glScissor( 0, 0, width, height );
	GLES20.glClear( GLES20.GL_COLOR_BUFFER_BIT );
	draw();
}
 
Example 2
Source File: Game.java    From PD-classes with GNU General Public License v3.0 6 votes vote down vote up
@Override
public void onDrawFrame( GL10 gl ) {
	
	if (width == 0 || height == 0) {
		return;
	}
	
	SystemTime.tick();
	long rightNow = SystemTime.now;
	step = (now == 0 ? 0 : rightNow - now);
	now = rightNow;
	
	step();

	NoosaScript.get().resetCamera();
	GLES20.glScissor( 0, 0, width, height );
	GLES20.glClear( GLES20.GL_COLOR_BUFFER_BIT );
	draw();
}
 
Example 3
Source File: Hero.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
protected boolean timeout() {
	if (SystemTime.now() - SystemTime.getLastActionTime() > Dungeon.moveTimeout()) {
		SystemTime.updateLastActionTime();
		spend(TIME_TO_REST);
		return true;
	}
	return false;
}
 
Example 4
Source File: PlayGamesButton.java    From remixed-dungeon with GNU General Public License v3.0 5 votes vote down vote up
@Override
public void update() {
	super.update();
	if(SystemTime.now() - lastUpdatedTime > 1000) {
		lastUpdatedTime = SystemTime.now();
		updateStatus();
	}
}
 
Example 5
Source File: Dungeon.java    From remixed-dungeon with GNU General Public License v3.0 3 votes vote down vote up
public synchronized static void save() {

        if (SystemTime.now() - lastSaveTimestamp < 1000) {
            return;
        }

        lastSaveTimestamp = SystemTime.now();

        saveAllImpl();
    }