diff -ru brainparty/BPGame.cpp brainparty.sdlgles/BPGame.cpp
--- brainparty/BPGame.cpp	2010-03-11 01:15:34.000000000 +0100
+++ brainparty.sdlgles/BPGame.cpp	2010-04-03 17:46:36.000000000 +0200
@@ -17,7 +17,10 @@
 
 #include "BPGame.h"
 #include "SDL.h"
-#include "SDL_opengl.h" 
+
+#include <SDL_gles.h>
+#include <GLES/gl.h>
+
 #include "SDL_ttf.h" 
 #include <string.h>
 
@@ -860,6 +863,7 @@
 		return;
 	}
 	
+        ConvertCoordinates(x, y);
 	TouchEvent.X = x;
 	TouchEvent.Y = y;
 
@@ -879,7 +883,8 @@
 		ShowingClearScores = false;
 		return;
 	}
-	
+
+        ConvertCoordinates(x, y);
 	TouchEvent.X = x;
 	TouchEvent.Y = y;
 	
@@ -899,6 +904,8 @@
 			} else if (PointOverRect(TouchEvent.X, TouchEvent.Y, 73, 370, 170, 58)) {
 				SetGameState(MAIN_MENU_HELP);
 				PlaySound("mouse_click");
+                        } else if (PointOverRect(TouchEvent.X, TouchEvent.Y, 260, 0, 60, 60)) {
+                                SetGameState(DO_QUIT);
 			} else if (TouchEvent.Y < 207) {
 				++CheatMainTaps;
 			}
@@ -1158,6 +1165,7 @@
 		return;
 	}
 	
+        ConvertCoordinates(x, y);
 	TouchEvent.X = x;
 	TouchEvent.Y = y;
 
@@ -2407,4 +2415,4 @@
 Colour* BPGame::ColorLerp(Colour* from, Colour* to, float amount) {
 	Colour* col = new Colour(Lerp(from->R, to->R, amount), Lerp(from->G, to->G, amount), Lerp(from->B, to->B, amount), Lerp(from->A, to->A, amount));
 	return col;
-}
\ No newline at end of file
+}
diff -ru brainparty/BPGame.h brainparty.sdlgles/BPGame.h
--- brainparty/BPGame.h	2010-03-06 15:50:16.000000000 +0100
+++ brainparty.sdlgles/BPGame.h	2010-04-03 17:54:54.000000000 +0200
@@ -30,7 +30,10 @@
 #include <sstream> 
 
 #include "SDL.h"
-#include "SDL_opengl.h" 
+
+#include <SDL_gles.h>
+#include <GLES/gl.h>
+
 #include "SDL_mixer.h"
 
 #include "Texture.h"
@@ -45,7 +48,7 @@
 #include "SpriteFont.h"
 #include "BGObject.h"
 
-enum GameStates { FIRST_RUN, MAIN_MENU, ABOUT, PLAY_MENU, PRACTISE_MENU, PLAYING, TEST_STATUS, TEST_RESULTS, PROFESSOR, OPTIONS, HELP, HISTORY, CREDITS, STORE, BRAINBOOST, MARATHON, MAIN_MENU_PLAY, PLAY_MAIN_MENU, PLAY_PRACTISE, PRACTISE_PLAY, PLAY_HISTORY, HISTORY_CREDITS, CREDITS_HISTORY, HISTORY_PLAY, TEST_RESULTS_PLAY, PRACTISE_PROFESSOR, MAIN_MENU_OPTIONS, OPTIONS_MAIN_MENU, MAIN_MENU_HELP, HELP_MAIN_MENU };
+enum GameStates { FIRST_RUN, MAIN_MENU, ABOUT, PLAY_MENU, PRACTISE_MENU, PLAYING, TEST_STATUS, TEST_RESULTS, PROFESSOR, OPTIONS, HELP, HISTORY, CREDITS, STORE, BRAINBOOST, MARATHON, MAIN_MENU_PLAY, PLAY_MAIN_MENU, PLAY_PRACTISE, PRACTISE_PLAY, PLAY_HISTORY, HISTORY_CREDITS, CREDITS_HISTORY, HISTORY_PLAY, TEST_RESULTS_PLAY, PRACTISE_PROFESSOR, MAIN_MENU_OPTIONS, OPTIONS_MAIN_MENU, MAIN_MENU_HELP, HELP_MAIN_MENU, DO_QUIT };
 enum MiniGameType { BALLOONBLASTER, BOMBHUNT, BPSAYS, BUBBLETROUBLE, CARDMATCH, CONNEX, CUPSNBALLS, DICEOFF, FLASHCOUNTING, FLASHLIGHT, IQTEST, JEWELFLIP, JEWELJAM, MARBLEDROP, MEMORYBLOX, MEMORYBOX, MEMORYMATHS, MINESWEEP, MOONJUMP, NEXTINLINE, NUMBERSNAKE, ODDONEOUT, PATCHMATCH, PERFECTPATHS, ROUTEFINDER, RPS, SCRAMBLED, SETFINDER, SHARPSHOOTER, SHORTCIRCUITSUDOKU, SHUFFLEPUZZLER, STRANGERDANGER, SYMBOLICLOGIC, UNDERTHEHAT, UNTANGLER, WORDSMASH };
 enum FontSizes { TINY = 16, XSMALL = 19, SMALL = 22, NORMAL = 24, LARGE = 30, XLARGE = 40, XXLARGE = 50, MEGA = 72, BRAINWEIGHT = 82, ALMOSTEPIC = 90, EPIC = 96, LARGEST = 120 };
 enum Colours { WHITE, BLACK, NOCOLOUR };
