Rokon - 2D OpenGL Game Framework


Last Updated:

  1. Frink

    Frink New Member This Topic's Starter

    Joined:
    Sep 1, 2009
    Messages:
    4
    Likes Received:
    0
    I've been working on a 2D OpenGL framework for a little while now, with full intentions from the start of being open source. Today I am releasing the first (0.1 alpha) version.

    There are bugs, and it isn't as fast as it could be. But it's only the start.

    Included are 9 examples, each of which explains how to use different features in the framework.

    Currently, the framework supports

    • Texture and Sprite management
    • Text, using TTF fonts
    • Organised layers
    • Two audio management classes, one optimized for music, the other for sound effects
    • Sprite dynamics (acceleration, terminal velocity, collisions)
    • Animation
    • Handlers to manage events fired through movement, animation, screen touches, accelerometer input, device shaking and collisions
    • Several minor features aimed at speeding development, such as screen settings and vibration


    The framework is intended to make game development as quick and easy as possible, while still keeping the high frame rates that OpenGL can provide.

    I have a google code project for this at rokon - Project Hosting on Google Code and a development blog at Rokon Game Engine

    There are many things I have listed which I fully intend to implement, such as more complex physics, tile engines and post processing.

    Please let me know of bugs, offer suggestions or improvements. I do not purport to be an OpenGL expert. Infact, until last week, I had never touched any sort of OpenGL in my life.

    To show how easy it is to implement, I've pasted one of the examples below. It shows a button and 3 sprites. When the button is pressed, the sprites move at different speeds, one rotation.

    Code (Text):
    1. public class Example4 extends Activity {
    2.  
    3.     Sprite crabSprite1;
    4.     Sprite crabSprite2;
    5.     Sprite crabSprite3;
    6.     Texture crabTexture;
    7.    
    8.     Sprite buttonSprite;
    9.     Texture buttonTexture;
    10.  
    11.     Rokon rokon;
    12.     Hotspot hotspot;
    13.    
    14.     public void onCreate(Bundle savedInstanceState) {
    15.         super.onCreate(savedInstanceState);
    16.         rokon = Rokon.createEngine(this);
    17.         rokon.setFullscreen();
    18.         rokon.fixLandscape();
    19.         rokon.init();
    20.  
    21.         crabTexture = rokon.createTextureFromResource(R.drawable.crab);
    22.         buttonTexture = rokon.createTextureFromResource(R.drawable.button);
    23.         rokon.prepareTextureAtlas();
    24.  
    25.         buttonSprite = new Sprite(5, 5, 100, 50, buttonTexture);
    26.         crabSprite1 = new Sprite(10, 50, 80, 80, crabTexture);
    27.         crabSprite2 = new Sprite(10, 150, 80, 80, crabTexture);
    28.         crabSprite3 = new Sprite(10, 250, 80, 80, crabTexture);
    29.        
    30.         rokon.addSprite(buttonSprite);
    31.         rokon.addSprite(crabSprite1);
    32.         rokon.addSprite(crabSprite2);
    33.         rokon.addSprite(crabSprite3);
    34.  
    35.         rokon.setInputHandler(new myInputHandler());
    36.         hotspot = new Hotspot(buttonSprite);
    37.         rokon.addHotspot(hotspot);
    38.     }
    39.    
    40.     public class myInputHandler extends InputHandler {
    41.         public void onHotspotTouched(Hotspot hotspot) {
    42.             crabSprite1.setXY(10, 50);
    43.             crabSprite2.setXY(10, 150);
    44.             crabSprite3.setXY(10, 250);
    45.  
    46.             crabSprite1.resetDynamics();
    47.             crabSprite2.resetDynamics();
    48.             crabSprite3.resetDynamics();
    49.  
    50.             crabSprite1.accelerate(25, 0);
    51.             crabSprite2.accelerate(50, 0, 100, 0);
    52.             crabSprite3.setVelocity(50, 0);
    53.            
    54.             crabSprite3.resetModifiers();
    55.             crabSprite3.setRotation(0);
    56.             crabSprite3.addModifier(new Spin(1));
    57.         }
    58.     }
    59. }
    You can find the first release, 0.1 alpha at Downloads - rokon - Project Hosting on Google Code
     

    Advertisement
  2. Zidane

    Zidane New Member

    Joined:
    Oct 22, 2009
    Messages:
    4
    Likes Received:
    0
    Hi!, as i posted on your blog, i may become even a FAN of your work hahaha if its good for me, and if else, i will congratulate you for doing something that is incredible help for the community

    Thank you!!!

    i will comment you about my work with your engine if it moves forward :)

    regards

    PD: im sure youd love to see some community made games with a splash screen saying "Powered by Rokon" ;D
     

Share This Page

Loading...