|
CodeSnipplets
Code snipplets.
IntroductionThis page shows how to perform a variety of tasks with the engine. For method call details, use your IDE :) ContentInitializing the engineDone typically in the constructor of a class that implements EngineInterface. engine = Engine.getInstance(); engine.init(WIDTH, HEIGHT, DEPTH, FULLSCREEN, this); engine.start(); Detecting a key press (inside the checkKeys method)if (engine.isKeyPressed(Keyboard.KEY_ADD)) {
// Your action here
}Drawing textfont = new GLFont("resources/fonts/tahoma.png", 1.0f);
font.print("FPS: " + engine.getFPS(), 10, 10, 1.0f, GLColor.GREEN);Loading an imagecrate = new GLImage("resources/images/crate.jpg");Showing flying textflyingText = new GLFlyingText("Critical!", font, 1000, true, 100, 0.8f, 1.5f);Loading an animated imagecharacter = new GLAnimatedImage("resources/images/character.png", 64, 64, 64, 64, 4);
character.setUpdateInterval(200);
character.setAnimationLoop(true);Creating an explosionparticleExplosion = new GLParticleSystemExplode();
particleExplosion.initParticles("resources/images/particle.png", 100);
particleExplosion.setRadius(0, 50);
particleExplosion.setSpeed(0.1f, 3);
particleExplosion.setTimeToLive(4000, 5000);Drawing image with rotation around its center axiscrate.drawRotated(400, 100, 45.0f); More examplesFor these and more examples, see the engine test class: http://code.google.com/p/oje2d/source/browse/trunk/src/main/java/org/voidness/oje2d/tests/EngineTest.java |
► Sign in to add a comment