Skip to content

AlwaysBeCrafting/Flare

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

44 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Flare

A tiny engine framework for simple games

Watch it being used on Twitch

Download

Gradle

compile 'stream.alwaysbecrafting:flare:1.0.0-alpha1'

Usage

Extend GameSystem or EntitySystem:

public class SpriteRenderSystem extends EntitySystem {
	public SpriteRenderSystem() {
		requireAll(
			LocationComponent.class,
			SpriteComponent.class );
	}
	
	@Override
	protected void onHandleEntity( Entity entity, double deltaTime ) {
		LocationComponent location = entity.get( LocationComponent.class );
		SpriteComponent sprite = entity.get( SpriteComponent.class );
		
		// Do something with your components
	}
}

Add it to a GameEngine:

myEngine = new GameEngine();
myEngine.add( new SpriteRenderSystem() );

Update your GameEngine every frame:

double currentFrameTime = System.currentTimeMillis() / 1000.0;
myEngine.update( currentFrameTime - lastFrameTime );
lastFrameTime = currentFrameTime;

Packages

No packages published

Languages