Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
A simple Android library project containing convenience classes and functionality for building low complexity 2D games using the native Android classes.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
|Failed to load latest commit information.|
The MicaBytes Game Library (micabytes/lib_game) is an Android library that encapsulates some of the logic required for creating a simple 2D game using the native Android graphics library. This might be useful to you if: * You want a simple 2D graphics library for Android, and you don't need any flashy effects. It doesn't get much simpler than Canvas.drawBitmap(...) and the Canvas is plenty fast enough for graphics that are not heavy on animation. * You want to combine 2D graphics with native Android UI elements. For whatever reason, almost all game frameworks refuse to use the native Android UI, which makes building complex UIs a chore. * You want to do 2D graphics using SurfaceView in Android, but haven't found any good examples to work with. You won't find this useful if you are looking to build 3D graphics or need lots of animation. For those kind of demands, I recommend taking a look at an OpenGL framework; e.g., libGDX. It is released under the Apache 2.0 license. If you do bug fixes, improvements or extensions, please consider contributing them back to the library to be incorporated in future iterations. Usage: The current project setup is built for Android Studio, and utilizes a number of base libraries that I find useful. * Jackson: for effective JSON decoding * Google Play Services: For all the extra Google Play functionality such as cloud-saves, etc. * Fabric: Currently the best crash-reporting tool for Android. Main Components: * ImageHandler: This is a standard singleton class image cache using SoftReferences. Useful to manage bitmaps. * MusicHandler: A very simple static class to manage playback of music. Needs more work. * StringHandler: A simple class that allows for some string manipulation. * MicaSurfaceView: A SurfaceView implementation based on the "standard" render thread format, with pan, fling, and pinch-zoom support implemented. * BitmapSurfaceRenderer: Rendering implementation for GameSurfaceView. Allows for the handling of very large bitmaps (larger than available memory) as backgrounds. * TileMapSurfaceRenderer: Rendering implementation for GameSurfaceView that handles a simple TileMap of squares. Example code: The old example project can also be found on github, but it is no longer up to date: https://github.com/micabyte/android_game_example Limitations: The library requires Android 2.3.3 or better. The reason for this is entirely due to the use of BitmapRegionDecoder. Remove that, and the library should be compatible down to Android 1.6. Also, note that while the library builds upon code from my previous projects and I use it in my current development, this particular version of the library has not yet stood the "test of fire" from tens of thousands of devices. There may still be many subtle (and not so subtle) bugs in the code. Integrating lib_base in another Android Project 1. From your projects root directory (assuming it is version controlled in Git), run: > git submodule add email@example.com:micabytes/lib_game.git 2. In settings.gradle, add: include ':lib_base' Then sync the project, and make sure to add a dependency on lib_base in the core project file.