Game Development Reference
In-Depth Information
F Event handling: The framework must be able to process the multi-touch input and
virtual/physical key presses (some Android devices, such as the Toshiba AC 100, or
the Ouya console, and other gaming devices, have physical buttons), timing events,
and asynchronous operation completions.
F Filesystem, networking, and audio playback: The abstraction layers for these
entities need a ton of work to be done by you, so the implementations are presented
in Chapter 3 , Networking , Chapter 4 , Organizing a Virtual Filesystem , and Chapter 5 ,
Cross-platform Audio Streaming .
How to do it...
1.
Let us proceed to write a minimal application for the Windows environment, since we
already have the application for Android (for example, App1 ). A minimalistic Windows
GUI application is the one that creates a single window and starts the event loop (see
the following example in Win_Min1/main.c ):
#include <windows.h>
LRESULT CALLBACK MyFunc(HWND h, UINT msg, WPARAM w, LPARAM p)
{
if(msg == WM_DESTROY) { PostQuitMessage(0); }
return DefWindowProc(h, msg, w, p);
}
char WinName[] = "MyWin";
2.
The entry point is different from Android. However, its purpose remains the same— to
initialize surface rendering and invoke callbacks:
int main()
{
OnStart();
const char WinName[] = "MyWin";
WNDCLASS wcl;
memset( &wcl, 0, sizeof( WNDCLASS ) );
wcl.lpszClassName = WinName;
wcl.lpfnWndProc = MyFunc;
wcl.hCursor = LoadCursor( NULL, IDC_ARROW );
if ( !RegisterClass( &wcl ) ) { return 0; }
 
Search WWH ::




Custom Search