Menu

ENG - Technical documentation - Android

Joe

Table of Contents

9 Android (tjgerApp)

For Android Application developers a special version of the library is available (see SVN -> Android tab page).
There are some differences between developing a Java and an Android application.
The minimum SDK-Level is 16 (like HGBaseApp).

9.1 tjger configuration file

The tjger configuration is read from the file with name tjger.xml in /res/raw folder.

Some configuration fields has been removed from the tjger configuration file, e.g.

  • welcome: the default mechansim of HGBase is used instead
  • playerFieldHeight: the default height of the status bar is taken instead
  • playerimage: has been completely removed, use the preferred piece color

The player node has a new attribute default as there is no configuration file that can store default values when delivering the game.

9.1.1 Pro / free version

It is possible to define in the node app of the settings node, if advertisements will be shown after each game (set attribute advertisements / ads to true) and if the game is currently the free version or the pro(fessional) version. If the attribute pro is set to true, than it is the professional version, this also means that advertisements won’t be displayed. In addition the name of the app (app_name) should also be changed depending which version is currently built.

9.1.2 Game parts

The background which could originally hold either an image or a color can now manage only images, an additional attribute allows to define an arbitrary background color. This has to be specified in the XML backgrounds-element by the attribute color (or backcolor) that defines the default color. For the arrangement, a certain color can be defined by the attribute backcolor.
The images have to be put into the assets folder, as they are stored in sub-folders.
All game parts with the attribute pro set to true will only be shown (loaded) in the professional version!

9.2 Game resources

Many game resources (images, sound, html) can be placed either in the resources raw folder or in the assets folder (including sub-folders), see also Game parts.

9.3 Game player

There is no extra image anymore for players, only the image given by piece color.
The first (human) player is named by the user name (if possible), the other players "Player 2" to "Player n". The default implementation (e.g. the new game dialog) allows only to change the name and piece color of the first human player.

9.4 MainMenu / MainPanel

The panels are set by overriding the method onCreatePostWelcome and calling setPanels there. By this call the main menu, the main panel, the game panel and the optional status bar are set.

The MainMenu is initial panel when starting a game and has the most important menu commands as buttons (New Game, Resume Game, Game Settings, etc.). By defining a main_menu image in the drawable folder it is possible to define a background image (put an extra image into drawable-land if there shall be a different image for landscape orientation). By defining a main_menu_button image in the drawable folder it is possible to define a background image for the button (otherwise a plain color is used). For typicall games it will not be necessary to implement a sub-class for the MainMenu.

If the action bar is hidden (by calling setActionBarVisible with false in MainFrame), there will be placed a button (image menu_icon in the drawable folder) on the right side of the main menu to give access to the option menu. In that case there will be no access from game panel to this menu.

The MainPanel contains the GamePanel and the optional PlayerStatePanel. For typicall games it will only be necessary to implement a sub-class for the MainPanel if a PlayerStatePanel shall be displayed (needs to override method createStatePanel for that purpose).

9.5 New game dialog

The new game dialog does not appear before a game starts. Instead of that, this dialog will be used to set particular values separately and these values have to be stored as preferences and will be called by the Game Settings button. However, class names will stay the same as possible.
The default settings has fewer options than the old game dialog. By default, only one human name can be changed and it can be defined how many humans and how many players at all will take part and which computer player type shall be used.
The game related New game information for the game manager has to be set by overriding the onSetNewGameInformation method of the MainFrame. In this method it is possible to set the new game information from the preferences (or possibly another source).

9.6 Game panel

The flag for setting automatic animation on and off is not declared by the HGBase-settings file, but as parameter of the game panel.

9.7 Player state panel

The player state panel is now added by overwriting the createStatePanel method of the MainPanel.

9.8 Game recorder

The game recorder has been completely removed.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.