├── res
├── raw
│ ├── test.png
│ ├── house_etc1.pkm
│ ├── test_rgb_565.pvr
│ ├── quads_rgb_565.pvr
│ ├── quads_rgba_8888.pvr
│ ├── test_bgra_8888.pvr
│ ├── test_rgba_5551.pvr
│ ├── test_rgba_8888.pvr
│ ├── house_pvr_rgb_565.pvr
│ ├── house_pvr_argb_4444.pvr
│ ├── house_pvr_argb_5551.pvr
│ ├── house_pvr_argb_8888.pvr
│ ├── test_rgba_8888_pma.pvr
│ ├── house_pvrccz_argb_8888.bin
│ ├── house_pvrgz_argb_8888.bin
│ └── house_pvr_argb_8888_mipmaps.pvr
├── drawable-hdpi
│ └── icon.png
├── drawable-ldpi
│ └── icon.png
├── drawable-mdpi
│ └── icon.png
├── layout
│ ├── listrow_example.xml
│ ├── listrow_examplegroup.xml
│ ├── list_examples.xml
│ ├── textbreakexample.xml
│ ├── xmllayoutexample.xml
│ └── list_bluetooth_devices.xml
└── values
│ └── versions.xml
├── assets
├── font
│ ├── LCD.ttf
│ ├── Droid.ttf
│ ├── Plok.ttf
│ ├── BitmapFont.png
│ ├── KingdomOfHearts.ttf
│ ├── UnrealTournament.ttf
│ ├── NeverwinterNights.ttf
│ └── BitmapFontWithKerning.png
├── gfx
│ ├── box.png
│ ├── frog.png
│ ├── next.png
│ ├── tank.png
│ ├── test.png
│ ├── badge.png
│ ├── enemy.png
│ ├── menu_ok.png
│ ├── notes.png
│ ├── paused.png
│ ├── player.png
│ ├── radar.png
│ ├── face_box.png
│ ├── menu_back.png
│ ├── menu_quit.png
│ ├── vehicles.png
│ ├── badge_large.png
│ ├── banana_tiled.png
│ ├── desert_tiled.png
│ ├── i_love_8_bit.png
│ ├── menu_reset.png
│ ├── radarpoint.png
│ ├── snake_head.png
│ ├── carddeck_tiled.png
│ ├── face_box_menu.png
│ ├── face_box_tiled.png
│ ├── particle_fire.png
│ ├── particle_point.png
│ ├── snake_tailpart.png
│ ├── toggle_button.png
│ ├── background_grass.png
│ ├── chromatic_circle.png
│ ├── click_to_unload.png
│ ├── face_circle_tiled.png
│ ├── helicopter_tiled.png
│ ├── imageformat_bmp.bmp
│ ├── imageformat_gif.gif
│ ├── imageformat_gif.png
│ ├── imageformat_jpg.jpg
│ ├── imageformat_png.png
│ ├── menu_background.png
│ ├── racetrack_curve.png
│ ├── snake_background.png
│ ├── snapdragon_tiled.png
│ ├── face_hexagon_tiled.png
│ ├── face_triangle_tiled.png
│ ├── racetrack_straight.png
│ ├── onscreen_control_base.png
│ ├── onscreen_control_knob.png
│ ├── texturecompositing
│ │ ├── zynga.png
│ │ ├── balloon.png
│ │ └── alphamask.png
│ ├── parallax_background_layer_mid.png
│ ├── parallax_background_layer_back.png
│ ├── parallax_background_layer_front.png
│ ├── spritesheets
│ │ ├── texturepackerexample.pvr.ccz
│ │ └── texturepackerexample.xml
│ └── chick.svg
├── mfx
│ ├── munch.ogg
│ ├── explosion.ogg
│ ├── game_over.ogg
│ ├── lepeltheme.mod
│ └── wagner_the_ride_of_the_valkyries.ogg
└── tmx
│ ├── desert.tsx
│ ├── desert_with_tsx_tileset.tmx
│ └── desert.tmx
├── doc
├── benchmarks.pdf
├── benchmarks.xlsx
├── culling_benchmark.png
├── culling_benchmark.xlsx
└── spritebatch_benchmark.xlsx
├── ext
├── market
│ └── icon.png
├── img
│ ├── snake_head.pdn
│ ├── snake_tailpart.pdn
│ ├── snake_texture.png
│ ├── particle_halo.svg
│ └── snake_tailpart.svg
└── gfx
│ └── spritesheets
│ └── texturepackerexample
│ ├── face_box.png
│ ├── face_circle_tiled.png
│ ├── face_hexagon_tiled.png
│ └── face_triangle_tiled.png
├── .classpath
├── .gitignore
├── src
└── org
│ └── andengine
│ └── examples
│ ├── spritesheets
│ └── TexturePackerExampleSpritesheet.java
│ ├── game
│ ├── snake
│ │ ├── entity
│ │ │ ├── ICellEntity.java
│ │ │ ├── Frog.java
│ │ │ ├── SnakeTailPart.java
│ │ │ ├── SnakeHead.java
│ │ │ ├── CellEntity.java
│ │ │ ├── AnimatedCellEntity.java
│ │ │ └── Snake.java
│ │ ├── util
│ │ │ └── constants
│ │ │ │ └── SnakeConstants.java
│ │ └── adt
│ │ │ ├── SnakeSuicideException.java
│ │ │ └── Direction.java
│ └── pong
│ │ ├── adt
│ │ ├── Score.java
│ │ ├── PaddleUserData.java
│ │ └── messages
│ │ │ ├── server
│ │ │ ├── SetPaddleIDServerMessage.java
│ │ │ ├── UpdateBallServerMessage.java
│ │ │ ├── UpdateScoreServerMessage.java
│ │ │ └── UpdatePaddleServerMessage.java
│ │ │ └── client
│ │ │ └── MovePaddleClientMessage.java
│ │ └── util
│ │ └── constants
│ │ └── PongConstants.java
│ ├── adt
│ ├── messages
│ │ ├── client
│ │ │ ├── ClientMessageFlags.java
│ │ │ ├── ConnectionCloseClientMessage.java
│ │ │ ├── ConnectionPingClientMessage.java
│ │ │ └── ConnectionEstablishClientMessage.java
│ │ ├── server
│ │ │ ├── ServerMessageFlags.java
│ │ │ ├── ConnectionCloseServerMessage.java
│ │ │ ├── ConnectionEstablishedServerMessage.java
│ │ │ ├── ConnectionPongServerMessage.java
│ │ │ └── ConnectionRejectedProtocolMissmatchServerMessage.java
│ │ └── MessageConstants.java
│ ├── ZoomState.java
│ ├── card
│ │ ├── Color.java
│ │ ├── Value.java
│ │ └── Card.java
│ └── cityradar
│ │ └── City.java
│ ├── BitmapFontExample.java
│ ├── AugmentedRealityExample.java
│ ├── LineExample.java
│ ├── AugmentedRealityHorizonExample.java
│ ├── TextExample.java
│ ├── ChangeableTextExample.java
│ ├── SpriteExample.java
│ ├── benchmark
│ └── TickerTextBenchmark.java
│ ├── SubMenuExample.java
│ ├── TickerTextExample.java
│ ├── TexturePackerExample.java
│ ├── TouchDragExample.java
│ ├── UnloadResourcesExample.java
│ ├── LoadTextureExample.java
│ ├── launcher
│ ├── ExpandableExampleLauncherListAdapter.java
│ └── ExampleGroup.java
│ ├── SpriteRemoveExample.java
│ ├── StrokeFontExample.java
│ ├── AsyncGameActivityExample.java
│ └── Rotation3DExample.java
├── .project
├── project.properties
├── proguard.cfg
└── scripts
└── build_spritesheets.sh
/res/raw/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test.png
--------------------------------------------------------------------------------
/assets/font/LCD.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/LCD.ttf
--------------------------------------------------------------------------------
/assets/gfx/box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/box.png
--------------------------------------------------------------------------------
/assets/gfx/frog.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/frog.png
--------------------------------------------------------------------------------
/assets/gfx/next.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/next.png
--------------------------------------------------------------------------------
/assets/gfx/tank.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/tank.png
--------------------------------------------------------------------------------
/assets/gfx/test.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/test.png
--------------------------------------------------------------------------------
/doc/benchmarks.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/doc/benchmarks.pdf
--------------------------------------------------------------------------------
/doc/benchmarks.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/doc/benchmarks.xlsx
--------------------------------------------------------------------------------
/ext/market/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/market/icon.png
--------------------------------------------------------------------------------
/assets/font/Droid.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/Droid.ttf
--------------------------------------------------------------------------------
/assets/font/Plok.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/Plok.ttf
--------------------------------------------------------------------------------
/assets/gfx/badge.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/badge.png
--------------------------------------------------------------------------------
/assets/gfx/enemy.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/enemy.png
--------------------------------------------------------------------------------
/assets/gfx/menu_ok.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/menu_ok.png
--------------------------------------------------------------------------------
/assets/gfx/notes.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/notes.png
--------------------------------------------------------------------------------
/assets/gfx/paused.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/paused.png
--------------------------------------------------------------------------------
/assets/gfx/player.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/player.png
--------------------------------------------------------------------------------
/assets/gfx/radar.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/radar.png
--------------------------------------------------------------------------------
/assets/mfx/munch.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/mfx/munch.ogg
--------------------------------------------------------------------------------
/ext/img/snake_head.pdn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/img/snake_head.pdn
--------------------------------------------------------------------------------
/res/raw/house_etc1.pkm:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_etc1.pkm
--------------------------------------------------------------------------------
/assets/gfx/face_box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_box.png
--------------------------------------------------------------------------------
/assets/gfx/menu_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/menu_back.png
--------------------------------------------------------------------------------
/assets/gfx/menu_quit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/menu_quit.png
--------------------------------------------------------------------------------
/assets/gfx/vehicles.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/vehicles.png
--------------------------------------------------------------------------------
/assets/mfx/explosion.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/mfx/explosion.ogg
--------------------------------------------------------------------------------
/assets/mfx/game_over.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/mfx/game_over.ogg
--------------------------------------------------------------------------------
/res/raw/test_rgb_565.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test_rgb_565.pvr
--------------------------------------------------------------------------------
/assets/font/BitmapFont.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/BitmapFont.png
--------------------------------------------------------------------------------
/assets/gfx/badge_large.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/badge_large.png
--------------------------------------------------------------------------------
/assets/gfx/banana_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/banana_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/desert_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/desert_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/i_love_8_bit.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/i_love_8_bit.png
--------------------------------------------------------------------------------
/assets/gfx/menu_reset.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/menu_reset.png
--------------------------------------------------------------------------------
/assets/gfx/radarpoint.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/radarpoint.png
--------------------------------------------------------------------------------
/assets/gfx/snake_head.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/snake_head.png
--------------------------------------------------------------------------------
/assets/mfx/lepeltheme.mod:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/mfx/lepeltheme.mod
--------------------------------------------------------------------------------
/doc/culling_benchmark.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/doc/culling_benchmark.png
--------------------------------------------------------------------------------
/doc/culling_benchmark.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/doc/culling_benchmark.xlsx
--------------------------------------------------------------------------------
/ext/img/snake_tailpart.pdn:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/img/snake_tailpart.pdn
--------------------------------------------------------------------------------
/ext/img/snake_texture.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/img/snake_texture.png
--------------------------------------------------------------------------------
/res/drawable-hdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/drawable-hdpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-ldpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/drawable-ldpi/icon.png
--------------------------------------------------------------------------------
/res/drawable-mdpi/icon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/drawable-mdpi/icon.png
--------------------------------------------------------------------------------
/res/raw/quads_rgb_565.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/quads_rgb_565.pvr
--------------------------------------------------------------------------------
/res/raw/quads_rgba_8888.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/quads_rgba_8888.pvr
--------------------------------------------------------------------------------
/res/raw/test_bgra_8888.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test_bgra_8888.pvr
--------------------------------------------------------------------------------
/res/raw/test_rgba_5551.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test_rgba_5551.pvr
--------------------------------------------------------------------------------
/res/raw/test_rgba_8888.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test_rgba_8888.pvr
--------------------------------------------------------------------------------
/assets/gfx/carddeck_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/carddeck_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/face_box_menu.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_box_menu.png
--------------------------------------------------------------------------------
/assets/gfx/face_box_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_box_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/particle_fire.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/particle_fire.png
--------------------------------------------------------------------------------
/assets/gfx/particle_point.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/particle_point.png
--------------------------------------------------------------------------------
/assets/gfx/snake_tailpart.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/snake_tailpart.png
--------------------------------------------------------------------------------
/assets/gfx/toggle_button.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/toggle_button.png
--------------------------------------------------------------------------------
/res/raw/house_pvr_rgb_565.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvr_rgb_565.pvr
--------------------------------------------------------------------------------
/assets/font/KingdomOfHearts.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/KingdomOfHearts.ttf
--------------------------------------------------------------------------------
/assets/font/UnrealTournament.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/UnrealTournament.ttf
--------------------------------------------------------------------------------
/assets/gfx/background_grass.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/background_grass.png
--------------------------------------------------------------------------------
/assets/gfx/chromatic_circle.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/chromatic_circle.png
--------------------------------------------------------------------------------
/assets/gfx/click_to_unload.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/click_to_unload.png
--------------------------------------------------------------------------------
/assets/gfx/face_circle_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_circle_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/helicopter_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/helicopter_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/imageformat_bmp.bmp:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/imageformat_bmp.bmp
--------------------------------------------------------------------------------
/assets/gfx/imageformat_gif.gif:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/imageformat_gif.gif
--------------------------------------------------------------------------------
/assets/gfx/imageformat_gif.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/imageformat_gif.png
--------------------------------------------------------------------------------
/assets/gfx/imageformat_jpg.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/imageformat_jpg.jpg
--------------------------------------------------------------------------------
/assets/gfx/imageformat_png.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/imageformat_png.png
--------------------------------------------------------------------------------
/assets/gfx/menu_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/menu_background.png
--------------------------------------------------------------------------------
/assets/gfx/racetrack_curve.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/racetrack_curve.png
--------------------------------------------------------------------------------
/assets/gfx/snake_background.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/snake_background.png
--------------------------------------------------------------------------------
/assets/gfx/snapdragon_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/snapdragon_tiled.png
--------------------------------------------------------------------------------
/doc/spritebatch_benchmark.xlsx:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/doc/spritebatch_benchmark.xlsx
--------------------------------------------------------------------------------
/res/raw/house_pvr_argb_4444.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvr_argb_4444.pvr
--------------------------------------------------------------------------------
/res/raw/house_pvr_argb_5551.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvr_argb_5551.pvr
--------------------------------------------------------------------------------
/res/raw/house_pvr_argb_8888.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvr_argb_8888.pvr
--------------------------------------------------------------------------------
/res/raw/test_rgba_8888_pma.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/test_rgba_8888_pma.pvr
--------------------------------------------------------------------------------
/assets/font/NeverwinterNights.ttf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/NeverwinterNights.ttf
--------------------------------------------------------------------------------
/assets/gfx/face_hexagon_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_hexagon_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/face_triangle_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/face_triangle_tiled.png
--------------------------------------------------------------------------------
/assets/gfx/racetrack_straight.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/racetrack_straight.png
--------------------------------------------------------------------------------
/res/raw/house_pvrccz_argb_8888.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvrccz_argb_8888.bin
--------------------------------------------------------------------------------
/res/raw/house_pvrgz_argb_8888.bin:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvrgz_argb_8888.bin
--------------------------------------------------------------------------------
/assets/font/BitmapFontWithKerning.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/font/BitmapFontWithKerning.png
--------------------------------------------------------------------------------
/assets/gfx/onscreen_control_base.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/onscreen_control_base.png
--------------------------------------------------------------------------------
/assets/gfx/onscreen_control_knob.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/onscreen_control_knob.png
--------------------------------------------------------------------------------
/assets/gfx/texturecompositing/zynga.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/texturecompositing/zynga.png
--------------------------------------------------------------------------------
/res/raw/house_pvr_argb_8888_mipmaps.pvr:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/res/raw/house_pvr_argb_8888_mipmaps.pvr
--------------------------------------------------------------------------------
/assets/gfx/texturecompositing/balloon.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/texturecompositing/balloon.png
--------------------------------------------------------------------------------
/assets/gfx/parallax_background_layer_mid.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/parallax_background_layer_mid.png
--------------------------------------------------------------------------------
/assets/gfx/texturecompositing/alphamask.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/texturecompositing/alphamask.png
--------------------------------------------------------------------------------
/assets/gfx/parallax_background_layer_back.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/parallax_background_layer_back.png
--------------------------------------------------------------------------------
/assets/gfx/parallax_background_layer_front.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/parallax_background_layer_front.png
--------------------------------------------------------------------------------
/assets/mfx/wagner_the_ride_of_the_valkyries.ogg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/mfx/wagner_the_ride_of_the_valkyries.ogg
--------------------------------------------------------------------------------
/assets/gfx/spritesheets/texturepackerexample.pvr.ccz:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/assets/gfx/spritesheets/texturepackerexample.pvr.ccz
--------------------------------------------------------------------------------
/ext/gfx/spritesheets/texturepackerexample/face_box.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/gfx/spritesheets/texturepackerexample/face_box.png
--------------------------------------------------------------------------------
/ext/gfx/spritesheets/texturepackerexample/face_circle_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/gfx/spritesheets/texturepackerexample/face_circle_tiled.png
--------------------------------------------------------------------------------
/ext/gfx/spritesheets/texturepackerexample/face_hexagon_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/gfx/spritesheets/texturepackerexample/face_hexagon_tiled.png
--------------------------------------------------------------------------------
/ext/gfx/spritesheets/texturepackerexample/face_triangle_tiled.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/nicolasgramlich/AndEngineExamples/HEAD/ext/gfx/spritesheets/texturepackerexample/face_triangle_tiled.png
--------------------------------------------------------------------------------
/assets/tmx/desert.tsx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/.classpath:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # System:
2 | Thumbs.db
3 | .DS_Store
4 | *.swp
5 | *~
6 | Desktop.ini
7 |
8 | # Version Control Systems:
9 | .svn
10 | CVS
11 | .hg
12 | .bzr
13 |
14 | # Android:
15 | local.properties
16 | proguard/**
17 | target/**
18 | bin/**
19 | obj/**
20 | doc/**
21 | gen/**
22 | gdb.setup
23 | gdbserver
24 |
25 | # Eclipse:
26 | .settings
27 |
28 | # IntelliJ / Android Studio:
29 | idea/workspace.xml
30 | idea/tasks.xml
31 |
32 | # Crashlytics
33 | res/values/com_crashlytics_export_strings.xml
34 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/spritesheets/TexturePackerExampleSpritesheet.java:
--------------------------------------------------------------------------------
1 | // Definitions for sprite sheet texturepackerexample
2 | // Created with www.texturepacker.com
3 |
4 | // $TexturePacker:SmartUpdate:c7fde2bcfc878112620c417ecfd0e44e$
5 |
6 | package org.andengine.examples.spritesheets;
7 |
8 | public interface TexturePackerExampleSpritesheet
9 | {
10 | public static final int FACE_BOX_ID = 0;
11 | public static final int FACE_CIRCLE_TILED_ID = 1;
12 | public static final int FACE_HEXAGON_TILED_ID = 2;
13 | public static final int FACE_TRIANGLE_TILED_ID = 3;
14 | }
15 |
--------------------------------------------------------------------------------
/res/layout/listrow_example.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/res/layout/listrow_examplegroup.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
15 |
16 |
--------------------------------------------------------------------------------
/res/layout/list_examples.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
7 |
11 |
12 |
17 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/ICellEntity.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 23:39:05 - 11.07.2010
9 | */
10 | public interface ICellEntity {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | public abstract int getCellX();
16 | public abstract int getCellY();
17 |
18 | public abstract void setCell(final ICellEntity pCellEntity);
19 | public abstract void setCell(final int pCellX, final int pCellY);
20 |
21 | public abstract boolean isInSameCell(final ICellEntity pCellEntity);
22 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/util/constants/SnakeConstants.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.util.constants;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 17:42:10 - 09.07.2010
9 | */
10 | public interface SnakeConstants {
11 | // ===========================================================
12 | // Final Fields
13 | // ===========================================================
14 |
15 | public static final int CELLS_HORIZONTAL = 16;
16 | public static final int CELLS_VERTICAL = 12;
17 |
18 | public static final int CELL_WIDTH = 32;
19 | public static final int CELL_HEIGHT = CELL_WIDTH;
20 |
21 | // ===========================================================
22 | // Methods
23 | // ===========================================================
24 | }
25 |
--------------------------------------------------------------------------------
/assets/tmx/desert_with_tsx_tileset.tmx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
11 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | AndEngineExamples
4 |
5 |
6 |
7 |
8 |
9 | com.android.ide.eclipse.adt.ResourceManagerBuilder
10 |
11 |
12 |
13 |
14 | com.android.ide.eclipse.adt.PreCompilerBuilder
15 |
16 |
17 |
18 |
19 | org.eclipse.jdt.core.javabuilder
20 |
21 |
22 |
23 |
24 | com.android.ide.eclipse.adt.ApkBuilder
25 |
26 |
27 |
28 |
29 |
30 | com.android.ide.eclipse.adt.AndroidNature
31 | org.eclipse.jdt.core.javanature
32 |
33 |
34 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/client/ClientMessageFlags.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.client;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 12:00:00 - 21.05.2011
9 | */
10 | public interface ClientMessageFlags {
11 | // ===========================================================
12 | // Final Fields
13 | // ===========================================================
14 |
15 | /* Connection Flags. */
16 | public static final short FLAG_MESSAGE_CLIENT_CONNECTION_CLOSE = Short.MIN_VALUE;
17 | public static final short FLAG_MESSAGE_CLIENT_CONNECTION_ESTABLISH = FLAG_MESSAGE_CLIENT_CONNECTION_CLOSE + 1;
18 | public static final short FLAG_MESSAGE_CLIENT_CONNECTION_PING = FLAG_MESSAGE_CLIENT_CONNECTION_ESTABLISH + 1;
19 |
20 | // ===========================================================
21 | // Methods
22 | // ===========================================================
23 | }
24 |
--------------------------------------------------------------------------------
/res/layout/textbreakexample.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
10 |
11 |
15 |
23 |
24 |
--------------------------------------------------------------------------------
/assets/tmx/desert.tmx:
--------------------------------------------------------------------------------
1 |
2 |
3 |
18 |
--------------------------------------------------------------------------------
/assets/gfx/spritesheets/texturepackerexample.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/project.properties:
--------------------------------------------------------------------------------
1 | # This file is automatically generated by Android Tools.
2 | # Do not modify this file -- YOUR CHANGES WILL BE ERASED!
3 | #
4 | # This file must be checked in Version Control Systems.
5 | #
6 | # To customize properties used by the Ant build system use,
7 | # "ant.properties", and override values to adapt the script to your
8 | # project structure.
9 |
10 | # Indicates whether an apk should be generated for each density.
11 | # Project target.
12 | target=android-15
13 | split.density=false
14 | android.library.reference.3=../AndEngineMODPlayerExtension
15 | android.library.reference.4=../AndEngineSVGTextureRegionExtension
16 | android.library.reference.1=../AndEngine
17 | android.library.reference.2=../AndEngineAugmentedRealityExtension
18 | android.library.reference.6=../AndEngineTexturePackerExtension
19 | android.library.reference.5=../AndEnginePhysicsBox2DExtension
20 | android.library.reference.7=../AndEngineMultiplayerExtension
21 | android.library.reference.8=../AndEngineLiveWallpaperExtension
22 | android.library.reference.9=../AndEngineTMXTiledMapExtension
23 | android.library.reference.10=../AndEngineScriptingExtension
24 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/server/ServerMessageFlags.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.server;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 11:59:39 - 21.05.2011
9 | */
10 | public interface ServerMessageFlags {
11 | // ===========================================================
12 | // Final Fields
13 | // ===========================================================
14 |
15 | /* Connection Flags. */
16 | public static final short FLAG_MESSAGE_SERVER_CONNECTION_CLOSE = Short.MIN_VALUE;
17 | public static final short FLAG_MESSAGE_SERVER_CONNECTION_ESTABLISHED = FLAG_MESSAGE_SERVER_CONNECTION_CLOSE + 1;
18 | public static final short FLAG_MESSAGE_SERVER_CONNECTION_REJECTED_PROTOCOL_MISSMATCH = FLAG_MESSAGE_SERVER_CONNECTION_ESTABLISHED + 1;
19 | public static final short FLAG_MESSAGE_SERVER_CONNECTION_PONG = FLAG_MESSAGE_SERVER_CONNECTION_REJECTED_PROTOCOL_MISSMATCH + 1;
20 |
21 | // ===========================================================
22 | // Methods
23 | // ===========================================================
24 | }
25 |
--------------------------------------------------------------------------------
/res/layout/xmllayoutexample.xml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
9 |
10 |
16 |
17 |
23 |
27 |
28 |
29 |
35 |
36 |
--------------------------------------------------------------------------------
/proguard.cfg:
--------------------------------------------------------------------------------
1 | -optimizationpasses 5
2 | -dontusemixedcaseclassnames
3 | -dontskipnonpubliclibraryclasses
4 | -dontpreverify
5 | -verbose
6 | -optimizations !code/simplification/arithmetic,!field/*,!class/merging/*
7 |
8 | -keep public class * extends android.app.Activity
9 | -keep public class * extends android.app.Application
10 | -keep public class * extends android.app.Service
11 | -keep public class * extends android.content.BroadcastReceiver
12 | -keep public class * extends android.content.ContentProvider
13 | -keep public class * extends android.app.backup.BackupAgentHelper
14 | -keep public class * extends android.preference.Preference
15 | -keep public class com.android.vending.licensing.ILicensingService
16 |
17 | -keepclasseswithmembernames class * {
18 | native ;
19 | }
20 |
21 | -keepclasseswithmembers class * {
22 | public (android.content.Context, android.util.AttributeSet);
23 | }
24 |
25 | -keepclasseswithmembers class * {
26 | public (android.content.Context, android.util.AttributeSet, int);
27 | }
28 |
29 | -keepclassmembers class * extends android.app.Activity {
30 | public void *(android.view.View);
31 | }
32 |
33 | -keepclassmembers enum * {
34 | public static **[] values();
35 | public static ** valueOf(java.lang.String);
36 | }
37 |
38 | -keep class * implements android.os.Parcelable {
39 | public static final android.os.Parcelable$Creator *;
40 | }
41 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/ZoomState.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt;
2 |
3 | public enum ZoomState {
4 | // ===========================================================
5 | // Elements
6 | // ===========================================================
7 |
8 | IN,
9 | OUT,
10 | NONE;
11 |
12 | // ===========================================================
13 | // Constants
14 | // ===========================================================
15 |
16 | // ===========================================================
17 | // Fields
18 | // ===========================================================
19 |
20 | // ===========================================================
21 | // Constructors
22 | // ===========================================================
23 |
24 | // ===========================================================
25 | // Getter & Setter
26 | // ===========================================================
27 |
28 | // ===========================================================
29 | // Methods for/from SuperClass/Interfaces
30 | // ===========================================================
31 |
32 | // ===========================================================
33 | // Methods
34 | // ===========================================================
35 |
36 | // ===========================================================
37 | // Inner and Anonymous Classes
38 | // ===========================================================
39 | }
40 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/MessageConstants.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 12:18:34 - 21.05.2011
9 | */
10 | public class MessageConstants {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | public static final short PROTOCOL_VERSION = 1;
16 |
17 | // ===========================================================
18 | // Fields
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Constructors
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Getter & Setter
27 | // ===========================================================
28 |
29 | // ===========================================================
30 | // Methods for/from SuperClass/Interfaces
31 | // ===========================================================
32 |
33 | // ===========================================================
34 | // Methods
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Inner and Anonymous Classes
39 | // ===========================================================
40 | }
41 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/adt/SnakeSuicideException.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.adt;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 15:29:42 - 11.07.2010
9 | */
10 | public class SnakeSuicideException extends Exception {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | private static final long serialVersionUID = -4008723747610431268L;
16 |
17 | // ===========================================================
18 | // Fields
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Constructors
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Getter & Setter
27 | // ===========================================================
28 |
29 | // ===========================================================
30 | // Methods for/from SuperClass/Interfaces
31 | // ===========================================================
32 |
33 | // ===========================================================
34 | // Methods
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Inner and Anonymous Classes
39 | // ===========================================================
40 | }
41 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/Score.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 12:11:58 - 01.03.2011
9 | */
10 | public class Score {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | // ===========================================================
16 | // Fields
17 | // ===========================================================
18 |
19 | private int mScore = 0;
20 |
21 | // ===========================================================
22 | // Constructors
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Getter & Setter
27 | // ===========================================================
28 |
29 | public int getScore() {
30 | return this.mScore;
31 | }
32 |
33 | // ===========================================================
34 | // Methods for/from SuperClass/Interfaces
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods
39 | // ===========================================================
40 |
41 | public void increase() {
42 | this.mScore++;
43 | }
44 |
45 | // ===========================================================
46 | // Inner and Anonymous Classes
47 | // ===========================================================
48 | }
49 |
--------------------------------------------------------------------------------
/res/layout/list_bluetooth_devices.xml:
--------------------------------------------------------------------------------
1 |
2 |
6 |
14 |
19 |
27 |
32 |
36 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/card/Color.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.card;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 18:59:33 - 18.06.2010
9 | */
10 | public enum Color {
11 | // ===========================================================
12 | // Elements
13 | // ===========================================================
14 |
15 | CLUB, // Kreuz
16 | DIAMOND,
17 | HEART,
18 | SPADE; // PIK
19 |
20 | // ===========================================================
21 | // Constants
22 | // ===========================================================
23 |
24 | // ===========================================================
25 | // Fields
26 | // ===========================================================
27 |
28 | // ===========================================================
29 | // Constructors
30 | // ===========================================================
31 |
32 | // ===========================================================
33 | // Getter & Setter
34 | // ===========================================================
35 |
36 | // ===========================================================
37 | // Methods from SuperClass/Interfaces
38 | // ===========================================================
39 |
40 | // ===========================================================
41 | // Methods
42 | // ===========================================================
43 |
44 | // ===========================================================
45 | // Inner and Anonymous Classes
46 | // ===========================================================
47 | }
48 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/card/Value.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.card;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 18:59:46 - 18.06.2010
9 | */
10 | public enum Value {
11 | // ===========================================================
12 | // Elements
13 | // ===========================================================
14 |
15 | ACE,
16 | ONE,
17 | TWO,
18 | THREE,
19 | FOUR,
20 | FIVE,
21 | SIX,
22 | SEVEN,
23 | EIGHT,
24 | NINE,
25 | TEN,
26 | JACK,
27 | QUEEN,
28 | KING;
29 |
30 | // ===========================================================
31 | // Constants
32 | // ===========================================================
33 |
34 | // ===========================================================
35 | // Fields
36 | // ===========================================================
37 |
38 | // ===========================================================
39 | // Constructors
40 | // ===========================================================
41 |
42 | // ===========================================================
43 | // Getter & Setter
44 | // ===========================================================
45 |
46 | // ===========================================================
47 | // Methods from SuperClass/Interfaces
48 | // ===========================================================
49 |
50 | // ===========================================================
51 | // Methods
52 | // ===========================================================
53 |
54 | // ===========================================================
55 | // Inner and Anonymous Classes
56 | // ===========================================================
57 | }
58 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/PaddleUserData.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 12:14:17 - 01.03.2011
9 | */
10 | public class PaddleUserData {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | // ===========================================================
16 | // Fields
17 | // ===========================================================
18 |
19 | private final int mOwnerID;
20 | private final int mOpponentID;
21 |
22 | // ===========================================================
23 | // Constructors
24 | // ===========================================================
25 |
26 | public PaddleUserData(final int pOwnerID, final int pOpponentID) {
27 | this.mOwnerID = pOwnerID;
28 | this.mOpponentID = pOpponentID;
29 | }
30 |
31 | // ===========================================================
32 | // Getter & Setter
33 | // ===========================================================
34 |
35 | public int getOwnerID() {
36 | return this.mOwnerID;
37 | }
38 |
39 | public int getOpponentID() {
40 | return this.mOpponentID;
41 | }
42 |
43 | // ===========================================================
44 | // Methods for/from SuperClass/Interfaces
45 | // ===========================================================
46 |
47 | // ===========================================================
48 | // Methods
49 | // ===========================================================
50 |
51 | // ===========================================================
52 | // Inner and Anonymous Classes
53 | // ===========================================================
54 | }
55 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/Frog.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import org.andengine.opengl.texture.region.TiledTextureRegion;
4 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
5 |
6 | /**
7 | * (c) 2010 Nicolas Gramlich
8 | * (c) 2011 Zynga Inc.
9 | *
10 | * @author Nicolas Gramlich
11 | * @since 14:08:58 - 11.07.2010
12 | */
13 | public class Frog extends AnimatedCellEntity {
14 | // ===========================================================
15 | // Constants
16 | // ===========================================================
17 |
18 | // ===========================================================
19 | // Fields
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Constructors
24 | // ===========================================================
25 |
26 | public Frog(final int pCellX, final int pCellY, final TiledTextureRegion pTiledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
27 | super(pCellX, pCellY, CELL_WIDTH, CELL_HEIGHT, pTiledTextureRegion, pVertexBufferObjectManager);
28 | }
29 |
30 | // ===========================================================
31 | // Getter & Setter
32 | // ===========================================================
33 |
34 | // ===========================================================
35 | // Methods for/from SuperClass/Interfaces
36 | // ===========================================================
37 |
38 | // ===========================================================
39 | // Methods
40 | // ===========================================================
41 |
42 | // ===========================================================
43 | // Inner and Anonymous Classes
44 | // ===========================================================
45 | }
46 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/SnakeTailPart.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import org.andengine.opengl.texture.region.ITextureRegion;
4 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
5 |
6 | /**
7 | * (c) 2010 Nicolas Gramlich
8 | * (c) 2011 Zynga Inc.
9 | *
10 | * @author Nicolas Gramlich
11 | * @since 17:44:59 - 09.07.2010
12 | */
13 | public class SnakeTailPart extends CellEntity {
14 | // ===========================================================
15 | // Constants
16 | // ===========================================================
17 |
18 | // ===========================================================
19 | // Fields
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Constructors
24 | // ===========================================================
25 |
26 | public SnakeTailPart(final SnakeHead pSnakeHead, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
27 | this(pSnakeHead.mCellX, pSnakeHead.mCellY, pTextureRegion, pVertexBufferObjectManager);
28 | }
29 |
30 | public SnakeTailPart(final int pCellX, final int pCellY, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
31 | super(pCellX, pCellY, CELL_WIDTH, CELL_HEIGHT, pTextureRegion, pVertexBufferObjectManager);
32 | }
33 |
34 | // ===========================================================
35 | // Getter & Setter
36 | // ===========================================================
37 |
38 | // ===========================================================
39 | // Methods for/from SuperClass/Interfaces
40 | // ===========================================================
41 |
42 | // ===========================================================
43 | // Methods
44 | // ===========================================================
45 |
46 | // ===========================================================
47 | // Inner and Anonymous Classes
48 | // ===========================================================
49 | }
50 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/util/constants/PongConstants.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.util.constants;
2 |
3 | import org.andengine.examples.game.pong.adt.PaddleUserData;
4 |
5 | /**
6 | * (c) 2010 Nicolas Gramlich
7 | * (c) 2011 Zynga Inc.
8 | *
9 | * @author Nicolas Gramlich
10 | * @since 19:49:20 - 28.02.2011
11 | */
12 | public interface PongConstants {
13 | // ===========================================================
14 | // Final Fields
15 | // ===========================================================
16 |
17 | public static final int FPS = 30;
18 |
19 | public static final int GAME_WIDTH = 720;
20 | public static final int GAME_WIDTH_HALF = GAME_WIDTH / 2;
21 | public static final int GAME_HEIGHT = 480;
22 | public static final int GAME_HEIGHT_HALF = GAME_HEIGHT / 2;
23 |
24 | public static final int PADDLE_WIDTH = 20;
25 | public static final int PADDLE_WIDTH_HALF = PADDLE_WIDTH / 2;
26 | public static final int PADDLE_HEIGHT = 80;
27 | public static final int PADDLE_HEIGHT_HALF = PADDLE_HEIGHT / 2;
28 |
29 | public static final int BALL_WIDTH = 10;
30 | public static final int BALL_HEIGHT = 10;
31 | public static final int BALL_RADIUS = BALL_WIDTH / 2;
32 |
33 | public static final int SCORE_PADDING = 5;
34 |
35 | public static final PaddleUserData PADDLE_LEFT = new PaddleUserData(0, 1);
36 | public static final PaddleUserData PADDLE_RIGHT = new PaddleUserData(1, 0);
37 |
38 |
39 | public static final int SERVER_PORT = 4444;
40 |
41 | /* Server --> Client */
42 | public static final short FLAG_MESSAGE_SERVER_SET_PADDLEID = 1;
43 | public static final short FLAG_MESSAGE_SERVER_UPDATE_SCORE = FLAG_MESSAGE_SERVER_SET_PADDLEID + 1;
44 | public static final short FLAG_MESSAGE_SERVER_UPDATE_BALL = FLAG_MESSAGE_SERVER_UPDATE_SCORE + 1;
45 | public static final short FLAG_MESSAGE_SERVER_UPDATE_PADDLE = FLAG_MESSAGE_SERVER_UPDATE_BALL + 1;
46 |
47 | /* Client --> Server */
48 | public static final short FLAG_MESSAGE_CLIENT_MOVE_PADDLE = 1;
49 |
50 | // ===========================================================
51 | // Methods
52 | // ===========================================================
53 | }
54 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/client/ConnectionCloseClientMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.client;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.client.ClientMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:00:36 - 21.05.2011
15 | */
16 | public class ConnectionCloseClientMessage extends ClientMessage implements ClientMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Constructors
27 | // ===========================================================
28 |
29 | public ConnectionCloseClientMessage() {
30 |
31 | }
32 |
33 | // ===========================================================
34 | // Getter & Setter
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods for/from SuperClass/Interfaces
39 | // ===========================================================
40 |
41 | @Override
42 | public short getFlag() {
43 | return FLAG_MESSAGE_CLIENT_CONNECTION_CLOSE;
44 | }
45 |
46 | @Override
47 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
48 | /* Nothing to read. */
49 | }
50 |
51 | @Override
52 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
53 | /* Nothing to write. */
54 | }
55 |
56 | // ===========================================================
57 | // Methods
58 | // ===========================================================
59 |
60 | // ===========================================================
61 | // Inner and Anonymous Classes
62 | // ===========================================================
63 | }
64 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/server/ConnectionCloseServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 16:11:40 - 11.03.2011
15 | */
16 | public class ConnectionCloseServerMessage extends ServerMessage implements ServerMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Constructors
27 | // ===========================================================
28 |
29 | public ConnectionCloseServerMessage() {
30 |
31 | }
32 |
33 | // ===========================================================
34 | // Getter & Setter
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods for/from SuperClass/Interfaces
39 | // ===========================================================
40 |
41 | @Override
42 | public short getFlag() {
43 | return FLAG_MESSAGE_SERVER_CONNECTION_CLOSE;
44 | }
45 |
46 | @Override
47 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
48 | /* Nothing to read. */
49 | }
50 |
51 | @Override
52 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
53 | /* Nothing to write. */
54 | }
55 |
56 | // ===========================================================
57 | // Methods
58 | // ===========================================================
59 |
60 | // ===========================================================
61 | // Inner and Anonymous Classes
62 | // ===========================================================
63 | }
64 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/server/ConnectionEstablishedServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:23:25 - 21.05.2011
15 | */
16 | public class ConnectionEstablishedServerMessage extends ServerMessage implements ServerMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Constructors
27 | // ===========================================================
28 |
29 | public ConnectionEstablishedServerMessage() {
30 |
31 | }
32 |
33 | // ===========================================================
34 | // Getter & Setter
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods for/from SuperClass/Interfaces
39 | // ===========================================================
40 |
41 | @Override
42 | public short getFlag() {
43 | return FLAG_MESSAGE_SERVER_CONNECTION_ESTABLISHED;
44 | }
45 |
46 | @Override
47 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
48 | /* Nothing to read. */
49 | }
50 |
51 | @Override
52 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
53 | /* Nothing to write. */
54 | }
55 |
56 | // ===========================================================
57 | // Methods
58 | // ===========================================================
59 |
60 | // ===========================================================
61 | // Inner and Anonymous Classes
62 | // ===========================================================
63 | }
64 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/SnakeHead.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import org.andengine.examples.game.snake.adt.Direction;
4 | import org.andengine.opengl.texture.region.TiledTextureRegion;
5 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
6 |
7 | /**
8 | * (c) 2010 Nicolas Gramlich
9 | * (c) 2011 Zynga Inc.
10 | *
11 | * @author Nicolas Gramlich
12 | * @since 17:44:59 - 09.07.2010
13 | */
14 | public class SnakeHead extends AnimatedCellEntity {
15 | // ===========================================================
16 | // Constants
17 | // ===========================================================
18 |
19 | // ===========================================================
20 | // Fields
21 | // ===========================================================
22 |
23 | // ===========================================================
24 | // Constructors
25 | // ===========================================================
26 |
27 | public SnakeHead(final int pCellX, final int pCellY, final TiledTextureRegion pTiledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
28 | super(pCellX, pCellY, CELL_WIDTH, 2 * CELL_HEIGHT, pTiledTextureRegion, pVertexBufferObjectManager);
29 |
30 | this.setRotationCenterY(CELL_HEIGHT / 2);
31 | }
32 |
33 | // ===========================================================
34 | // Getter & Setter
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods for/from SuperClass/Interfaces
39 | // ===========================================================
40 |
41 | // ===========================================================
42 | // Methods
43 | // ===========================================================
44 |
45 | public void setRotation(final Direction pDirection) {
46 | switch(pDirection) {
47 | case UP:
48 | this.setRotation(180);
49 | break;
50 | case DOWN:
51 | this.setRotation(0);
52 | break;
53 | case LEFT:
54 | this.setRotation(90);
55 | break;
56 | case RIGHT:
57 | this.setRotation(270);
58 | break;
59 | }
60 | }
61 |
62 | // ===========================================================
63 | // Inner and Anonymous Classes
64 | // ===========================================================
65 | }
66 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/cityradar/City.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.cityradar;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 20:32:16 - 28.10.2010
9 | */
10 | public class City {
11 | // ===========================================================
12 | // Constants
13 | // ===========================================================
14 |
15 | // ===========================================================
16 | // Fields
17 | // ===========================================================
18 |
19 | private final String mName;
20 | private final double mLatitude;
21 | private final double mLongitude;
22 | private double mDistanceToUser;
23 | private double mBearingToUser;
24 |
25 | // ===========================================================
26 | // Constructors
27 | // ===========================================================
28 |
29 | public City(final String pName, final double pLatitude, final double pLongitude) {
30 | this.mName = pName;
31 | this.mLatitude = pLatitude;
32 | this.mLongitude = pLongitude;
33 | }
34 |
35 | // ===========================================================
36 | // Getter & Setter
37 | // ===========================================================
38 |
39 | public final String getName() {
40 | return this.mName;
41 | }
42 |
43 | public final double getLatitude() {
44 | return this.mLatitude;
45 | }
46 |
47 | public final double getLongitude() {
48 | return this.mLongitude;
49 | }
50 |
51 | public double getDistanceToUser() {
52 | return this.mDistanceToUser;
53 | }
54 |
55 | public void setDistanceToUser(final double pDistanceToUser) {
56 | this.mDistanceToUser = pDistanceToUser;
57 | }
58 |
59 | public double getBearingToUser() {
60 | return this.mBearingToUser;
61 | }
62 |
63 | public void setBearingToUser(final double pBearingToUser) {
64 | this.mBearingToUser = pBearingToUser;
65 | }
66 |
67 | // ===========================================================
68 | // Methods for/from SuperClass/Interfaces
69 | // ===========================================================
70 |
71 | // ===========================================================
72 | // Methods
73 | // ===========================================================
74 |
75 | // ===========================================================
76 | // Inner and Anonymous Classes
77 | // ===========================================================
78 |
79 |
80 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/client/ConnectionPingClientMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.client;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.client.ClientMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:23:37 - 21.05.2011
15 | */
16 | public class ConnectionPingClientMessage extends ClientMessage implements ClientMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | private long mTimestamp;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | @Deprecated
32 | public ConnectionPingClientMessage() {
33 |
34 | }
35 |
36 | // ===========================================================
37 | // Getter & Setter
38 | // ===========================================================
39 |
40 | public long getTimestamp() {
41 | return this.mTimestamp;
42 | }
43 |
44 | public void setTimestamp(final long pTimestamp) {
45 | this.mTimestamp = pTimestamp;
46 | }
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public short getFlag() {
54 | return FLAG_MESSAGE_CLIENT_CONNECTION_PING;
55 | }
56 |
57 | @Override
58 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
59 | this.mTimestamp = pDataInputStream.readLong();
60 | }
61 |
62 | @Override
63 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
64 | pDataOutputStream.writeLong(this.mTimestamp);
65 | }
66 |
67 | // ===========================================================
68 | // Methods
69 | // ===========================================================
70 |
71 | // ===========================================================
72 | // Inner and Anonymous Classes
73 | // ===========================================================
74 | }
75 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/messages/server/SetPaddleIDServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.examples.game.pong.util.constants.PongConstants;
8 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
9 |
10 | /**
11 | * (c) 2010 Nicolas Gramlich
12 | * (c) 2011 Zynga Inc.
13 | *
14 | * @author Nicolas Gramlich
15 | * @since 19:48:32 - 28.02.2011
16 | */
17 | public class SetPaddleIDServerMessage extends ServerMessage implements PongConstants {
18 | // ===========================================================
19 | // Constants
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Fields
24 | // ===========================================================
25 |
26 | public int mPaddleID;
27 |
28 | // ===========================================================
29 | // Constructors
30 | // ===========================================================
31 |
32 | public SetPaddleIDServerMessage() {
33 |
34 | }
35 |
36 | public SetPaddleIDServerMessage(final int pPaddleID) {
37 | this.mPaddleID = pPaddleID;
38 | }
39 |
40 | // ===========================================================
41 | // Getter & Setter
42 | // ===========================================================
43 |
44 | public void set(final int pPaddleID) {
45 | this.mPaddleID = pPaddleID;
46 | }
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public short getFlag() {
54 | return FLAG_MESSAGE_SERVER_SET_PADDLEID;
55 | }
56 |
57 | @Override
58 | protected void onReadTransmissionData(DataInputStream pDataInputStream) throws IOException {
59 | this.mPaddleID = pDataInputStream.readInt();
60 | }
61 |
62 | @Override
63 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
64 | pDataOutputStream.writeInt(this.mPaddleID);
65 | }
66 |
67 | // ===========================================================
68 | // Methods
69 | // ===========================================================
70 |
71 | // ===========================================================
72 | // Inner and Anonymous Classes
73 | // ===========================================================
74 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/adt/Direction.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.adt;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 02:29:05 - 08.07.2010
9 | */
10 | public enum Direction {
11 | // ===========================================================
12 | // Elements
13 | // ===========================================================
14 |
15 | UP, DOWN, LEFT, RIGHT;
16 |
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | // ===========================================================
26 | // Constructors
27 | // ===========================================================
28 |
29 | // ===========================================================
30 | // Getter & Setter
31 | // ===========================================================
32 |
33 | // ===========================================================
34 | // Methods from SuperClass/Interfaces
35 | // ===========================================================
36 |
37 | // ===========================================================
38 | // Methods
39 | // ===========================================================
40 |
41 | public static int addToX(final Direction pDirection, final int pX) {
42 | switch(pDirection) {
43 | case UP:
44 | case DOWN:
45 | return pX;
46 | case LEFT:
47 | return pX - 1;
48 | case RIGHT:
49 | return pX + 1;
50 | default:
51 | throw new IllegalArgumentException();
52 | }
53 | }
54 |
55 | public static int addToY(final Direction pDirection, final int pY) {
56 | switch(pDirection) {
57 | case LEFT:
58 | case RIGHT:
59 | return pY;
60 | case UP:
61 | return pY - 1;
62 | case DOWN:
63 | return pY + 1;
64 | default:
65 | throw new IllegalArgumentException();
66 | }
67 | }
68 |
69 | public static Direction opposite(final Direction pDirection) {
70 | switch(pDirection) {
71 | case UP:
72 | return DOWN;
73 | case DOWN:
74 | return UP;
75 | case LEFT:
76 | return RIGHT;
77 | case RIGHT:
78 | return LEFT;
79 | default:
80 | return null;
81 | }
82 | }
83 |
84 | // ===========================================================
85 | // Inner and Anonymous Classes
86 | // ===========================================================
87 | }
88 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/client/ConnectionEstablishClientMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.client;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.client.ClientMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:00:31 - 21.05.2011
15 | */
16 | public class ConnectionEstablishClientMessage extends ClientMessage implements ClientMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | private short mProtocolVersion;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | @Deprecated
32 | public ConnectionEstablishClientMessage() {
33 |
34 | }
35 |
36 | public ConnectionEstablishClientMessage(final short pProtocolVersion) {
37 | this.mProtocolVersion = pProtocolVersion;
38 | }
39 |
40 | // ===========================================================
41 | // Getter & Setter
42 | // ===========================================================
43 |
44 | public short getProtocolVersion() {
45 | return this.mProtocolVersion;
46 | }
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public short getFlag() {
54 | return ClientMessageFlags.FLAG_MESSAGE_CLIENT_CONNECTION_ESTABLISH;
55 | }
56 |
57 | @Override
58 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
59 | this.mProtocolVersion = pDataInputStream.readShort();
60 | }
61 |
62 | @Override
63 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
64 | pDataOutputStream.writeShort(this.mProtocolVersion);
65 | }
66 |
67 | // ===========================================================
68 | // Methods
69 | // ===========================================================
70 |
71 | // ===========================================================
72 | // Inner and Anonymous Classes
73 | // ===========================================================
74 | }
75 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/server/ConnectionPongServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:23:20 - 21.05.2011
15 | */
16 | public class ConnectionPongServerMessage extends ServerMessage implements ServerMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | private long mTimestamp;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | @Deprecated
32 | public ConnectionPongServerMessage() {
33 |
34 | }
35 |
36 | public ConnectionPongServerMessage(final long pTimestamp) {
37 | this.mTimestamp = pTimestamp;
38 | }
39 |
40 | // ===========================================================
41 | // Getter & Setter
42 | // ===========================================================
43 |
44 | public long getTimestamp() {
45 | return this.mTimestamp;
46 | }
47 |
48 | public void setTimestamp(long pTimestamp) {
49 | this.mTimestamp = pTimestamp;
50 | }
51 |
52 | // ===========================================================
53 | // Methods for/from SuperClass/Interfaces
54 | // ===========================================================
55 |
56 | @Override
57 | public short getFlag() {
58 | return FLAG_MESSAGE_SERVER_CONNECTION_PONG;
59 | }
60 |
61 | @Override
62 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
63 | this.mTimestamp = pDataInputStream.readLong();
64 | }
65 |
66 | @Override
67 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
68 | pDataOutputStream.writeLong(this.mTimestamp);
69 | }
70 |
71 | // ===========================================================
72 | // Methods
73 | // ===========================================================
74 |
75 | // ===========================================================
76 | // Inner and Anonymous Classes
77 | // ===========================================================
78 | }
79 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/messages/server/UpdateBallServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.examples.game.pong.util.constants.PongConstants;
8 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
9 |
10 | /**
11 | * (c) 2010 Nicolas Gramlich
12 | * (c) 2011 Zynga Inc.
13 | *
14 | * @author Nicolas Gramlich
15 | * @since 19:48:32 - 28.02.2011
16 | */
17 | public class UpdateBallServerMessage extends ServerMessage implements PongConstants {
18 | // ===========================================================
19 | // Constants
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Fields
24 | // ===========================================================
25 |
26 | public float mX;
27 | public float mY;
28 |
29 | // ===========================================================
30 | // Constructors
31 | // ===========================================================
32 |
33 | public UpdateBallServerMessage() {
34 |
35 | }
36 |
37 | public UpdateBallServerMessage(final float pX, final float pY) {
38 | this.mX = pX;
39 | this.mY = pY;
40 | }
41 |
42 | // ===========================================================
43 | // Getter & Setter
44 | // ===========================================================
45 |
46 | public void set(final float pX,final float pY) {
47 | this.mX = pX;
48 | this.mY = pY;
49 | }
50 |
51 | // ===========================================================
52 | // Methods for/from SuperClass/Interfaces
53 | // ===========================================================
54 |
55 | @Override
56 | public short getFlag() {
57 | return FLAG_MESSAGE_SERVER_UPDATE_BALL;
58 | }
59 |
60 | @Override
61 | protected void onReadTransmissionData(DataInputStream pDataInputStream) throws IOException {
62 | this.mX = pDataInputStream.readFloat();
63 | this.mY = pDataInputStream.readFloat();
64 | }
65 |
66 | @Override
67 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
68 | pDataOutputStream.writeFloat(this.mX);
69 | pDataOutputStream.writeFloat(this.mY);
70 | }
71 |
72 | // ===========================================================
73 | // Methods
74 | // ===========================================================
75 |
76 | // ===========================================================
77 | // Inner and Anonymous Classes
78 | // ===========================================================
79 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/messages/client/MovePaddleClientMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt.messages.client;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.examples.game.pong.util.constants.PongConstants;
8 | import org.andengine.extension.multiplayer.protocol.adt.message.client.ClientMessage;
9 |
10 | /**
11 | * (c) 2010 Nicolas Gramlich
12 | * (c) 2011 Zynga Inc.
13 | *
14 | * @author Nicolas Gramlich
15 | * @since 19:52:27 - 28.02.2011
16 | */
17 | public class MovePaddleClientMessage extends ClientMessage implements PongConstants {
18 | // ===========================================================
19 | // Constants
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Fields
24 | // ===========================================================
25 |
26 | public int mPaddleID;
27 | public float mY;
28 |
29 | // ===========================================================
30 | // Constructors
31 | // ===========================================================
32 |
33 | public MovePaddleClientMessage() {
34 |
35 | }
36 |
37 | public MovePaddleClientMessage(final int pID, final float pY) {
38 | this.mPaddleID = pID;
39 | this.mY = pY;
40 | }
41 |
42 | // ===========================================================
43 | // Getter & Setter
44 | // ===========================================================
45 |
46 | public void setPaddleID(final int pPaddleID, final float pY) {
47 | this.mPaddleID = pPaddleID;
48 | this.mY = pY;
49 | }
50 |
51 | // ===========================================================
52 | // Methods for/from SuperClass/Interfaces
53 | // ===========================================================
54 |
55 | @Override
56 | public short getFlag() {
57 | return FLAG_MESSAGE_CLIENT_MOVE_PADDLE;
58 | }
59 |
60 | @Override
61 | protected void onReadTransmissionData(DataInputStream pDataInputStream) throws IOException {
62 | this.mPaddleID = pDataInputStream.readInt();
63 | this.mY = pDataInputStream.readFloat();
64 | }
65 |
66 | @Override
67 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
68 | pDataOutputStream.writeInt(this.mPaddleID);
69 | pDataOutputStream.writeFloat(this.mY);
70 | }
71 |
72 | // ===========================================================
73 | // Methods
74 | // ===========================================================
75 |
76 | // ===========================================================
77 | // Inner and Anonymous Classes
78 | // ===========================================================
79 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/messages/server/UpdateScoreServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.examples.game.pong.util.constants.PongConstants;
8 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
9 |
10 | /**
11 | * (c) 2010 Nicolas Gramlich
12 | * (c) 2011 Zynga Inc.
13 | *
14 | * @author Nicolas Gramlich
15 | * @since 02:02:12 - 01.03.2011
16 | */
17 | public class UpdateScoreServerMessage extends ServerMessage implements PongConstants {
18 | // ===========================================================
19 | // Constants
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Fields
24 | // ===========================================================
25 |
26 | public int mPaddleID;
27 | public int mScore;
28 |
29 | // ===========================================================
30 | // Constructors
31 | // ===========================================================
32 |
33 | public UpdateScoreServerMessage() {
34 |
35 | }
36 |
37 | public UpdateScoreServerMessage(final int pPaddleID, final int pScore) {
38 | this.mPaddleID = pPaddleID;
39 | this.mScore = pScore;
40 | }
41 |
42 | // ===========================================================
43 | // Getter & Setter
44 | // ===========================================================
45 |
46 | public void set(final int pPaddleID, final int pScore) {
47 | this.mPaddleID = pPaddleID;
48 | this.mScore = pScore;
49 | }
50 |
51 | // ===========================================================
52 | // Methods for/from SuperClass/Interfaces
53 | // ===========================================================
54 |
55 | @Override
56 | public short getFlag() {
57 | return FLAG_MESSAGE_SERVER_UPDATE_SCORE;
58 | }
59 |
60 | @Override
61 | protected void onReadTransmissionData(DataInputStream pDataInputStream) throws IOException {
62 | this.mPaddleID = pDataInputStream.readInt();
63 | this.mScore = pDataInputStream.readInt();
64 | }
65 |
66 | @Override
67 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
68 | pDataOutputStream.writeInt(this.mPaddleID);
69 | pDataOutputStream.writeInt(this.mScore);
70 | }
71 |
72 | // ===========================================================
73 | // Methods
74 | // ===========================================================
75 |
76 | // ===========================================================
77 | // Inner and Anonymous Classes
78 | // ===========================================================
79 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/messages/server/ConnectionRejectedProtocolMissmatchServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
8 |
9 | /**
10 | * (c) 2010 Nicolas Gramlich
11 | * (c) 2011 Zynga Inc.
12 | *
13 | * @author Nicolas Gramlich
14 | * @since 12:23:15 - 21.05.2011
15 | */
16 | public class ConnectionRejectedProtocolMissmatchServerMessage extends ServerMessage implements ServerMessageFlags {
17 | // ===========================================================
18 | // Constants
19 | // ===========================================================
20 |
21 | // ===========================================================
22 | // Fields
23 | // ===========================================================
24 |
25 | private short mProtocolVersion;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | @Deprecated
32 | public ConnectionRejectedProtocolMissmatchServerMessage() {
33 |
34 | }
35 |
36 | public ConnectionRejectedProtocolMissmatchServerMessage(final short pProtocolVersion) {
37 | this.mProtocolVersion = pProtocolVersion;
38 | }
39 |
40 | // ===========================================================
41 | // Getter & Setter
42 | // ===========================================================
43 |
44 | public short getProtocolVersion() {
45 | return this.mProtocolVersion;
46 | }
47 |
48 | public void setProtocolVersion(final short pProtocolVersion) {
49 | this.mProtocolVersion = pProtocolVersion;
50 | }
51 |
52 | // ===========================================================
53 | // Methods for/from SuperClass/Interfaces
54 | // ===========================================================
55 |
56 | @Override
57 | public short getFlag() {
58 | return FLAG_MESSAGE_SERVER_CONNECTION_REJECTED_PROTOCOL_MISSMATCH;
59 | }
60 |
61 | @Override
62 | protected void onReadTransmissionData(final DataInputStream pDataInputStream) throws IOException {
63 | this.mProtocolVersion = pDataInputStream.readShort();
64 | }
65 |
66 | @Override
67 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
68 | pDataOutputStream.writeShort(this.mProtocolVersion);
69 | }
70 |
71 | // ===========================================================
72 | // Methods
73 | // ===========================================================
74 |
75 | // ===========================================================
76 | // Inner and Anonymous Classes
77 | // ===========================================================
78 | }
79 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/CellEntity.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import org.andengine.entity.sprite.Sprite;
4 | import org.andengine.examples.game.snake.util.constants.SnakeConstants;
5 | import org.andengine.opengl.texture.region.ITextureRegion;
6 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
7 |
8 | /**
9 | * (c) 2010 Nicolas Gramlich
10 | * (c) 2011 Zynga Inc.
11 | *
12 | * @author Nicolas Gramlich
13 | * @since 17:13:44 - 09.07.2010
14 | */
15 | public abstract class CellEntity extends Sprite implements SnakeConstants, ICellEntity {
16 | // ===========================================================
17 | // Constants
18 | // ===========================================================
19 |
20 | // ===========================================================
21 | // Fields
22 | // ===========================================================
23 |
24 | protected int mCellX;
25 | protected int mCellY;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | public CellEntity(final int pCellX, final int pCellY, final int pWidth, final int pHeight, final ITextureRegion pTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
32 | super(pCellX * CELL_WIDTH, pCellY * CELL_HEIGHT, pWidth, pHeight, pTextureRegion, pVertexBufferObjectManager);
33 |
34 | this.mCellX = pCellX;
35 | this.mCellY = pCellY;
36 | }
37 |
38 | // ===========================================================
39 | // Getter & Setter
40 | // ===========================================================
41 |
42 | public int getCellX() {
43 | return this.mCellX;
44 | }
45 |
46 | public int getCellY() {
47 | return this.mCellY;
48 | }
49 |
50 | public void setCell(final ICellEntity pCellEntity) {
51 | this.setCell(pCellEntity.getCellX(), pCellEntity.getCellY());
52 | }
53 |
54 | public void setCell(final int pCellX, final int pCellY) {
55 | this.mCellX = pCellX;
56 | this.mCellY = pCellY;
57 | this.setPosition(this.mCellX * CELL_WIDTH, this.mCellY * CELL_HEIGHT);
58 | }
59 |
60 | // ===========================================================
61 | // Methods for/from SuperClass/Interfaces
62 | // ===========================================================
63 |
64 | // ===========================================================
65 | // Methods
66 | // ===========================================================
67 |
68 | @Override
69 | public boolean isInSameCell(final ICellEntity pCellEntity) {
70 | return this.mCellX == pCellEntity.getCellX() && this.mCellY == pCellEntity.getCellY();
71 | }
72 |
73 | // ===========================================================
74 | // Inner and Anonymous Classes
75 | // ===========================================================
76 | }
77 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/AnimatedCellEntity.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import org.andengine.entity.sprite.AnimatedSprite;
4 | import org.andengine.examples.game.snake.util.constants.SnakeConstants;
5 | import org.andengine.opengl.texture.region.TiledTextureRegion;
6 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
7 |
8 | /**
9 | * (c) 2010 Nicolas Gramlich
10 | * (c) 2011 Zynga Inc.
11 | *
12 | * @author Nicolas Gramlich
13 | * @since 17:13:44 - 09.07.2010
14 | */
15 | public abstract class AnimatedCellEntity extends AnimatedSprite implements SnakeConstants, ICellEntity {
16 | // ===========================================================
17 | // Constants
18 | // ===========================================================
19 |
20 | // ===========================================================
21 | // Fields
22 | // ===========================================================
23 |
24 | protected int mCellX;
25 | protected int mCellY;
26 |
27 | // ===========================================================
28 | // Constructors
29 | // ===========================================================
30 |
31 | public AnimatedCellEntity(final int pCellX, final int pCellY, final int pWidth, final int pHeight, final TiledTextureRegion pTiledTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
32 | super(pCellX * CELL_WIDTH, pCellY * CELL_HEIGHT, pWidth, pHeight, pTiledTextureRegion, pVertexBufferObjectManager);
33 | this.mCellX = pCellX;
34 | this.mCellY = pCellY;
35 | }
36 |
37 | // ===========================================================
38 | // Getter & Setter
39 | // ===========================================================
40 |
41 | public int getCellX() {
42 | return this.mCellX;
43 | }
44 |
45 | public int getCellY() {
46 | return this.mCellY;
47 | }
48 |
49 | public void setCell(final ICellEntity pCellEntity) {
50 | this.setCell(pCellEntity.getCellX(), pCellEntity.getCellY());
51 | }
52 |
53 | public void setCell(final int pCellX, final int pCellY) {
54 | this.mCellX = pCellX;
55 | this.mCellY = pCellY;
56 | this.setPosition(this.mCellX * CELL_WIDTH, this.mCellY * CELL_HEIGHT);
57 | }
58 |
59 | // ===========================================================
60 | // Methods for/from SuperClass/Interfaces
61 | // ===========================================================
62 |
63 | // ===========================================================
64 | // Methods
65 | // ===========================================================
66 |
67 | @Override
68 | public boolean isInSameCell(final ICellEntity pCellEntity) {
69 | return this.mCellX == pCellEntity.getCellX() && this.mCellY == pCellEntity.getCellY();
70 | }
71 |
72 | // ===========================================================
73 | // Inner and Anonymous Classes
74 | // ===========================================================
75 | }
76 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/pong/adt/messages/server/UpdatePaddleServerMessage.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.pong.adt.messages.server;
2 |
3 | import java.io.DataInputStream;
4 | import java.io.DataOutputStream;
5 | import java.io.IOException;
6 |
7 | import org.andengine.examples.game.pong.util.constants.PongConstants;
8 | import org.andengine.extension.multiplayer.protocol.adt.message.server.ServerMessage;
9 |
10 | /**
11 | * (c) 2010 Nicolas Gramlich
12 | * (c) 2011 Zynga Inc.
13 | *
14 | * @author Nicolas Gramlich
15 | * @since 19:48:32 - 28.02.2011
16 | */
17 | public class UpdatePaddleServerMessage extends ServerMessage implements PongConstants {
18 | // ===========================================================
19 | // Constants
20 | // ===========================================================
21 |
22 | // ===========================================================
23 | // Fields
24 | // ===========================================================
25 |
26 | public int mPaddleID;
27 | public float mX;
28 | public float mY;
29 |
30 | // ===========================================================
31 | // Constructors
32 | // ===========================================================
33 |
34 | public UpdatePaddleServerMessage() {
35 |
36 | }
37 |
38 | public UpdatePaddleServerMessage(final int pPaddleID, final float pX, final float pY) {
39 | this.mPaddleID = pPaddleID;
40 | this.mX = pX;
41 | this.mY = pY;
42 | }
43 |
44 | // ===========================================================
45 | // Getter & Setter
46 | // ===========================================================
47 |
48 | public void set(final int pPaddleID, final float pX,final float pY) {
49 | this.mPaddleID = pPaddleID;
50 | this.mX = pX;
51 | this.mY = pY;
52 | }
53 |
54 | // ===========================================================
55 | // Methods for/from SuperClass/Interfaces
56 | // ===========================================================
57 |
58 | @Override
59 | public short getFlag() {
60 | return FLAG_MESSAGE_SERVER_UPDATE_PADDLE;
61 | }
62 |
63 | @Override
64 | protected void onReadTransmissionData(DataInputStream pDataInputStream) throws IOException {
65 | this.mPaddleID = pDataInputStream.readInt();
66 | this.mX = pDataInputStream.readFloat();
67 | this.mY = pDataInputStream.readFloat();
68 | }
69 |
70 | @Override
71 | protected void onWriteTransmissionData(final DataOutputStream pDataOutputStream) throws IOException {
72 | pDataOutputStream.writeInt(this.mPaddleID);
73 | pDataOutputStream.writeFloat(this.mX);
74 | pDataOutputStream.writeFloat(this.mY);
75 | }
76 |
77 | // ===========================================================
78 | // Methods
79 | // ===========================================================
80 |
81 | // ===========================================================
82 | // Inner and Anonymous Classes
83 | // ===========================================================
84 | }
--------------------------------------------------------------------------------
/src/org/andengine/examples/BitmapFontExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.text.Text;
10 | import org.andengine.entity.text.TextOptions;
11 | import org.andengine.entity.util.FPSLogger;
12 | import org.andengine.opengl.font.BitmapFont;
13 | import org.andengine.ui.activity.SimpleBaseGameActivity;
14 | import org.andengine.util.HorizontalAlign;
15 |
16 | /**
17 | * (c) Zynga 2011
18 | *
19 | * @author Nicolas Gramlich
20 | * @since 18:45:46 - 23.12.2011
21 | */
22 | public class BitmapFontExample extends SimpleBaseGameActivity {
23 | // ===========================================================
24 | // Constants
25 | // ===========================================================
26 |
27 | private static final int CAMERA_WIDTH = 720;
28 | private static final int CAMERA_HEIGHT = 480;
29 |
30 | // ===========================================================
31 | // Fields
32 | // ===========================================================
33 |
34 | private BitmapFont mBitmapFont;
35 |
36 | // ===========================================================
37 | // Constructors
38 | // ===========================================================
39 |
40 | // ===========================================================
41 | // Getter & Setter
42 | // ===========================================================
43 |
44 | // ===========================================================
45 | // Methods for/from SuperClass/Interfaces
46 | // ===========================================================
47 |
48 | @Override
49 | public EngineOptions onCreateEngineOptions() {
50 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
51 |
52 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
53 | }
54 |
55 | @Override
56 | public void onCreateResources() {
57 | this.mBitmapFont = new BitmapFont(this.getTextureManager(), this.getAssets(), "font/BitmapFont.fnt");
58 | this.mBitmapFont.load();
59 | }
60 |
61 | @Override
62 | public Scene onCreateScene() {
63 | this.mEngine.registerUpdateHandler(new FPSLogger());
64 |
65 | final Scene scene = new Scene();
66 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
67 |
68 | final Text bitmapText = new Text(160, 230, this.mBitmapFont, "Hello BitmapFont!", new TextOptions(HorizontalAlign.CENTER), this.getVertexBufferObjectManager());
69 |
70 | scene.attachChild(bitmapText);
71 |
72 | return scene;
73 | }
74 |
75 | public void onGameCreated() {
76 |
77 | }
78 |
79 | // ===========================================================
80 | // Methods
81 | // ===========================================================
82 |
83 | // ===========================================================
84 | // Inner and Anonymous Classes
85 | // ===========================================================
86 | }
87 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/AugmentedRealityExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 |
4 | /**
5 | * (c) 2010 Nicolas Gramlich
6 | * (c) 2011 Zynga
7 | *
8 | * @author Nicolas Gramlich
9 | * @since 11:54:51 - 03.04.2010
10 | */
11 | //public class AugmentedRealityExample extends BaseAugmentedRealityGameActivity {
12 | // // ===========================================================
13 | // // Constants
14 | // // ===========================================================
15 | //
16 | // private static final int CAMERA_WIDTH = 720;
17 | // private static final int CAMERA_HEIGHT = 480;
18 | //
19 | // // ===========================================================
20 | // // Fields
21 | // // ===========================================================
22 | //
23 | // private BitmapTextureAtlas mBitmapTextureAtlas;
24 | // private ITextureRegion mFaceTextureRegion;
25 | //
26 | // // ===========================================================
27 | // // Constructors
28 | // // ===========================================================
29 | //
30 | // // ===========================================================
31 | // // Getter & Setter
32 | // // ===========================================================
33 | //
34 | // // ===========================================================
35 | // // Methods for/from SuperClass/Interfaces
36 | // // ===========================================================
37 | //
38 | // @Override
39 | // public EngineOptions onCreateEngineOptions() {
40 | // Toast.makeText(this, "If you don't see a sprite moving over the screen, try starting this while already being in Landscape orientation!!", Toast.LENGTH_LONG).show();
41 | //
42 | // final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
43 | //
44 | // return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
45 | // }
46 | //
47 | // @Override
48 | // public void onCreateResources() {
49 | // BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
50 | //
51 | // this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
52 | // this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
53 | // this.mBitmapTextureAtlas.load();
54 | // }
55 | //
56 | // @Override
57 | // public Scene onCreateScene() {
58 | // this.mEngine.registerUpdateHandler(new FPSLogger());
59 | //
60 | // final Scene scene = new Scene();
61 | // // scene.setBackgroundEnabled(false);
62 | // scene.setBackground(new Background(0.0f, 0.0f, 0.0f, 0.0f));
63 | //
64 | // final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
65 | // final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
66 | // final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion);
67 | // face.registerEntityModifier(new MoveModifier(30, 0, CAMERA_WIDTH - face.getWidth(), 0, CAMERA_HEIGHT - face.getHeight()));
68 | // scene.attachChild(face);
69 | //
70 | // return scene;
71 | // }
72 | //
73 | // // ===========================================================
74 | // // Methods
75 | // // ===========================================================
76 | //
77 | // // ===========================================================
78 | // // Inner and Anonymous Classes
79 | // // ===========================================================
80 | //}
81 |
--------------------------------------------------------------------------------
/scripts/build_spritesheets.sh:
--------------------------------------------------------------------------------
1 | #! /bin/bash
2 |
3 | # Binary of the Texturepacker:
4 | TEXTUREPACKER_BINARY=/usr/local/bin/TexturePacker
5 |
6 | # Shared Spritesheet-Output-Definitions:
7 | SPRITESHEET_OUTPUT_DIRECTORY="../assets/gfx/spritesheets/"
8 | SPRITESHEET_OUTPUT_JAVAIDS_PACKAGE="org.anddev.andengine.examples.spritesheets"
9 | SPRITESHEET_OUTPUT_JAVAIDS_DIRECTORY="../src/org/anddev/andengine/examples/spritesheets/"
10 |
11 | # Shared Spritesheet-Input-Definitions:
12 | SPRITESHEET_INPUT_BASEDIRECTORY="../ext/gfx/spritesheets/"
13 |
14 | # Individual Spritesheet-Definitions (separated by ';'):
15 | # Fragment #1: The input for the spritesheet, relative to ${SPRITESHEET_INPUT_BASEDIRECTORY}
16 | # Fragment #2: The name of the generated spritesheet, relative to ${SPRITESHEET_OUTPUT_DIRECTORY}
17 | # Fragment #3: The filename of the generated java interface that contains the IDs of the textureregions in the generated spritesheet.
18 | SPRITESHEET_INPUT_DATA=(
19 | "texturepackerexample/;texturepackerexample;TexturePackerExampleSpritesheet.java"
20 | )
21 |
22 | ###########################
23 | # Clean old Spritesheets: #
24 | ###########################
25 | echo
26 | echo "#########################################"
27 | echo -n "# Cleaning old spritesheets..."
28 | # TODO rm -f ${SPRITESHEET_OUTPUT_JAVAIDS_DIRECTORY}*.java
29 | rm -f ${SPRITESHEET_OUTPUT_DIRECTORY}*.pvr.ccz
30 | rm -f ${SPRITESHEET_OUTPUT_DIRECTORY}*.xml
31 | echo " done."
32 | echo "#########################################"
33 | echo
34 |
35 | ##############################
36 | # Generate new Spritesheets: #
37 | ##############################
38 | echo "#########################################"
39 | echo "# Generating ${#SPRITESHEET_INPUT_DATA[@]} spritesheets..."
40 | echo "#########################################"
41 | echo
42 |
43 | # Loop over all entries ${SPRITESHEET_INPUT_DATA} to generate one spritesheet for each entry:
44 | i=0
45 | for SPRITESHEET_INPUT_DATA_ENTRY in "${SPRITESHEET_INPUT_DATA[@]}"
46 | do
47 | echo "#########################################"
48 | i=`expr $i + 1`
49 | echo "# Generating spritesheet $i of ${#SPRITESHEET_INPUT_DATA[@]} ..."
50 | echo "#"
51 |
52 | # Split fragments of ${SPRITESHEET_INPUT_DATA_ENTRY} into ${SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT}
53 | IFS=\; read -a SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT <<< "$SPRITESHEET_INPUT_DATA_ENTRY"
54 |
55 | # Generate spritesheets
56 | ${TEXTUREPACKER_BINARY} ${SPRITESHEET_INPUT_BASEDIRECTORY}${SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT[0]}*.png \
57 | --format andengine \
58 | --opt RGBA4444 \
59 | --border-padding 0 \
60 | --shape-padding 1 \
61 | --disable-rotation \
62 | --no-trim \
63 | --max-width 1024 \
64 | --max-height 1024 \
65 | --allow-free-size \
66 | --andengine-wraps clamp \
67 | --andengine-wrapt clamp \
68 | --andengine-minfilter linear \
69 | --andengine-magfilter linear \
70 | --data ${SPRITESHEET_OUTPUT_DIRECTORY}${SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT[1]}.xml \
71 | --sheet ${SPRITESHEET_OUTPUT_DIRECTORY}${SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT[1]}.pvr.ccz \
72 | --andengine-java ${SPRITESHEET_OUTPUT_JAVAIDS_DIRECTORY}${SPRITESHEET_INPUT_DATA_ENTRY_FRAGMENT[2]} \
73 | --andengine-packagename ${SPRITESHEET_OUTPUT_JAVAIDS_PACKAGE}
74 | echo "#"
75 | echo "# done."
76 | echo "#########################################"
77 | echo
78 | done
79 | echo "#########################################"
80 | echo "# done."
81 | echo "#########################################"
82 | echo
83 |
84 | exit 0
--------------------------------------------------------------------------------
/src/org/andengine/examples/LineExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import java.util.Random;
4 |
5 | import org.andengine.engine.camera.Camera;
6 | import org.andengine.engine.options.EngineOptions;
7 | import org.andengine.engine.options.ScreenOrientation;
8 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
9 | import org.andengine.entity.primitive.Line;
10 | import org.andengine.entity.scene.Scene;
11 | import org.andengine.entity.scene.background.Background;
12 | import org.andengine.entity.util.FPSLogger;
13 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
14 | import org.andengine.ui.activity.SimpleBaseGameActivity;
15 |
16 | /**
17 | * (c) 2010 Nicolas Gramlich
18 | * (c) 2011 Zynga Inc.
19 | *
20 | * @author Nicolas Gramlich
21 | * @since 11:54:51 - 03.04.2010
22 | */
23 | public class LineExample extends SimpleBaseGameActivity {
24 | // ===========================================================
25 | // Constants
26 | // ===========================================================
27 |
28 | /* Initializing the Random generator produces a comparable result over different versions. */
29 | private static final long RANDOM_SEED = 1234567890;
30 |
31 | private static final int CAMERA_WIDTH = 720;
32 | private static final int CAMERA_HEIGHT = 480;
33 |
34 | private static final int LINE_COUNT = 100;
35 |
36 | // ===========================================================
37 | // Fields
38 | // ===========================================================
39 |
40 | // ===========================================================
41 | // Constructors
42 | // ===========================================================
43 |
44 | // ===========================================================
45 | // Getter & Setter
46 | // ===========================================================
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public EngineOptions onCreateEngineOptions() {
54 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
55 |
56 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
57 | }
58 |
59 | @Override
60 | public void onCreateResources() {
61 |
62 | }
63 |
64 | @Override
65 | public Scene onCreateScene() {
66 | this.mEngine.registerUpdateHandler(new FPSLogger());
67 |
68 | final Scene scene = new Scene();
69 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
70 |
71 | final Random random = new Random(RANDOM_SEED);
72 |
73 | final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
74 | for(int i = 0; i < LINE_COUNT; i++) {
75 | final float x1 = random.nextFloat() * CAMERA_WIDTH;
76 | final float x2 = random.nextFloat() * CAMERA_WIDTH;
77 | final float y1 = random.nextFloat() * CAMERA_HEIGHT;
78 | final float y2 = random.nextFloat() * CAMERA_HEIGHT;
79 | final float lineWidth = random.nextFloat() * 5;
80 |
81 | final Line line = new Line(x1, y1, x2, y2, lineWidth, vertexBufferObjectManager);
82 |
83 | line.setColor(random.nextFloat(), random.nextFloat(), random.nextFloat());
84 |
85 | scene.attachChild(line);
86 | }
87 |
88 | return scene;
89 | }
90 |
91 | // ===========================================================
92 | // Methods
93 | // ===========================================================
94 |
95 | // ===========================================================
96 | // Inner and Anonymous Classes
97 | // ===========================================================
98 | }
99 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/AugmentedRealityHorizonExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 |
4 | /**
5 | * (c) 2010 Nicolas Gramlich
6 | * (c) 2011 Zynga
7 | *
8 | * @author Nicolas Gramlich
9 | * @since 11:54:51 - 03.04.2010
10 | */
11 | //public class AugmentedRealityHorizonExample extends BaseAugmentedRealityGameActivity implements IOrientationListener {
12 | // // ===========================================================
13 | // // Constants
14 | // // ===========================================================
15 | //
16 | // private static final int CAMERA_WIDTH = 720;
17 | // private static final int CAMERA_HEIGHT = 480;
18 | //
19 | // // ===========================================================
20 | // // Fields
21 | // // ===========================================================
22 | //
23 | // private BitmapTextureAtlas mBitmapTextureAtlas;
24 | // private ITextureRegion mFaceTextureRegion;
25 | // private Sprite mFace;
26 | //
27 | // // ===========================================================
28 | // // Constructors
29 | // // ===========================================================
30 | //
31 | // // ===========================================================
32 | // // Getter & Setter
33 | // // ===========================================================
34 | //
35 | // // ===========================================================
36 | // // Methods for/from SuperClass/Interfaces
37 | // // ===========================================================
38 | //
39 | // @Override
40 | // public EngineOptions onCreateEngineOptions() {
41 | // Toast.makeText(this, "If you don't see a sprite moving over the screen, try starting this while already being in Landscape orientation!!", Toast.LENGTH_LONG).show();
42 | //
43 | // final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
44 | //
45 | // return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
46 | // }
47 | //
48 | // @Override
49 | // public void onCreateResources() {
50 | // BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
51 | //
52 | // this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
53 | // this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
54 | // this.mBitmapTextureAtlas.load();
55 | // }
56 | //
57 | // @Override
58 | // public Scene onCreateScene() {
59 | // this.mEngine.registerUpdateHandler(new FPSLogger());
60 | // final Scene scene = new Scene();
61 | // // scene.setBackgroundEnabled(false);
62 | // scene.setBackground(new Background(0.0f, 0.0f, 0.0f, 0.0f));
63 | //
64 | // final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
65 | // final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
66 | // this.mFace = new Sprite(centerX, centerY, this.mFaceTextureRegion);
67 | // scene.attachChild(this.mFace);
68 | //
69 | // return scene;
70 | // }
71 | //
72 | // @Override
73 | // public void onGameCreated() {
74 | // this.enableOrientationSensor(this);
75 | // }
76 | //
77 | // @Override
78 | // public void onOrientationChanged(final OrientationData pOrientationData) {
79 | // final float roll = pOrientationData.getRoll();
80 | // Debug.d("Roll: " + pOrientationData.getRoll());
81 | //
82 | // this.mFace.setPosition(CAMERA_WIDTH / 2, CAMERA_HEIGHT / 2 + (roll - 40) * 5);
83 | // }
84 | //
85 | // // ===========================================================
86 | // // Methods
87 | // // ===========================================================
88 | //
89 | // // ===========================================================
90 | // // Inner and Anonymous Classes
91 | // // ===========================================================
92 | //}
93 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/TextExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.text.Text;
10 | import org.andengine.entity.text.TextOptions;
11 | import org.andengine.entity.util.FPSLogger;
12 | import org.andengine.opengl.font.Font;
13 | import org.andengine.opengl.font.FontFactory;
14 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
15 | import org.andengine.ui.activity.SimpleBaseGameActivity;
16 | import org.andengine.util.HorizontalAlign;
17 |
18 | import android.graphics.Typeface;
19 |
20 | /**
21 | * (c) 2010 Nicolas Gramlich
22 | * (c) 2011 Zynga
23 | *
24 | * @author Nicolas Gramlich
25 | * @since 11:54:51 - 03.04.2010
26 | */
27 | public class TextExample extends SimpleBaseGameActivity {
28 | // ===========================================================
29 | // Constants
30 | // ===========================================================
31 |
32 | private static final int CAMERA_WIDTH = 720;
33 | private static final int CAMERA_HEIGHT = 480;
34 |
35 | // ===========================================================
36 | // Fields
37 | // ===========================================================
38 |
39 | private Font mFont;
40 |
41 | // ===========================================================
42 | // Constructors
43 | // ===========================================================
44 |
45 | // ===========================================================
46 | // Getter & Setter
47 | // ===========================================================
48 |
49 | // ===========================================================
50 | // Methods for/from SuperClass/Interfaces
51 | // ===========================================================
52 |
53 | @Override
54 | public EngineOptions onCreateEngineOptions() {
55 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
56 |
57 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
58 | }
59 |
60 | @Override
61 | public void onCreateResources() {
62 | this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
63 | this.mFont.load();
64 | }
65 |
66 | @Override
67 | public Scene onCreateScene() {
68 | this.mEngine.registerUpdateHandler(new FPSLogger());
69 |
70 | final Scene scene = new Scene();
71 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
72 |
73 | final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
74 | final Text centerText = new Text(100, 40, this.mFont, "Hello AndEngine!\nYou can even have multilined text!", new TextOptions(HorizontalAlign.CENTER), vertexBufferObjectManager);
75 | final Text leftText = new Text(100, 170, this.mFont, "Also left aligned!\nLorem ipsum dolor sit amat...", new TextOptions(HorizontalAlign.LEFT), vertexBufferObjectManager);
76 | final Text rightText = new Text(100, 300, this.mFont, "And right aligned!\nLorem ipsum dolor sit amat...", new TextOptions(HorizontalAlign.RIGHT), vertexBufferObjectManager);
77 |
78 | scene.attachChild(centerText);
79 | scene.attachChild(leftText);
80 | scene.attachChild(rightText);
81 |
82 | return scene;
83 | }
84 |
85 | // ===========================================================
86 | // Methods
87 | // ===========================================================
88 |
89 | // ===========================================================
90 | // Inner and Anonymous Classes
91 | // ===========================================================
92 | }
93 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/ChangeableTextExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.handler.timer.ITimerCallback;
5 | import org.andengine.engine.handler.timer.TimerHandler;
6 | import org.andengine.engine.options.EngineOptions;
7 | import org.andengine.engine.options.ScreenOrientation;
8 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
9 | import org.andengine.entity.scene.Scene;
10 | import org.andengine.entity.scene.background.Background;
11 | import org.andengine.entity.text.Text;
12 | import org.andengine.entity.util.FPSCounter;
13 | import org.andengine.opengl.font.Font;
14 | import org.andengine.opengl.font.FontFactory;
15 | import org.andengine.opengl.texture.TextureOptions;
16 | import org.andengine.ui.activity.SimpleBaseGameActivity;
17 |
18 | import android.graphics.Typeface;
19 |
20 | /**
21 | * (c) 2010 Nicolas Gramlich
22 | * (c) 2011 Zynga
23 | *
24 | * @author Nicolas Gramlich
25 | * @since 20:06:15 - 08.07.2010
26 | */
27 | public class ChangeableTextExample extends SimpleBaseGameActivity {
28 | // ===========================================================
29 | // Constants
30 | // ===========================================================
31 |
32 | private static final int CAMERA_WIDTH = 720;
33 | private static final int CAMERA_HEIGHT = 480;
34 |
35 | // ===========================================================
36 | // Fields
37 | // ===========================================================
38 |
39 | private Font mFont;
40 |
41 | // ===========================================================
42 | // Constructors
43 | // ===========================================================
44 |
45 | // ===========================================================
46 | // Getter & Setter
47 | // ===========================================================
48 |
49 | // ===========================================================
50 | // Methods for/from SuperClass/Interfaces
51 | // ===========================================================
52 |
53 | @Override
54 | public EngineOptions onCreateEngineOptions() {
55 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
56 |
57 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
58 | }
59 |
60 | @Override
61 | public void onCreateResources() {
62 | this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 48);
63 | this.mFont.load();
64 | }
65 |
66 | @Override
67 | public Scene onCreateScene() {
68 | final FPSCounter fpsCounter = new FPSCounter();
69 | this.mEngine.registerUpdateHandler(fpsCounter);
70 |
71 | final Scene scene = new Scene();
72 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
73 |
74 | final Text elapsedText = new Text(100, 160, this.mFont, "Seconds elapsed:", "Seconds elapsed: XXXXX".length(), this.getVertexBufferObjectManager());
75 | final Text fpsText = new Text(250, 240, this.mFont, "FPS:", "FPS: XXXXX".length(), this.getVertexBufferObjectManager());
76 |
77 | scene.attachChild(elapsedText);
78 | scene.attachChild(fpsText);
79 |
80 | scene.registerUpdateHandler(new TimerHandler(1 / 20.0f, true, new ITimerCallback() {
81 | @Override
82 | public void onTimePassed(final TimerHandler pTimerHandler) {
83 | elapsedText.setText("Seconds elapsed: " + ChangeableTextExample.this.mEngine.getSecondsElapsedTotal());
84 | fpsText.setText("FPS: " + fpsCounter.getFPS());
85 | }
86 | }));
87 |
88 | return scene;
89 | }
90 |
91 | // ===========================================================
92 | // Methods
93 | // ===========================================================
94 |
95 | // ===========================================================
96 | // Inner and Anonymous Classes
97 | // ===========================================================
98 | }
99 |
--------------------------------------------------------------------------------
/ext/img/particle_halo.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
113 |
--------------------------------------------------------------------------------
/ext/img/snake_tailpart.svg:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
113 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/SpriteExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import java.io.IOException;
4 | import java.io.InputStream;
5 |
6 | import org.andengine.engine.camera.Camera;
7 | import org.andengine.engine.options.EngineOptions;
8 | import org.andengine.engine.options.ScreenOrientation;
9 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
10 | import org.andengine.entity.scene.Scene;
11 | import org.andengine.entity.scene.background.Background;
12 | import org.andengine.entity.sprite.Sprite;
13 | import org.andengine.entity.util.FPSLogger;
14 | import org.andengine.opengl.texture.ITexture;
15 | import org.andengine.opengl.texture.bitmap.BitmapTexture;
16 | import org.andengine.opengl.texture.region.ITextureRegion;
17 | import org.andengine.opengl.texture.region.TextureRegionFactory;
18 | import org.andengine.ui.activity.SimpleBaseGameActivity;
19 | import org.andengine.util.adt.io.in.IInputStreamOpener;
20 | import org.andengine.util.debug.Debug;
21 |
22 | /**
23 | * (c) 2010 Nicolas Gramlich
24 | * (c) 2011 Zynga
25 | *
26 | * @author Nicolas Gramlich
27 | * @since 11:54:51 - 03.04.2010
28 | */
29 | public class SpriteExample extends SimpleBaseGameActivity {
30 | // ===========================================================
31 | // Constants
32 | // ===========================================================
33 |
34 | private static final int CAMERA_WIDTH = 720;
35 | private static final int CAMERA_HEIGHT = 480;
36 |
37 | // ===========================================================
38 | // Fields
39 | // ===========================================================
40 |
41 | private ITexture mTexture;
42 | private ITextureRegion mFaceTextureRegion;
43 |
44 | // ===========================================================
45 | // Constructors
46 | // ===========================================================
47 |
48 | // ===========================================================
49 | // Getter & Setter
50 | // ===========================================================
51 |
52 | // ===========================================================
53 | // Methods for/from SuperClass/Interfaces
54 | // ===========================================================
55 |
56 | @Override
57 | public EngineOptions onCreateEngineOptions() {
58 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
59 |
60 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
61 | }
62 |
63 | @Override
64 | public void onCreateResources() {
65 | try {
66 | this.mTexture = new BitmapTexture(this.getTextureManager(), new IInputStreamOpener() {
67 | @Override
68 | public InputStream open() throws IOException {
69 | return getAssets().open("gfx/face_box.png");
70 | }
71 | });
72 |
73 | this.mTexture.load();
74 | this.mFaceTextureRegion = TextureRegionFactory.extractFromTexture(this.mTexture);
75 | } catch (IOException e) {
76 | Debug.e(e);
77 | }
78 | }
79 |
80 | @Override
81 | public Scene onCreateScene() {
82 | this.mEngine.registerUpdateHandler(new FPSLogger());
83 |
84 | final Scene scene = new Scene();
85 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
86 |
87 | /* Calculate the coordinates for the face, so its centered on the camera. */
88 | final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
89 | final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
90 |
91 | /* Create the face and add it to the scene. */
92 | final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
93 | scene.attachChild(face);
94 |
95 | return scene;
96 | }
97 |
98 | // ===========================================================
99 | // Methods
100 | // ===========================================================
101 |
102 | // ===========================================================
103 | // Inner and Anonymous Classes
104 | // ===========================================================
105 | }
106 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/benchmark/TickerTextBenchmark.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.benchmark;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.text.Text;
10 | import org.andengine.entity.text.TickerText;
11 | import org.andengine.entity.text.TickerText.TickerTextOptions;
12 | import org.andengine.opengl.font.Font;
13 | import org.andengine.opengl.font.FontFactory;
14 | import org.andengine.opengl.texture.TextureOptions;
15 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
16 |
17 | import android.graphics.Color;
18 | import android.graphics.Typeface;
19 |
20 | /**
21 | * (c) 2010 Nicolas Gramlich
22 | * (c) 2011 Zynga
23 | *
24 | * @author Nicolas Gramlich
25 | * @since 21:00:56 - 28.06.2010
26 | */
27 | public class TickerTextBenchmark extends BaseBenchmark {
28 | // ===========================================================
29 | // Constants
30 | // ===========================================================
31 |
32 | private static final int CAMERA_WIDTH = 720;
33 | private static final int CAMERA_HEIGHT = 480;
34 |
35 | private static final int TEXT_COUNT = 200;
36 |
37 | // ===========================================================
38 | // Fields
39 | // ===========================================================
40 |
41 | private Font mFont;
42 |
43 | // ===========================================================
44 | // Constructors
45 | // ===========================================================
46 |
47 | // ===========================================================
48 | // Getter & Setter
49 | // ===========================================================
50 |
51 | // ===========================================================
52 | // Methods for/from SuperClass/Interfaces
53 | // ===========================================================
54 |
55 | @Override
56 | protected int getBenchmarkID() {
57 | return TICKERTEXTBENCHMARK_ID;
58 | }
59 |
60 | @Override
61 | protected float getBenchmarkStartOffset() {
62 | return 2;
63 | }
64 |
65 | @Override
66 | protected float getBenchmarkDuration() {
67 | return 10;
68 | }
69 |
70 | @Override
71 | public EngineOptions onCreateEngineOptions() {
72 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
73 |
74 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
75 | }
76 |
77 | @Override
78 | public void onCreateResources() {
79 | Typeface typeface = Typeface.create(Typeface.DEFAULT, Typeface.BOLD);
80 | this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, TextureOptions.BILINEAR_PREMULTIPLYALPHA, typeface, 22, true, Color.WHITE);
81 | this.mFont.load();
82 | }
83 |
84 | @Override
85 | public Scene onCreateScene() {
86 | final Scene scene = new Scene();
87 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
88 |
89 | final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
90 | for(int i = 0; i < TEXT_COUNT; i++) {
91 | final Text text = new TickerText(this.mRandom.nextInt(30), this.mRandom.nextFloat() * (CAMERA_HEIGHT - 20), this.mFont, "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ", new TickerTextOptions(5 + 5 * this.mRandom.nextFloat()), vertexBufferObjectManager);
92 | text.setColor(this.mRandom.nextFloat(), this.mRandom.nextFloat(), this.mRandom.nextFloat());
93 | scene.attachChild(text);
94 | }
95 |
96 | return scene;
97 | }
98 |
99 | // ===========================================================
100 | // Methods
101 | // ===========================================================
102 |
103 | // ===========================================================
104 | // Inner and Anonymous Classes
105 | // ===========================================================
106 | }
107 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/SubMenuExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.entity.scene.menu.MenuScene;
4 | import org.andengine.entity.scene.menu.animator.SlideMenuAnimator;
5 | import org.andengine.entity.scene.menu.item.IMenuItem;
6 | import org.andengine.entity.scene.menu.item.SpriteMenuItem;
7 | import org.andengine.opengl.texture.TextureOptions;
8 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
9 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
10 | import org.andengine.opengl.texture.region.ITextureRegion;
11 |
12 |
13 | /**
14 | * (c) 2010 Nicolas Gramlich
15 | * (c) 2011 Zynga
16 | *
17 | * @author Nicolas Gramlich
18 | * @since 11:33:33 - 01.04.2010
19 | */
20 | public class SubMenuExample extends MenuExample {
21 | // ===========================================================
22 | // Constants
23 | // ===========================================================
24 |
25 | private static final int MENU_QUIT_OK = MenuExample.MENU_QUIT + 1;
26 | private static final int MENU_QUIT_BACK = MENU_QUIT_OK + 1;
27 |
28 | // ===========================================================
29 | // Fields
30 | // ===========================================================
31 |
32 | private MenuScene mSubMenuScene;
33 |
34 | private BitmapTextureAtlas mSubMenuTexture;
35 | private ITextureRegion mMenuOkTextureRegion;
36 | private ITextureRegion mMenuBackTextureRegion;
37 |
38 | // ===========================================================
39 | // Constructors
40 | // ===========================================================
41 |
42 | // ===========================================================
43 | // Getter & Setter
44 | // ===========================================================
45 |
46 | // ===========================================================
47 | // Methods for/from SuperClass/Interfaces
48 | // ===========================================================
49 |
50 | @Override
51 | public void onCreateResources() {
52 | super.onCreateResources();
53 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
54 |
55 | this.mSubMenuTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 128, TextureOptions.BILINEAR);
56 | this.mMenuOkTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mSubMenuTexture, this, "menu_ok.png", 0, 0);
57 | this.mMenuBackTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mSubMenuTexture, this, "menu_back.png", 0, 50);
58 | this.mSubMenuTexture.load();
59 | }
60 |
61 | @Override
62 | protected void createMenuScene() {
63 | super.createMenuScene();
64 |
65 | this.mSubMenuScene = new MenuScene(this.mCamera);
66 | this.mSubMenuScene.addMenuItem(new SpriteMenuItem(MENU_QUIT_OK, this.mMenuOkTextureRegion, this.getVertexBufferObjectManager()));
67 | this.mSubMenuScene.addMenuItem(new SpriteMenuItem(MENU_QUIT_BACK, this.mMenuBackTextureRegion, this.getVertexBufferObjectManager()));
68 | this.mSubMenuScene.setMenuAnimator(new SlideMenuAnimator());
69 | this.mSubMenuScene.buildAnimations();
70 |
71 | this.mSubMenuScene.setBackgroundEnabled(false);
72 |
73 | this.mSubMenuScene.setOnMenuItemClickListener(this);
74 | }
75 |
76 | @Override
77 | public boolean onMenuItemClicked(final MenuScene pMenuScene, final IMenuItem pMenuItem, final float pMenuItemLocalX, final float pMenuItemLocalY) {
78 | switch(pMenuItem.getID()) {
79 | case MENU_RESET:
80 | this.mMainScene.reset();
81 |
82 | this.mMenuScene.back();
83 | return true;
84 | case MENU_QUIT:
85 | pMenuScene.setChildSceneModal(this.mSubMenuScene);
86 | return true;
87 | case MENU_QUIT_BACK:
88 | this.mSubMenuScene.back();
89 | return true;
90 | case MENU_QUIT_OK:
91 | this.finish();
92 | return true;
93 | default:
94 | return false;
95 | }
96 | }
97 |
98 | // ===========================================================
99 | // Methods
100 | // ===========================================================
101 |
102 | // ===========================================================
103 | // Inner and Anonymous Classes
104 | // ===========================================================
105 | }
106 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/TickerTextExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.modifier.AlphaModifier;
8 | import org.andengine.entity.modifier.ParallelEntityModifier;
9 | import org.andengine.entity.modifier.RotationModifier;
10 | import org.andengine.entity.modifier.ScaleModifier;
11 | import org.andengine.entity.modifier.SequenceEntityModifier;
12 | import org.andengine.entity.scene.Scene;
13 | import org.andengine.entity.scene.background.Background;
14 | import org.andengine.entity.text.Text;
15 | import org.andengine.entity.text.TickerText;
16 | import org.andengine.entity.text.TickerText.TickerTextOptions;
17 | import org.andengine.entity.util.FPSLogger;
18 | import org.andengine.opengl.font.Font;
19 | import org.andengine.opengl.font.FontFactory;
20 | import org.andengine.opengl.texture.TextureOptions;
21 | import org.andengine.ui.activity.SimpleBaseGameActivity;
22 | import org.andengine.util.HorizontalAlign;
23 |
24 | import android.graphics.Typeface;
25 | import android.opengl.GLES20;
26 |
27 | /**
28 | * (c) 2010 Nicolas Gramlich
29 | * (c) 2011 Zynga
30 | *
31 | * @author Nicolas Gramlich
32 | * @since 11:54:51 - 03.04.2010
33 | */
34 | public class TickerTextExample extends SimpleBaseGameActivity {
35 | // ===========================================================
36 | // Constants
37 | // ===========================================================
38 |
39 | private static final int CAMERA_WIDTH = 720;
40 | private static final int CAMERA_HEIGHT = 480;
41 |
42 | // ===========================================================
43 | // Fields
44 | // ===========================================================
45 |
46 | private Font mFont;
47 |
48 | // ===========================================================
49 | // Constructors
50 | // ===========================================================
51 |
52 | // ===========================================================
53 | // Getter & Setter
54 | // ===========================================================
55 |
56 | // ===========================================================
57 | // Methods for/from SuperClass/Interfaces
58 | // ===========================================================
59 |
60 | @Override
61 | public EngineOptions onCreateEngineOptions() {
62 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
63 |
64 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
65 | }
66 |
67 | @Override
68 | public void onCreateResources() {
69 | this.mFont = FontFactory.create(this.getFontManager(), this.getTextureManager(), 256, 256, TextureOptions.BILINEAR, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), 32);
70 | this.mFont.load();
71 | }
72 |
73 | @Override
74 | public Scene onCreateScene() {
75 | this.mEngine.registerUpdateHandler(new FPSLogger());
76 |
77 | final Scene scene = new Scene();
78 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
79 |
80 | final Text text = new TickerText(30, 60, this.mFont, "There are also ticker texts!\n\nYou'll see the answer to life & universe in...\n\n5 4 3 2 1...\n\n42\n\nIndeed very funny!", new TickerTextOptions(HorizontalAlign.CENTER, 10), this.getVertexBufferObjectManager());
81 | text.registerEntityModifier(
82 | new SequenceEntityModifier(
83 | new ParallelEntityModifier(
84 | new AlphaModifier(10, 0.0f, 1.0f),
85 | new ScaleModifier(10, 0.5f, 1.0f)
86 | ),
87 | new RotationModifier(5, 0, 360)
88 | )
89 | );
90 | text.setBlendFunction(GLES20.GL_SRC_ALPHA, GLES20.GL_ONE_MINUS_SRC_ALPHA);
91 | scene.attachChild(text);
92 |
93 | return scene;
94 | }
95 |
96 | // ===========================================================
97 | // Methods
98 | // ===========================================================
99 |
100 | // ===========================================================
101 | // Inner and Anonymous Classes
102 | // ===========================================================
103 | }
104 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/TexturePackerExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.sprite.Sprite;
10 | import org.andengine.entity.util.FPSLogger;
11 | import org.andengine.examples.spritesheets.TexturePackerExampleSpritesheet;
12 | import org.andengine.extension.texturepacker.opengl.texture.util.texturepacker.TexturePack;
13 | import org.andengine.extension.texturepacker.opengl.texture.util.texturepacker.TexturePackLoader;
14 | import org.andengine.extension.texturepacker.opengl.texture.util.texturepacker.TexturePackTextureRegionLibrary;
15 | import org.andengine.extension.texturepacker.opengl.texture.util.texturepacker.exception.TexturePackParseException;
16 | import org.andengine.opengl.texture.region.TextureRegion;
17 | import org.andengine.ui.activity.SimpleBaseGameActivity;
18 | import org.andengine.util.debug.Debug;
19 |
20 | /**
21 | * (c) 2011 Zynga
22 | *
23 | * @author Nicolas Gramlich
24 | * @since 9:55:51 - 02.08.2011
25 | */
26 | public class TexturePackerExample extends SimpleBaseGameActivity {
27 | // ===========================================================
28 | // Constants
29 | // ===========================================================
30 |
31 | private static final int CAMERA_WIDTH = 720;
32 | private static final int CAMERA_HEIGHT = 480;
33 |
34 | // ===========================================================
35 | // Fields
36 | // ===========================================================
37 |
38 | private TexturePackTextureRegionLibrary mSpritesheetTexturePackTextureRegionLibrary;
39 |
40 | // ===========================================================
41 | // Constructors
42 | // ===========================================================
43 |
44 | // ===========================================================
45 | // Getter & Setter
46 | // ===========================================================
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public EngineOptions onCreateEngineOptions() {
54 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
55 |
56 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
57 | }
58 |
59 | @Override
60 | public void onCreateResources() {
61 | try {
62 | final TexturePack spritesheetTexturePack = new TexturePackLoader(this.getTextureManager(), "gfx/spritesheets/").loadFromAsset(this.getAssets(), "texturepackerexample.xml");
63 | spritesheetTexturePack.loadTexture();
64 | this.mSpritesheetTexturePackTextureRegionLibrary = spritesheetTexturePack.getTexturePackTextureRegionLibrary();
65 | } catch (final TexturePackParseException e) {
66 | Debug.e(e);
67 | }
68 | }
69 |
70 | @Override
71 | public Scene onCreateScene() {
72 | this.mEngine.registerUpdateHandler(new FPSLogger());
73 |
74 | final Scene scene = new Scene();
75 | scene.setBackground(new Background(1, 1, 1));
76 |
77 | TextureRegion faceTextureRegion = this.mSpritesheetTexturePackTextureRegionLibrary.get(TexturePackerExampleSpritesheet.FACE_BOX_ID);
78 | /* Calculate the coordinates for the face, so its centered on the camera. */
79 | final float centerX = (CAMERA_WIDTH - faceTextureRegion.getWidth()) / 2;
80 | final float centerY = (CAMERA_HEIGHT - faceTextureRegion.getHeight()) / 2;
81 |
82 | /* Create the face and add it to the scene. */
83 | Sprite entity = new Sprite(centerX, centerY, faceTextureRegion, this.getVertexBufferObjectManager());
84 | entity.setScale(20);
85 | scene.attachChild(entity);
86 |
87 | return scene;
88 | }
89 |
90 | // ===========================================================
91 | // Methods
92 | // ===========================================================
93 |
94 | // ===========================================================
95 | // Inner and Anonymous Classes
96 | // ===========================================================
97 | }
98 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/TouchDragExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.sprite.Sprite;
10 | import org.andengine.entity.util.FPSLogger;
11 | import org.andengine.input.touch.TouchEvent;
12 | import org.andengine.opengl.texture.TextureOptions;
13 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
14 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
15 | import org.andengine.opengl.texture.region.ITextureRegion;
16 | import org.andengine.ui.activity.SimpleBaseGameActivity;
17 |
18 | import android.widget.Toast;
19 |
20 | /**
21 | * (c) 2010 Nicolas Gramlich
22 | * (c) 2011 Zynga
23 | *
24 | * @author Nicolas Gramlich
25 | * @since 15:13:46 - 15.06.2010
26 | */
27 | public class TouchDragExample extends SimpleBaseGameActivity {
28 | // ===========================================================
29 | // Constants
30 | // ===========================================================
31 |
32 | private static final int CAMERA_WIDTH = 720;
33 | private static final int CAMERA_HEIGHT = 480;
34 |
35 | // ===========================================================
36 | // Fields
37 | // ===========================================================
38 |
39 | private BitmapTextureAtlas mBitmapTextureAtlas;
40 | private ITextureRegion mFaceTextureRegion;
41 |
42 | // ===========================================================
43 | // Constructors
44 | // ===========================================================
45 |
46 | // ===========================================================
47 | // Getter & Setter
48 | // ===========================================================
49 |
50 | // ===========================================================
51 | // Methods for/from SuperClass/Interfaces
52 | // ===========================================================
53 |
54 | @Override
55 | public EngineOptions onCreateEngineOptions() {
56 | Toast.makeText(this, "Touch & Drag the face!", Toast.LENGTH_LONG).show();
57 |
58 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
59 |
60 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
61 | }
62 |
63 | @Override
64 | public void onCreateResources() {
65 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
66 |
67 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
68 | this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
69 | this.mBitmapTextureAtlas.load();
70 | }
71 |
72 | @Override
73 | public Scene onCreateScene() {
74 | this.mEngine.registerUpdateHandler(new FPSLogger());
75 |
76 | final Scene scene = new Scene();
77 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
78 |
79 | final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
80 | final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
81 | final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager()) {
82 | @Override
83 | public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
84 | this.setPosition(pSceneTouchEvent.getX() - this.getWidth() / 2, pSceneTouchEvent.getY() - this.getHeight() / 2);
85 | return true;
86 | }
87 | };
88 | face.setScale(4);
89 | scene.attachChild(face);
90 | scene.registerTouchArea(face);
91 | scene.setTouchAreaBindingOnActionDownEnabled(true);
92 |
93 | return scene;
94 | }
95 |
96 | // ===========================================================
97 | // Methods
98 | // ===========================================================
99 |
100 | // ===========================================================
101 | // Inner and Anonymous Classes
102 | // ===========================================================
103 | }
104 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/adt/card/Card.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.adt.card;
2 |
3 | /**
4 | * (c) 2010 Nicolas Gramlich
5 | * (c) 2011 Zynga Inc.
6 | *
7 | * @author Nicolas Gramlich
8 | * @since 18:59:13 - 18.06.2010
9 | */
10 | public enum Card {
11 | // ===========================================================
12 | // Elements
13 | // ===========================================================
14 |
15 | CLUB_ACE(Color.CLUB, Value.ACE),
16 | CLUB_ONE(Color.CLUB, Value.ONE),
17 | CLUB_TWO(Color.CLUB, Value.TWO),
18 | CLUB_THREE(Color.CLUB, Value.THREE),
19 | CLUB_FOUR(Color.CLUB, Value.FOUR),
20 | CLUB_FIVE(Color.CLUB, Value.FIVE),
21 | CLUB_SIX(Color.CLUB, Value.SIX),
22 | CLUB_SEVEN(Color.CLUB, Value.SEVEN),
23 | CLUB_EIGHT(Color.CLUB, Value.EIGHT),
24 | CLUB_NINE(Color.CLUB, Value.NINE),
25 | CLUB_TEN(Color.CLUB, Value.TEN),
26 | CLUB_JACK(Color.CLUB, Value.JACK),
27 | CLUB_QUEEN(Color.CLUB, Value.QUEEN),
28 | CLUB_KING(Color.CLUB, Value.KING),
29 |
30 | DIAMOND_ACE(Color.DIAMOND, Value.ACE),
31 | DIAMOND_ONE(Color.DIAMOND, Value.ONE),
32 | DIAMOND_TWO(Color.DIAMOND, Value.TWO),
33 | DIAMOND_THREE(Color.DIAMOND, Value.THREE),
34 | DIAMOND_FOUR(Color.DIAMOND, Value.FOUR),
35 | DIAMOND_FIVE(Color.DIAMOND, Value.FIVE),
36 | DIAMOND_SIX(Color.DIAMOND, Value.SIX),
37 | DIAMOND_SEVEN(Color.DIAMOND, Value.SEVEN),
38 | DIAMOND_EIGHT(Color.DIAMOND, Value.EIGHT),
39 | DIAMOND_NINE(Color.DIAMOND, Value.NINE),
40 | DIAMOND_TEN(Color.DIAMOND, Value.TEN),
41 | DIAMOND_JACK(Color.DIAMOND, Value.JACK),
42 | DIAMOND_QUEEN(Color.DIAMOND, Value.QUEEN),
43 | DIAMOND_KING(Color.DIAMOND, Value.KING),
44 |
45 | HEART_ACE(Color.HEART, Value.ACE),
46 | HEART_ONE(Color.HEART, Value.ONE),
47 | HEART_TWO(Color.HEART, Value.TWO),
48 | HEART_THREE(Color.HEART, Value.THREE),
49 | HEART_FOUR(Color.HEART, Value.FOUR),
50 | HEART_FIVE(Color.HEART, Value.FIVE),
51 | HEART_SIX(Color.HEART, Value.SIX),
52 | HEART_SEVEN(Color.HEART, Value.SEVEN),
53 | HEART_EIGHT(Color.HEART, Value.EIGHT),
54 | HEART_NINE(Color.HEART, Value.NINE),
55 | HEART_TEN(Color.HEART, Value.TEN),
56 | HEART_JACK(Color.HEART, Value.JACK),
57 | HEART_QUEEN(Color.HEART, Value.QUEEN),
58 | HEART_KING(Color.HEART, Value.KING),
59 |
60 | SPADE_ACE(Color.SPADE, Value.ACE),
61 | SPADE_ONE(Color.SPADE, Value.ONE),
62 | SPADE_TWO(Color.SPADE, Value.TWO),
63 | SPADE_THREE(Color.SPADE, Value.THREE),
64 | SPADE_FOUR(Color.SPADE, Value.FOUR),
65 | SPADE_FIVE(Color.SPADE, Value.FIVE),
66 | SPADE_SIX(Color.SPADE, Value.SIX),
67 | SPADE_SEVEN(Color.SPADE, Value.SEVEN),
68 | SPADE_EIGHT(Color.SPADE, Value.EIGHT),
69 | SPADE_NINE(Color.SPADE, Value.NINE),
70 | SPADE_TEN(Color.SPADE, Value.TEN),
71 | SPADE_JACK(Color.SPADE, Value.JACK),
72 | SPADE_QUEEN(Color.SPADE, Value.QUEEN),
73 | SPADE_KING(Color.SPADE, Value.KING);
74 |
75 | // ===========================================================
76 | // Constants
77 | // ===========================================================
78 |
79 | public static final int CARD_WIDTH = 71;
80 | public static final int CARD_HEIGHT = 96;
81 |
82 | // ===========================================================
83 | // Fields
84 | // ===========================================================
85 |
86 | public final Color mColor;
87 | public final Value mValue;
88 |
89 | // ===========================================================
90 | // Constructors
91 | // ===========================================================
92 |
93 | private Card(final Color pColor, final Value pValue) {
94 | this.mColor = pColor;
95 | this.mValue = pValue;
96 | }
97 |
98 | // ===========================================================
99 | // Getter & Setter
100 | // ===========================================================
101 |
102 | public int getTexturePositionX() {
103 | return this.mValue.ordinal() * CARD_WIDTH;
104 | }
105 |
106 | public int getTexturePositionY() {
107 | return this.mColor.ordinal() * CARD_HEIGHT;
108 | }
109 |
110 | // ===========================================================
111 | // Methods from SuperClass/Interfaces
112 | // ===========================================================
113 |
114 | // ===========================================================
115 | // Methods
116 | // ===========================================================
117 |
118 | // ===========================================================
119 | // Inner and Anonymous Classes
120 | // ===========================================================
121 | }
122 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/UnloadResourcesExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.sprite.Sprite;
10 | import org.andengine.entity.util.FPSLogger;
11 | import org.andengine.input.touch.TouchEvent;
12 | import org.andengine.opengl.texture.TextureOptions;
13 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
14 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
15 | import org.andengine.opengl.texture.region.ITextureRegion;
16 | import org.andengine.ui.activity.SimpleBaseGameActivity;
17 |
18 | /**
19 | * (c) 2010 Nicolas Gramlich
20 | * (c) 2011 Zynga
21 | *
22 | * @author Nicolas Gramlich
23 | * @since 11:54:51 - 03.04.2010
24 | */
25 | public class UnloadResourcesExample extends SimpleBaseGameActivity {
26 | // ===========================================================
27 | // Constants
28 | // ===========================================================
29 |
30 | private static final int CAMERA_WIDTH = 720;
31 | private static final int CAMERA_HEIGHT = 480;
32 |
33 | // ===========================================================
34 | // Fields
35 | // ===========================================================
36 |
37 | private BitmapTextureAtlas mBitmapTextureAtlas;
38 | private ITextureRegion mClickToUnloadTextureRegion;
39 |
40 | // ===========================================================
41 | // Constructors
42 | // ===========================================================
43 |
44 | // ===========================================================
45 | // Getter & Setter
46 | // ===========================================================
47 |
48 | // ===========================================================
49 | // Methods for/from SuperClass/Interfaces
50 | // ===========================================================
51 |
52 | @Override
53 | public EngineOptions onCreateEngineOptions() {
54 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
55 |
56 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
57 | }
58 |
59 | @Override
60 | public void onCreateResources() {
61 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
62 |
63 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 128, 128, TextureOptions.BILINEAR);
64 | this.mClickToUnloadTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "click_to_unload.png", 0, 0);
65 | this.mBitmapTextureAtlas.load();
66 | }
67 |
68 | @Override
69 | public Scene onCreateScene() {
70 | this.mEngine.registerUpdateHandler(new FPSLogger());
71 |
72 | final Scene scene = new Scene();
73 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
74 |
75 | final float centerX = (CAMERA_WIDTH - this.mClickToUnloadTextureRegion.getWidth()) / 2;
76 | final float centerY = (CAMERA_HEIGHT - this.mClickToUnloadTextureRegion.getHeight()) / 2;
77 | final Sprite clickToUnload = new Sprite(centerX, centerY, this.mClickToUnloadTextureRegion, this.getVertexBufferObjectManager()) {
78 | @Override
79 | public boolean onAreaTouched(final TouchEvent pSceneTouchEvent, final float pTouchAreaLocalX, final float pTouchAreaLocalY) {
80 | if(pSceneTouchEvent.isActionDown()) {
81 | /* Completely remove all resources associated with this sprite. */
82 | this.dispose();
83 | UnloadResourcesExample.this.mBitmapTextureAtlas.unload();
84 |
85 | /* And remove the sprite from the Scene. */
86 | this.detachSelf();
87 | return true;
88 | } else {
89 | return false;
90 | }
91 | }
92 | };
93 | scene.attachChild(clickToUnload);
94 |
95 | scene.registerTouchArea(clickToUnload);
96 |
97 | return scene;
98 | }
99 |
100 | // ===========================================================
101 | // Methods
102 | // ===========================================================
103 |
104 | // ===========================================================
105 | // Inner and Anonymous Classes
106 | // ===========================================================
107 | }
108 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/LoadTextureExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.IOnSceneTouchListener;
8 | import org.andengine.entity.scene.Scene;
9 | import org.andengine.entity.scene.background.Background;
10 | import org.andengine.entity.sprite.Sprite;
11 | import org.andengine.entity.util.FPSLogger;
12 | import org.andengine.input.touch.TouchEvent;
13 | import org.andengine.opengl.texture.TextureOptions;
14 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
15 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
16 | import org.andengine.opengl.texture.region.ITextureRegion;
17 | import org.andengine.ui.activity.SimpleBaseGameActivity;
18 | import org.andengine.util.math.MathUtils;
19 |
20 | import android.widget.Toast;
21 |
22 | /**
23 | * (c) 2010 Nicolas Gramlich
24 | * (c) 2011 Zynga
25 | *
26 | * @author Nicolas Gramlich
27 | * @since 12:14:29 - 30.06.2010
28 | */
29 | public class LoadTextureExample extends SimpleBaseGameActivity {
30 | // ===========================================================
31 | // Constants
32 | // ===========================================================
33 |
34 | private static final int CAMERA_WIDTH = 720;
35 | private static final int CAMERA_HEIGHT = 480;
36 |
37 | // ===========================================================
38 | // Fields
39 | // ===========================================================
40 |
41 | private BitmapTextureAtlas mBitmapTextureAtlas;
42 | private Scene mScene;
43 |
44 | // ===========================================================
45 | // Constructors
46 | // ===========================================================
47 |
48 | // ===========================================================
49 | // Getter & Setter
50 | // ===========================================================
51 |
52 | // ===========================================================
53 | // Methods for/from SuperClass/Interfaces
54 | // ===========================================================
55 |
56 | @Override
57 | public EngineOptions onCreateEngineOptions() {
58 | Toast.makeText(this, "Touch the screen to load a completely new BitmapTextureAtlas in a random location with every touch!", Toast.LENGTH_LONG).show();
59 |
60 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
61 |
62 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
63 | }
64 |
65 | @Override
66 | public void onCreateResources() {
67 | /* Nothing done here. */
68 | }
69 |
70 | @Override
71 | public Scene onCreateScene() {
72 | this.mEngine.registerUpdateHandler(new FPSLogger());
73 |
74 | this.mScene = new Scene();
75 | this.mScene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
76 |
77 | this.mScene.setOnSceneTouchListener(new IOnSceneTouchListener() {
78 | @Override
79 | public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {
80 | if(pSceneTouchEvent.isActionDown()) {
81 | LoadTextureExample.this.loadNewTexture();
82 | }
83 |
84 | return true;
85 | }
86 | });
87 |
88 | return this.mScene;
89 | }
90 |
91 | // ===========================================================
92 | // Methods
93 | // ===========================================================
94 |
95 | private void loadNewTexture() {
96 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
97 |
98 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
99 | final ITextureRegion faceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
100 | this.mBitmapTextureAtlas.load();
101 |
102 | final float x = (CAMERA_WIDTH - faceTextureRegion.getWidth()) * MathUtils.RANDOM.nextFloat();
103 | final float y = (CAMERA_HEIGHT - faceTextureRegion.getHeight()) * MathUtils.RANDOM.nextFloat();
104 | final Sprite clickToUnload = new Sprite(x, y, faceTextureRegion, this.getVertexBufferObjectManager());
105 | this.mScene.attachChild(clickToUnload);
106 | }
107 |
108 | // ===========================================================
109 | // Inner and Anonymous Classes
110 | // ===========================================================
111 | }
112 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/game/snake/entity/Snake.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.game.snake.entity;
2 |
3 | import java.util.LinkedList;
4 |
5 | import org.andengine.entity.Entity;
6 | import org.andengine.examples.game.snake.adt.Direction;
7 | import org.andengine.examples.game.snake.adt.SnakeSuicideException;
8 | import org.andengine.opengl.texture.region.ITextureRegion;
9 | import org.andengine.opengl.texture.region.TiledTextureRegion;
10 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
11 |
12 | /**
13 | * (c) 2010 Nicolas Gramlich
14 | * (c) 2011 Zynga Inc.
15 | *
16 | * @author Nicolas Gramlich
17 | * @since 17:11:44 - 09.07.2010
18 | */
19 | public class Snake extends Entity {
20 | // ===========================================================
21 | // Constants
22 | // ===========================================================
23 |
24 | // ===========================================================
25 | // Fields
26 | // ===========================================================
27 |
28 | private final SnakeHead mHead;
29 | private final LinkedList mTail = new LinkedList();
30 |
31 | private Direction mDirection;
32 | private boolean mGrow;
33 | private final ITextureRegion mTailPartTextureRegion;
34 | private Direction mLastMoveDirection;
35 |
36 | // ===========================================================
37 | // Constructors
38 | // ===========================================================
39 |
40 | public Snake(final Direction pInitialDirection, final int pCellX, final int pCellY, final TiledTextureRegion pHeadTextureRegion, final ITextureRegion pTailPartTextureRegion, final VertexBufferObjectManager pVertexBufferObjectManager) {
41 | super(0, 0);
42 | this.mTailPartTextureRegion = pTailPartTextureRegion;
43 | this.mHead = new SnakeHead(pCellX, pCellY, pHeadTextureRegion, pVertexBufferObjectManager);
44 | this.attachChild(this.mHead);
45 | this.setDirection(pInitialDirection);
46 | }
47 |
48 | // ===========================================================
49 | // Getter & Setter
50 | // ===========================================================
51 |
52 | public Direction getDirection() {
53 | return this.mDirection;
54 | }
55 |
56 | public void setDirection(final Direction pDirection) {
57 | if(this.mLastMoveDirection != Direction.opposite(pDirection)) {
58 | this.mDirection = pDirection;
59 | this.mHead.setRotation(pDirection);
60 | }
61 | }
62 |
63 | public int getTailLength() {
64 | return this.mTail.size();
65 | }
66 |
67 | public SnakeHead getHead() {
68 | return this.mHead;
69 | }
70 |
71 | // ===========================================================
72 | // Methods for/from SuperClass/Interfaces
73 | // ===========================================================
74 |
75 | // ===========================================================
76 | // Methods
77 | // ===========================================================
78 |
79 | public void grow() {
80 | this.mGrow = true;
81 | }
82 |
83 | public int getNextX() {
84 | return Direction.addToX(this.mDirection, this.mHead.getCellX());
85 | }
86 |
87 | public int getNextY() {
88 | return Direction.addToY(this.mDirection, this.mHead.getCellY());
89 | }
90 |
91 | public void move() throws SnakeSuicideException {
92 | this.mLastMoveDirection = this.mDirection;
93 | if(this.mGrow) {
94 | this.mGrow = false;
95 | /* If the snake should grow,
96 | * simply add a new part in the front of the tail,
97 | * where the head currently is. */
98 | final SnakeTailPart newTailPart = new SnakeTailPart(this.mHead, this.mTailPartTextureRegion, this.mHead.getVertexBufferObjectManager());
99 | this.attachChild(newTailPart);
100 | this.mTail.addFirst(newTailPart);
101 | } else {
102 | if(this.mTail.isEmpty() == false) {
103 | /* First move the end of the tail to where the head currently is. */
104 | final SnakeTailPart tailEnd = this.mTail.removeLast();
105 | tailEnd.setCell(this.mHead);
106 | this.mTail.addFirst(tailEnd);
107 | }
108 | }
109 |
110 | /* The move the head into the direction of the snake. */
111 | this.mHead.setCell(this.getNextX(), this.getNextY());
112 |
113 | /* Check if head collides with tail. */
114 | for(int i = this.mTail.size() - 1; i >= 0; i--) {
115 | if(this.mHead.isInSameCell(this.mTail.get(i))) {
116 | throw new SnakeSuicideException();
117 | }
118 | }
119 | }
120 |
121 | // ===========================================================
122 | // Inner and Anonymous Classes
123 | // ===========================================================
124 | }
125 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/launcher/ExpandableExampleLauncherListAdapter.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.launcher;
2 |
3 | import org.andengine.examples.R;
4 |
5 | import android.content.Context;
6 | import android.view.LayoutInflater;
7 | import android.view.View;
8 | import android.view.ViewGroup;
9 | import android.widget.BaseExpandableListAdapter;
10 | import android.widget.TextView;
11 |
12 | /**
13 | * (c) 2010 Nicolas Gramlich
14 | * (c) 2011 Zynga Inc.
15 | *
16 | * @author Nicolas Gramlich
17 | * @since 20:43:54 - 16.06.2010
18 | */
19 | class ExpandableExampleLauncherListAdapter extends BaseExpandableListAdapter {
20 | // ===========================================================
21 | // Constants
22 | // ===========================================================
23 |
24 | private static final ExampleGroup[] EXAMPLEGROUPS = {
25 | ExampleGroup.SIMPLE,
26 | ExampleGroup.MODIFIER_AND_ANIMATION,
27 | ExampleGroup.TOUCH,
28 | ExampleGroup.PARTICLESYSTEM,
29 | ExampleGroup.MULTIPLAYER,
30 | ExampleGroup.PHYSICS,
31 | ExampleGroup.TEXT,
32 | ExampleGroup.AUDIO,
33 | ExampleGroup.ADVANCED,
34 | ExampleGroup.POSTPROCESSING,
35 | ExampleGroup.BACKGROUND,
36 | ExampleGroup.OTHER,
37 | ExampleGroup.APP,
38 | ExampleGroup.GAME,
39 | ExampleGroup.BENCHMARK
40 | };
41 |
42 | // ===========================================================
43 | // Fields
44 | // ===========================================================
45 |
46 | private final Context mContext;
47 |
48 | // ===========================================================
49 | // Constructors
50 | // ===========================================================
51 |
52 | public ExpandableExampleLauncherListAdapter(final Context pContext) {
53 | this.mContext = pContext;
54 | }
55 |
56 | // ===========================================================
57 | // Getter & Setter
58 | // ===========================================================
59 |
60 | // ===========================================================
61 | // Methods for/from SuperClass/Interfaces
62 | // ===========================================================
63 |
64 | @Override
65 | public Example getChild(final int pGroupPosition, final int pChildPosition) {
66 | return EXAMPLEGROUPS[pGroupPosition].mExamples[pChildPosition];
67 | }
68 |
69 | @Override
70 | public long getChildId(final int pGroupPosition, final int pChildPosition) {
71 | return pChildPosition;
72 | }
73 |
74 | @Override
75 | public int getChildrenCount(final int pGroupPosition) {
76 | return EXAMPLEGROUPS[pGroupPosition].mExamples.length;
77 | }
78 |
79 | @Override
80 | public View getChildView(final int pGroupPosition, final int pChildPosition, final boolean pIsLastChild, final View pConvertView, final ViewGroup pParent) {
81 | final View childView;
82 | if (pConvertView != null){
83 | childView = pConvertView;
84 | }else{
85 | childView = LayoutInflater.from(this.mContext).inflate(R.layout.listrow_example, null);
86 | }
87 |
88 | ((TextView)childView.findViewById(R.id.tv_listrow_example_name)).setText(this.getChild(pGroupPosition, pChildPosition).NAMERESID);
89 | return childView;
90 | }
91 |
92 | @Override
93 | public View getGroupView(final int pGroupPosition, final boolean pIsExpanded, final View pConvertView, final ViewGroup pParent) {
94 | final View groupView;
95 | if (pConvertView != null){
96 | groupView = pConvertView;
97 | }else{
98 | groupView = LayoutInflater.from(this.mContext).inflate(R.layout.listrow_examplegroup, null);
99 | }
100 |
101 | ((TextView)groupView.findViewById(R.id.tv_listrow_examplegroup_name)).setText(this.getGroup(pGroupPosition).mNameResourceID);
102 | return groupView;
103 | }
104 |
105 | @Override
106 | public ExampleGroup getGroup(final int pGroupPosition) {
107 | return EXAMPLEGROUPS[pGroupPosition];
108 | }
109 |
110 | @Override
111 | public int getGroupCount() {
112 | return EXAMPLEGROUPS.length;
113 | }
114 |
115 | @Override
116 | public long getGroupId(final int pGroupPosition) {
117 | return pGroupPosition;
118 | }
119 |
120 | @Override
121 | public boolean isChildSelectable(final int pGroupPosition, final int pChildPosition) {
122 | return true;
123 | }
124 |
125 | @Override
126 | public boolean hasStableIds() {
127 | return true;
128 | }
129 |
130 | // ===========================================================
131 | // Methods
132 | // ===========================================================
133 |
134 | // ===========================================================
135 | // Inner and Anonymous Classes
136 | // ===========================================================
137 | }
--------------------------------------------------------------------------------
/res/values/versions.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | - 1
5 | - 2
6 | - 3
7 | - 4
8 | - 5
9 | - 6
10 | - 7
11 | - 8
12 | - 9
13 | - 10
14 | - 11
15 | - 12
16 | - 13
17 | - 14
18 | - 15
19 | - 16
20 | - 17
21 | - 18
22 | - 19
23 | - 20
24 | - 21
25 | - 22
26 | - 23
27 | - 24
28 | - 25
29 | - 26
30 | - 27
31 | - 28
32 | - 29
33 | - 30
34 | - 31
35 | - 32
36 | - 33
37 | - 34
38 | - 35
39 | - 36
40 | - 37
41 | - 38
42 | - 39
43 | - 40
44 | - 41
45 | - 42
46 | - 43
47 | - 44
48 | - 45
49 | - 46
50 |
51 |
52 |
53 | - - Initial import
54 | - - Added PathModifier Example
55 | - - Added PhysicsRemove Example
56 | - - Added Multiplayer Example\n - Added TouchDragMany Example
57 | - - Fixed Menu Examples
58 | - - Line Example now with random line width\n - Added Zoom Example\n - Added SpriteRemove Example\n - Added Sprites Benchmark
59 | - - Benchmark results now can be submitted by mail
60 | - - Removed SpritesExample\n - New animation in AnimatedSpritesExample\n - Added PhysicsJump Example\n - Added SpriteBenchmark\n - Added AnimationBenchmark
61 | - - Made Benchmarks harder (so near-future devices do not already cap at 60 FPS)
62 | - - Added possible performance fix for the Droid/Milestone
63 | - - Added TickerText Benchmark
64 | - - Added ParticleSystemCool Example\n - Added ParticleSystemNexus Example\n - Added ParticleSystem Benchmark
65 | - - Added ImageFormat Example (PNG, JPG, GIF, BMP)
66 | - - Added LoadTexure Example\n - Added UpdateTexureExample
67 | - - Benchmarks now get submitted to a Server instead of mail to me.
68 | - - Added ShapeModifierIrregular Example
69 | - - Added TextMenu Example
70 | - - Added ModPlayer Example\n - Added ChangeableText Example
71 | - - Optimized some Examples/Benchmarks by using the new FixedCapacityLayers
72 | - - Added Snake (Game)
73 | - - Added Analog On-Screen Controls\n - Added Digital On-Screen Controls
74 | - - Added Dual Analog On-Screen Controls\n - Improved Snake (Game)
75 | - - Changed TextureOptions Example to show repeating Textures\n - Added a LoopModifier to ShapeModifier Example
76 | - - Added MultiTouch Example\n - Removed TouchDragMany Example
77 | - - Now using the libGDX Box2D Wrapper\n - Added PhysicsRevoluteJoint Example
78 | - - Added Racer (Game)
79 | - - Added CollisionTest Example
80 | - - Added CoordinateConversion Example
81 | - - Added SpriteBackground Example\n - Improved PathModifier Example
82 | - - Added TMXTiledMap Example
83 | - - Added FixedStepPhysics Example
84 | - - Added StrokeFont Example
85 | - - Added BoundCamera Example\n - Improved Racer Game with some boxes to collide with
86 | - - Fixed TMXTiledMap Example
87 | - - Added EaseFunction Example
88 | - - Adaptions due to changes in AndEngine
89 | - - Benchmarks now also submit CPU-speed (MHz)
90 | - - Benchmarks now also submit info about Memory
91 | - - Updated SimpleParticle Example
92 | - - Added PhysicsCollisionFiltering Example
93 | - - Added XMLLayout Example
94 | - - Added Rotation3D Example
95 | - - Added LevelLoader Example
96 | - - Added CityRadar (App)
97 | - - Added PinchZoom Example
98 | - - Moved to new \'EntityContainer\' branch (which is now default)\n - Added Pong (Multiplayer) Game
99 |
100 |
101 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/launcher/ExampleGroup.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples.launcher;
2 |
3 | import org.andengine.examples.R;
4 |
5 |
6 | /**
7 | * (c) 2010 Nicolas Gramlich
8 | * (c) 2011 Zynga
9 | *
10 | * @author Nicolas Gramlich
11 | * @since 11:13:34 - 27.06.2010
12 | */
13 | public enum ExampleGroup {
14 | // ===========================================================
15 | // Elements
16 | // ===========================================================
17 |
18 | SIMPLE(R.string.examplegroup_simple,
19 | Example.LINE, Example.RECTANGLE, Example.SPRITE, Example.SPRITEREMOVE, Example.SPRITEBATCH),
20 | MODIFIER_AND_ANIMATION(R.string.examplegroup_modifier_and_animation,
21 | Example.MOVINGBALL, Example.ENTITYMODIFIER, Example.ENTITYMODIFIERIRREGULAR, Example.CARDINALSPLINEMOVEMODIFIER, Example.PATHMODIFIER, Example.ANIMATEDSPRITES, Example.EASEFUNCTION, Example.ROTATION3D ),
22 | TOUCH(R.string.examplegroup_touch,
23 | Example.TOUCHDRAG, Example.MULTITOUCH, Example.ANALOGONSCREENCONTROL, Example.DIGITALONSCREENCONTROL, Example.ANALOGONSCREENCONTROLS, Example.COORDINATECONVERSION, Example.PINCHZOOM),
24 | PARTICLESYSTEM(R.string.examplegroup_particlesystems,
25 | Example.PARTICLESYSTEMSIMPLE, Example.PARTICLESYSTEMCOOL, Example.PARTICLESYSTEMNEXUS),
26 | MULTIPLAYER(R.string.examplegroup_multiplayer,
27 | Example.MULTIPLAYER, Example.MULTIPLAYERSERVERDISCOVERY, Example.MULTIPLAYERBLUETOOTH),
28 | PHYSICS(R.string.examplegroup_physics,
29 | Example.COLLISIONDETECTION, Example.PHYSICS, Example.PHYSICSFIXEDSTEP, Example.PHYSICSCOLLISIONFILTERING, Example.PHYSICSJUMP, Example.PHYSICSREVOLUTEJOINT, Example.PHYSICSMOUSEJOINT, Example.PHYSICSREMOVE),
30 | TEXT(R.string.examplegroup_text,
31 | Example.TEXT, Example.TICKERTEXT, Example.CHANGEABLETEXT, Example.TEXTBREAK, Example.CUSTOMFONT, Example.STROKEFONT, Example.BITMAPFONT),
32 | AUDIO(R.string.examplegroup_audio,
33 | Example.SOUND, Example.MUSIC, Example.MODPLAYER),
34 | ADVANCED(R.string.examplegroup_advanced,
35 | Example.SPLITSCREEN, Example.BOUNDCAMERA, Example.HULLALGORITHM), // Example.AUGMENTEDREALITY, Example.AUGMENTEDREALITYHORIZON),
36 | POSTPROCESSING(R.string.examplegroup_postprocessing,
37 | Example.MOTIONSTREAK, Example.RADIALBLUR),
38 | BACKGROUND(R.string.examplegroup_background,
39 | Example.REPEATINGSPRITEBACKGROUND, Example.AUTOPARALLAXBACKGROUND, Example.TMXTILEDMAP),
40 | OTHER(R.string.examplegroup_other,
41 | Example.SCREENCAPTURE, Example.PAUSE, Example.MENU, Example.SUBMENU, Example.TEXTMENU, Example.ZOOM , Example.IMAGEFORMATS, Example.PVRTEXTURE, Example.PVRCCZTEXTURE, Example.PVRGZTEXTURE, Example.ETC1TEXTURE, Example.TEXTUREOPTIONS, Example.CANVASTEXTURECOMPOSITING, Example.TEXTUREPACKER, Example.COLORKEYTEXTURESOURCEDECORATOR, Example.LOADTEXTURE, Example.UPDATETEXTURE, Example.UNLOADRESOURCES, Example.RUNNABLEPOOLUPDATEHANDLER, Example.SVGTEXTUREREGION, Example.XMLLAYOUT, Example.LEVELLOADER),
42 | APP(R.string.examplegroup_app,
43 | Example.APP_CITYRADAR),
44 | GAME(R.string.examplegroup_game,
45 | Example.GAME_PONG, Example.GAME_SNAKE, Example.GAME_RACER),
46 | BENCHMARK(R.string.examplegroup_benchmark,
47 | Example.BENCHMARK_SPRITE, Example.BENCHMARK_ATTACHDETACH, Example.BENCHMARK_ENTITYMODIFIER, Example.BENCHMARK_ANIMATION, Example.BENCHMARK_TICKERTEXT, /* Example.BENCHMARK_PARTICLESYSTEM, */ Example.BENCHMARK_PHYSICS);
48 |
49 | // ===========================================================
50 | // Constants
51 | // ===========================================================
52 |
53 | // ===========================================================
54 | // Fields
55 | // ===========================================================
56 |
57 | public final Example[] mExamples;
58 | public final int mNameResourceID;
59 |
60 | // ===========================================================
61 | // Constructors
62 | // ===========================================================
63 |
64 | private ExampleGroup(final int pNameResourceID, final Example ... pExamples) {
65 | this.mNameResourceID = pNameResourceID;
66 | this.mExamples = pExamples;
67 | }
68 |
69 | // ===========================================================
70 | // Getter & Setter
71 | // ===========================================================
72 |
73 | // ===========================================================
74 | // Methods for/from SuperClass/Interfaces
75 | // ===========================================================
76 |
77 | // ===========================================================
78 | // Methods
79 | // ===========================================================
80 |
81 | // ===========================================================
82 | // Inner and Anonymous Classes
83 | // ===========================================================
84 | }
85 |
--------------------------------------------------------------------------------
/assets/gfx/chick.svg:
--------------------------------------------------------------------------------
1 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/SpriteRemoveExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.Engine.EngineLock;
4 | import org.andengine.engine.camera.Camera;
5 | import org.andengine.engine.options.EngineOptions;
6 | import org.andengine.engine.options.ScreenOrientation;
7 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
8 | import org.andengine.entity.scene.IOnSceneTouchListener;
9 | import org.andengine.entity.scene.Scene;
10 | import org.andengine.entity.scene.background.Background;
11 | import org.andengine.entity.sprite.Sprite;
12 | import org.andengine.entity.util.FPSLogger;
13 | import org.andengine.input.touch.TouchEvent;
14 | import org.andengine.opengl.texture.TextureOptions;
15 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
16 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
17 | import org.andengine.opengl.texture.region.ITextureRegion;
18 | import org.andengine.ui.activity.SimpleBaseGameActivity;
19 |
20 | import android.widget.Toast;
21 |
22 | /**
23 | * (c) 2010 Nicolas Gramlich
24 | * (c) 2011 Zynga
25 | *
26 | * @author Nicolas Gramlich
27 | * @since 11:54:51 - 03.04.2010
28 | */
29 | public class SpriteRemoveExample extends SimpleBaseGameActivity implements IOnSceneTouchListener {
30 | // ===========================================================
31 | // Constants
32 | // ===========================================================
33 |
34 | private static final int CAMERA_WIDTH = 720;
35 | private static final int CAMERA_HEIGHT = 480;
36 |
37 | // ===========================================================
38 | // Fields
39 | // ===========================================================
40 |
41 | private BitmapTextureAtlas mBitmapTextureAtlas;
42 | private ITextureRegion mFaceTextureRegion;
43 | private Sprite mFaceToRemove;
44 |
45 | // ===========================================================
46 | // Constructors
47 | // ===========================================================
48 |
49 | // ===========================================================
50 | // Getter & Setter
51 | // ===========================================================
52 |
53 | // ===========================================================
54 | // Methods for/from SuperClass/Interfaces
55 | // ===========================================================
56 |
57 | @Override
58 | public EngineOptions onCreateEngineOptions() {
59 | Toast.makeText(this, "Touch the screen to safely remove the sprite.", Toast.LENGTH_LONG).show();
60 |
61 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
62 |
63 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
64 | }
65 |
66 | @Override
67 | public void onCreateResources() {
68 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
69 |
70 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
71 | this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
72 | this.mBitmapTextureAtlas.load();
73 | }
74 |
75 | @Override
76 | public Scene onCreateScene() {
77 | this.mEngine.registerUpdateHandler(new FPSLogger());
78 |
79 | final Scene scene = new Scene();
80 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
81 |
82 | /* Calculate the coordinates for the face, so its centered on the camera. */
83 | final float centerX = (CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
84 | final float centerY = (CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
85 |
86 | this.mFaceToRemove = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
87 | scene.attachChild(this.mFaceToRemove);
88 |
89 | scene.setOnSceneTouchListener(this);
90 |
91 | return scene;
92 | }
93 |
94 | @Override
95 | public boolean onSceneTouchEvent(final Scene pScene, final TouchEvent pSceneTouchEvent) {
96 | if(this.mFaceToRemove == null) {
97 | return false;
98 | }
99 |
100 | final EngineLock engineLock = this.mEngine.getEngineLock();
101 | engineLock.lock();
102 |
103 | /* Now it is save to remove the entity! */
104 | pScene.detachChild(this.mFaceToRemove);
105 | this.mFaceToRemove.dispose();
106 | this.mFaceToRemove = null;
107 |
108 | engineLock.unlock();
109 | return true;
110 | }
111 |
112 | // ===========================================================
113 | // Methods
114 | // ===========================================================
115 |
116 | // ===========================================================
117 | // Inner and Anonymous Classes
118 | // ===========================================================
119 | }
120 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/StrokeFontExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.text.Text;
10 | import org.andengine.entity.util.FPSLogger;
11 | import org.andengine.opengl.font.Font;
12 | import org.andengine.opengl.font.StrokeFont;
13 | import org.andengine.opengl.texture.ITexture;
14 | import org.andengine.opengl.texture.TextureOptions;
15 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
16 | import org.andengine.opengl.vbo.VertexBufferObjectManager;
17 | import org.andengine.ui.activity.SimpleBaseGameActivity;
18 |
19 | import android.graphics.Color;
20 | import android.graphics.Typeface;
21 |
22 | /**
23 | * (c) 2010 Nicolas Gramlich
24 | * (c) 2011 Zynga
25 | *
26 | * @author Nicolas Gramlich
27 | * @since 22:49:43 - 26.07.2010
28 | */
29 | public class StrokeFontExample extends SimpleBaseGameActivity {
30 | // ===========================================================
31 | // Constants
32 | // ===========================================================
33 |
34 | private static final int CAMERA_WIDTH = 720;
35 | private static final int CAMERA_HEIGHT = 480;
36 |
37 | private static final int FONT_SIZE = 48;
38 |
39 | // ===========================================================
40 | // Fields
41 | // ===========================================================
42 |
43 | private Font mFont;
44 | private StrokeFont mStrokeFont;
45 | private StrokeFont mStrokeOnlyFont;
46 |
47 | // ===========================================================
48 | // Constructors
49 | // ===========================================================
50 |
51 | // ===========================================================
52 | // Getter & Setter
53 | // ===========================================================
54 |
55 | // ===========================================================
56 | // Methods for/from SuperClass/Interfaces
57 | // ===========================================================
58 |
59 | @Override
60 | public EngineOptions onCreateEngineOptions() {
61 | final Camera camera = new Camera(0, 0, CAMERA_WIDTH, CAMERA_HEIGHT);
62 |
63 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(CAMERA_WIDTH, CAMERA_HEIGHT), camera);
64 | }
65 |
66 | @Override
67 | public void onCreateResources() {
68 | final ITexture fontTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
69 | final ITexture strokeFontTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
70 | final ITexture strokeOnlyFontTexture = new BitmapTextureAtlas(this.getTextureManager(), 256, 256, TextureOptions.BILINEAR);
71 |
72 | this.mFont = new Font(this.getFontManager(), fontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), FONT_SIZE, true, Color.BLACK);
73 | this.mFont.load();
74 |
75 | this.mStrokeFont = new StrokeFont(this.getFontManager(), strokeFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), FONT_SIZE, true, Color.BLACK, 2, Color.WHITE);
76 | this.mStrokeFont.load();
77 |
78 | this.mStrokeOnlyFont = new StrokeFont(this.getFontManager(), strokeOnlyFontTexture, Typeface.create(Typeface.DEFAULT, Typeface.BOLD), FONT_SIZE, true, Color.BLACK, 2, Color.WHITE, true);
79 | this.mStrokeOnlyFont.load();
80 | }
81 |
82 | @Override
83 | public Scene onCreateScene() {
84 | this.mEngine.registerUpdateHandler(new FPSLogger());
85 |
86 | final Scene scene = new Scene();
87 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
88 |
89 | final VertexBufferObjectManager vertexBufferObjectManager = this.getVertexBufferObjectManager();
90 | final Text textNormal = new Text(100, 100, this.mFont, "Just some normal Text.", vertexBufferObjectManager);
91 | final Text textStroke = new Text(100, 200, this.mStrokeFont, "Text with fill and stroke.", vertexBufferObjectManager);
92 | final Text textStrokeOnly = new Text(100, 300, this.mStrokeOnlyFont, "Text with stroke only.", vertexBufferObjectManager);
93 |
94 | scene.attachChild(textNormal);
95 | scene.attachChild(textStroke);
96 | scene.attachChild(textStrokeOnly);
97 |
98 | return scene;
99 | }
100 |
101 | // ===========================================================
102 | // Methods
103 | // ===========================================================
104 |
105 | // ===========================================================
106 | // Inner and Anonymous Classes
107 | // ===========================================================
108 | }
109 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/AsyncGameActivityExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.scene.Scene;
8 | import org.andengine.entity.scene.background.Background;
9 | import org.andengine.entity.sprite.Sprite;
10 | import org.andengine.entity.util.FPSLogger;
11 | import org.andengine.opengl.texture.TextureOptions;
12 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
13 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
14 | import org.andengine.opengl.texture.region.ITextureRegion;
15 | import org.andengine.ui.activity.SimpleAsyncGameActivity;
16 | import org.andengine.util.progress.IProgressListener;
17 |
18 | /**
19 | * (c) Zynga 2012
20 | *
21 | * @author Nicolas Gramlich
22 | * @since 17:52:38 - 05.01.2012
23 | */
24 | public class AsyncGameActivityExample extends SimpleAsyncGameActivity {
25 | // ===========================================================
26 | // Constants
27 | // ===========================================================
28 |
29 | private static final int CAMERA_WIDTH = 720;
30 | private static final int CAMERA_HEIGHT = 480;
31 |
32 | // ===========================================================
33 | // Fields
34 | // ===========================================================
35 |
36 | private BitmapTextureAtlas mBitmapTextureAtlas;
37 | private ITextureRegion mFaceTextureRegion;
38 |
39 | // ===========================================================
40 | // Constructors
41 | // ===========================================================
42 |
43 | // ===========================================================
44 | // Getter & Setter
45 | // ===========================================================
46 |
47 | // ===========================================================
48 | // Methods for/from SuperClass/Interfaces
49 | // ===========================================================
50 |
51 | @Override
52 | public EngineOptions onCreateEngineOptions() {
53 | final Camera camera = new Camera(0, 0, AsyncGameActivityExample.CAMERA_WIDTH, AsyncGameActivityExample.CAMERA_HEIGHT);
54 |
55 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_SENSOR, new RatioResolutionPolicy(AsyncGameActivityExample.CAMERA_WIDTH, AsyncGameActivityExample.CAMERA_HEIGHT), camera);
56 | }
57 |
58 | @Override
59 | public void onCreateResourcesAsync(final IProgressListener pProgressListener) throws Exception {
60 | /* Comfortably load the resources asynchronously, adding artificial pauses between each step. */
61 | pProgressListener.onProgressChanged(0);
62 | Thread.sleep(1000);
63 | pProgressListener.onProgressChanged(20);
64 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
65 | Thread.sleep(1000);
66 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
67 | pProgressListener.onProgressChanged(40);
68 | Thread.sleep(1000);
69 | this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(AsyncGameActivityExample.this.mBitmapTextureAtlas, AsyncGameActivityExample.this, "face_box.png", 0, 0);
70 | pProgressListener.onProgressChanged(60);
71 | Thread.sleep(1000);
72 | this.mBitmapTextureAtlas.load();
73 | pProgressListener.onProgressChanged(80);
74 | Thread.sleep(1000);
75 | pProgressListener.onProgressChanged(100);
76 | }
77 |
78 | @Override
79 | public Scene onCreateSceneAsync(final IProgressListener pProgressListener) throws Exception {
80 | this.mEngine.registerUpdateHandler(new FPSLogger());
81 |
82 | final Scene scene = new Scene();
83 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
84 |
85 | return scene;
86 | }
87 |
88 | @Override
89 | public void onPopulateSceneAsync(final Scene pScene, final IProgressListener pProgressListener) throws Exception {
90 | /* Calculate the coordinates for the face, so its centered on the camera. */
91 | final float centerX = (AsyncGameActivityExample.CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
92 | final float centerY = (AsyncGameActivityExample.CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
93 |
94 | /* Create the face and add it to the scene. */
95 | final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager());
96 | pScene.attachChild(face);
97 | }
98 |
99 | // ===========================================================
100 | // Methods
101 | // ===========================================================
102 |
103 | // ===========================================================
104 | // Inner and Anonymous Classes
105 | // ===========================================================
106 | }
107 |
--------------------------------------------------------------------------------
/src/org/andengine/examples/Rotation3DExample.java:
--------------------------------------------------------------------------------
1 | package org.andengine.examples;
2 |
3 | import org.andengine.engine.camera.Camera;
4 | import org.andengine.engine.options.EngineOptions;
5 | import org.andengine.engine.options.ScreenOrientation;
6 | import org.andengine.engine.options.resolutionpolicy.RatioResolutionPolicy;
7 | import org.andengine.entity.modifier.LoopEntityModifier;
8 | import org.andengine.entity.modifier.RotationModifier;
9 | import org.andengine.entity.scene.Scene;
10 | import org.andengine.entity.scene.background.Background;
11 | import org.andengine.entity.sprite.Sprite;
12 | import org.andengine.entity.util.FPSLogger;
13 | import org.andengine.opengl.texture.TextureOptions;
14 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlas;
15 | import org.andengine.opengl.texture.atlas.bitmap.BitmapTextureAtlasTextureRegionFactory;
16 | import org.andengine.opengl.texture.region.ITextureRegion;
17 | import org.andengine.opengl.util.GLState;
18 | import org.andengine.ui.activity.SimpleBaseGameActivity;
19 |
20 | /**
21 | * (c) 2010 Nicolas Gramlich
22 | * (c) 2011 Zynga
23 | *
24 | * @author Nicolas Gramlich
25 | * @since 10:10:10 - 10.10.2010
26 | */
27 | public class Rotation3DExample extends SimpleBaseGameActivity {
28 | // ===========================================================
29 | // Constants
30 | // ===========================================================
31 |
32 | private static final int CAMERA_WIDTH = 720;
33 | private static final int CAMERA_HEIGHT = 480;
34 |
35 | // ===========================================================
36 | // Fields
37 | // ===========================================================
38 |
39 | private BitmapTextureAtlas mBitmapTextureAtlas;
40 | private ITextureRegion mFaceTextureRegion;
41 |
42 | // ===========================================================
43 | // Constructors
44 | // ===========================================================
45 |
46 | // ===========================================================
47 | // Getter & Setter
48 | // ===========================================================
49 |
50 | // ===========================================================
51 | // Methods for/from SuperClass/Interfaces
52 | // ===========================================================
53 |
54 | @Override
55 | public EngineOptions onCreateEngineOptions() {
56 | final Camera camera = new Camera(0, 0, Rotation3DExample.CAMERA_WIDTH, Rotation3DExample.CAMERA_HEIGHT);
57 | camera.setZClippingPlanes(-100, 100);
58 |
59 | return new EngineOptions(true, ScreenOrientation.LANDSCAPE_FIXED, new RatioResolutionPolicy(Rotation3DExample.CAMERA_WIDTH, Rotation3DExample.CAMERA_HEIGHT), camera);
60 | }
61 |
62 | @Override
63 | public void onCreateResources() {
64 | BitmapTextureAtlasTextureRegionFactory.setAssetBasePath("gfx/");
65 |
66 | this.mBitmapTextureAtlas = new BitmapTextureAtlas(this.getTextureManager(), 32, 32, TextureOptions.BILINEAR);
67 | this.mFaceTextureRegion = BitmapTextureAtlasTextureRegionFactory.createFromAsset(this.mBitmapTextureAtlas, this, "face_box.png", 0, 0);
68 | this.mBitmapTextureAtlas.load();
69 | }
70 |
71 | @Override
72 | public Scene onCreateScene() {
73 | this.mEngine.registerUpdateHandler(new FPSLogger());
74 |
75 | final Scene scene = new Scene();
76 | scene.setBackground(new Background(0.09804f, 0.6274f, 0.8784f));
77 |
78 | /* Calculate the coordinates for the face, so its centered on the camera. */
79 | final float centerX = (Rotation3DExample.CAMERA_WIDTH - this.mFaceTextureRegion.getWidth()) / 2;
80 | final float centerY = (Rotation3DExample.CAMERA_HEIGHT - this.mFaceTextureRegion.getHeight()) / 2;
81 |
82 | /* Create the face and add it to the scene. */
83 | final Sprite face = new Sprite(centerX, centerY, this.mFaceTextureRegion, this.getVertexBufferObjectManager()) {
84 | @Override
85 | protected void applyRotation(final GLState pGLState) {
86 | final float rotation = this.mRotation;
87 |
88 | if(rotation != 0) {
89 | final float rotationCenterX = this.mRotationCenterX;
90 | final float rotationCenterY = this.mRotationCenterY;
91 |
92 | pGLState.translateModelViewGLMatrixf(rotationCenterX, rotationCenterY, 0);
93 | /* Note we are applying rotation around the y-axis and not the z-axis anymore! */
94 | pGLState.rotateModelViewGLMatrixf(rotation, 0, 1, 0);
95 | pGLState.translateModelViewGLMatrixf(-rotationCenterX, -rotationCenterY, 0);
96 | }
97 | }
98 | };
99 | face.registerEntityModifier(new LoopEntityModifier(new RotationModifier(6, 0, 360)));
100 | scene.attachChild(face);
101 |
102 | return scene;
103 | }
104 |
105 | // ===========================================================
106 | // Methods
107 | // ===========================================================
108 |
109 | // ===========================================================
110 | // Inner and Anonymous Classes
111 | // ===========================================================
112 | }
113 |
--------------------------------------------------------------------------------