Changes between Version 112 and Version 113 of AndroidPort


Ignore:
Timestamp:
Jan 16, 2012, 5:05:51 AM (12 years ago)
Author:
Anders Feder
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • AndroidPort

    v112 v113  
    2929As far as I understand from the wiki, handlers for input events are specified in XML and !JavaScript. So I am wondering if it would be a possibility to simply add a range of new events (e.g. !TouchDown, !TouchUp, etc.) for the engine to handle? Then the port could simply be supplied with a new set of XML and !JavaScript files for the UI, but retain most everything else.
    3030
    31 The game's input events originate from SDL, so the real question is does SDL support these Android-specific events? At least in the development branch there is an [http://wiki.libsdl.org/moin.cgi/SDL_TouchFingerEvent SDL_TouchFingerEvent] that should work for this. You only need to add new events to the GUI XML schema if you're going to add new GUI object types, which might be reasonable on an Android port. I'm thinking it would be easiest to avoid that until absolutely necessary. Either way the GUI manager will need to be extended to capture these events and pass them onto scripts like the session input.js, which is where the most interesting event handling occurs (unit selection, building placement, etc.) Unfortunately the GUI engine code is a mess. 
    32 
    33 Check out !HandleEvent in ''source\gui\CGUI.cpp''. See also EGUIMessageType in GUIbase.h. In fact you should be familiar with most of ''source\gui''. For the XML parsing you'd want the CGUI::Xeromyces_* methods at the bottom of CGUI.cpp. For camera movement, see the CGameView class in ''source\graphics\!GameView.cpp''.
     31The game's input events originate from SDL, so the real question is does SDL support these Android-specific events? At least in the development branch there is an [http://wiki.libsdl.org/moin.cgi/SDL_TouchFingerEvent SDL_TouchFingerEvent] that should work for this. You only need to add new events to the GUI XML schema if you're going to add new GUI object types, which might be reasonable on an Android port. I'm thinking it would be easiest to avoid that until absolutely necessary. Either way the GUI manager will need to be extended to capture these events and pass them onto scripts like the session input.js, which is where the most interesting event handling occurs (unit selection, building placement, etc.) Unfortunately the GUI engine code is a mess.
     32
     33Check out !HandleEvent in ''source\gui\CGUI.cpp''. See also EGUIMessageType in GUIbase.h. In fact you should be familiar with most of ''source\gui''. For the XML parsing you'd want the CGUI::Xeromyces_* methods at the bottom of CGUI.cpp. For camera movement, see the CGameView class in ''source\graphics\!GameView.cpp''.
    3434
    3535=== User Interface ===
     
    132132$ mkdir ~/android
    133133}}}
     134Google publishes a Native Development Kit (NDK), which is a set of tools for building native applications for the Android platform. Unfortunately, the official NDK does not and will not support the `std::wstring` (wide characters) datatype, which is required by the game, so we'll have to use the unofficial Crystax NDK, which is merely an extension of the official NDK adding support for wide characters and other features maligned by Google.
     135
    134136Next, [http://developer.android.com/sdk/installing.html install the Android SDK]. Download the SDK package from [http://developer.android.com/sdk/index.html this page] to the working directory and then unpack it there, e.g.:
    135137