@@ -202,6 +205,32 @@
 	
 	float Acceleration[3];
 		
+        inline void ConvertCoordinates(float &x, float &y) {
+            /**
+             * This converts the physical (screen) coordinates to the
+             * game world coordinates. We've rotated the screen by 90
+             * degrees, and the resolution is also different. We then
+             * center the scaled image on the screen (the "-26"). The
+             * "1.666/1.6" is here, because the screen has a ratio of
+             * 480/800 and the world 480/320.
+             *
+             *   world:      screen:
+             *   a--b        b--d
+             *   |  |        |  |
+             *   c--d        a--c
+             *   320x480     800x480
+             *
+             * The world is centered on the screen, so the world takes
+             * up 720 pixels height on the screen - 40 pixels are black
+             * border at the top (screen: left) and bottom (screen: right).
+             *
+             * These 40 pixels are ~ 26 pixels in world coordinates:
+             *   offset_in_world = (40 * 480 / 800) * 1.666 / 1.5
+             **/
+            float tmp = (480.-y)*320./480.;
+            y = ((x*480./800.)*1.666/1.5)-26;
+            x = tmp;
+        }
 	void TouchStart(float x, float y);
 	void TouchStop(float x, float y);
 	void TouchDrag(float x, float y);
Binary files brainparty/Content/menu_main.png and brainparty.sdlgles/Content/menu_main.png differ
diff -ru brainparty/Makefile brainparty.sdlgles/Makefile
--- brainparty/Makefile	2010-03-02 14:42:51.000000000 +0100
+++ brainparty.sdlgles/Makefile	2010-04-03 16:05:51.000000000 +0200
@@ -12,7 +12,7 @@
 	OSXCOMPAT = SDLMain.m
 else
 	INCLUDES = `sdl-config --cflags` -I/usr/X11R6/include
-	LIBS = `sdl-config --libs` -lGL -lGLU -lSDL_mixer -lSDL_ttf -lSDL_gfx -lSDL_image 
+	LIBS = `sdl-config --libs` -lGLES_CM -lSDL_gles -lSDL_mixer -lSDL_ttf -lSDL_gfx -lSDL_image 
 	CXXFLAGS = -g -c -Wno-deprecated
 	OSXCOMPAT = 
 endif
diff -ru brainparty/Texture.cpp brainparty.sdlgles/Texture.cpp
--- brainparty/Texture.cpp	2010-03-07 19:12:19.000000000 +0100
+++ brainparty.sdlgles/Texture.cpp	2010-04-03 16:59:00.000000000 +0200
@@ -71,13 +71,17 @@
                 if (surface->format->Rmask == 0x000000ff) {
                         texture_format = GL_RGBA;
                 } else {
-                        texture_format = GL_BGRA;
+                        cout << "BGRA unsupported :(" << endl;
+                        texture_format = GL_RGBA;
+                        //texture_format = GL_BGRA;
 		}
         } else if (colors == 3) {
                 if (surface->format->Rmask == 0x000000ff) {
                         texture_format = GL_RGB;
                 } else {
-                        texture_format = GL_BGR;
+                        cout << "BGR unsupported :(" << endl;
+                        texture_format = GL_RGB;
+                        //texture_format = GL_BGR;
 		}
         } else {
 		// this shouldn't ever happen
@@ -94,7 +98,7 @@
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
 	glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
 	
-	glTexImage2D(GL_TEXTURE_2D, 0, colors, Width, Height, 0, texture_format, GL_UNSIGNED_BYTE, surface->pixels);
+	glTexImage2D(GL_TEXTURE_2D, 0, texture_format, Width, Height, 0, texture_format, GL_UNSIGNED_BYTE, surface->pixels);
 		
 	WidthRatio = actualwidth / Width;
 	HeightRatio = actualheight / Height;
@@ -221,4 +225,4 @@
 		value <<= 1;
 	}
 	return value;
-}
\ No newline at end of file
+}
diff -ru brainparty/Texture.h brainparty.sdlgles/Texture.h
--- brainparty/Texture.h	2010-03-07 19:12:19.000000000 +0100
+++ brainparty.sdlgles/Texture.h	2010-04-03 16:58:03.000000000 +0200
@@ -24,7 +24,9 @@
 
 #include <unistd.h>
 #include "SDL.h"
-#include "SDL_opengl.h" 
+
+#include <SDL_gles.h>
+#include <GLES/gl.h>
 
 #include "Colour.h"
 
diff -ru brainparty/main.cpp brainparty.sdlgles/main.cpp
--- brainparty/main.cpp	2010-03-11 01:15:34.000000000 +0100
+++ brainparty.sdlgles/main.cpp	2010-04-03 17:56:20.000000000 +0200
@@ -17,7 +17,10 @@
 
 #include <unistd.h>
 #include "SDL.h"
-#include "SDL_opengl.h" 
+
+#include <SDL_gles.h>
+#include <GLES/gl.h>
+
 #include "SDL_mixer.h" 
 #include "SDL_ttf.h" 
 
@@ -32,18 +35,26 @@
 	}
 	
 	// init all the SDL stuff
-	putenv((char*)"SDL_VIDEO_WINDOW_POS");
+        /*putenv((char*)"SDL_VIDEO_WINDOW_POS");
 	putenv((char*)"SDL_VIDEO_CENTERED=1");
 
-	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);
+	SDL_GL_SetAttribute(SDL_GL_DOUBLEBUFFER, 1);*/
 		
 	SDL_WM_SetCaption("Brain Party", "Brain Party");
 	SDL_WM_SetIcon(SDL_LoadBMP("Content/icon.bmp"), NULL);
 	
 	Mix_OpenAudio(44100, AUDIO_S16SYS, 2, 2048);
 	TTF_Init();
+
+        SDL_GLES_Init(SDL_GLES_VERSION_1_1);
 	
- 	SDL_Surface* screen = SDL_SetVideoMode(320, 480, 24, SDL_OPENGL);
+ 	SDL_Surface* screen = SDL_SetVideoMode(0, 0, 16, SDL_SWSURFACE | SDL_FULLSCREEN);
+        SDL_ShowCursor(0);
+
+        SDL_GLES_Context *context;
+
+        context = SDL_GLES_CreateContext();
+        SDL_GLES_MakeCurrent(context);
 
 	// clear the screen
 	glClearColor(0.0f, 0.0f, 0.0f, 0.0f);
@@ -53,7 +64,7 @@
 	Texture* tex_splash = new Texture("hudzillagames", 320, 480);
 
 	// set up all the OpenGL stuff
-	glViewport(0, 0, 320, 480);
+	glViewport(0, 0, 800, 480);
 	
 	glEnable(GL_TEXTURE_2D);
 	glEnable(GL_BLEND);
@@ -67,7 +78,14 @@
     
 	glMatrixMode(GL_PROJECTION);
 	glLoadIdentity();
-	glOrtho(0, 320, 480, 0, -100.0f, 100.0f);
+
+        /**
+         * Rotate by 90 degrees, scale to fullscreen, keep
+         * aspect ratio and center on screen (see also the
+         * ConvertCoordinates function in BPGame.h).
+         **/
+        glRotatef(90, 0, 0, 1);
+	glOrthof(0, 320, 506, -26, -100.0f, 100.0f);
 	
 	glMatrixMode(GL_MODELVIEW);
 	glLoadIdentity();
@@ -76,7 +94,7 @@
 	tex_splash->Draw(0, 0);
 
 	// ...update the screen
-	SDL_GL_SwapBuffers();
+	SDL_GLES_SwapBuffers();
 	
 	// and flush out any SDL events that are waiting - this makes the window activate
 	SDL_Event event;
@@ -131,7 +149,11 @@
 					exit(0);
 			}
 		}
-		
+
+                if (Game->GameState == DO_QUIT) {
+                    break;
+                }
+
 		float target_time = 16;
 
 		if (ticks_elapsed < target_time) {
@@ -141,11 +163,13 @@
 		seconds_elapsed = ticks_elapsed / 1000.0f;
 		Game->Update(seconds_elapsed);
 		Game->Draw();
-		SDL_GL_SwapBuffers();
+		SDL_GLES_SwapBuffers();
 	}
 	
 	delete Game;
 
+        SDL_GLES_DeleteContext(context);
+
 	TTF_Quit();
 	Mix_CloseAudio();
 	SDL_Quit();

