X-Git-Url: http://git.bytex64.net/?a=blobdiff_plain;f=src%2Fswarm.cpp;fp=src%2Fswarm.cpp;h=a990927bd4119701a4daa426d3ffecdf91ea6f53;hb=ed537b5851e68c5730dab4c0d93421a66e6726e1;hp=78d51330b4452f550d0085f8603f2514b296d192;hpb=bdad36145ef42f2a44b58cc544846b4b34a6ca4f;p=swarmPDK.git diff --git a/src/swarm.cpp b/src/swarm.cpp index 78d5133..a990927 100644 --- a/src/swarm.cpp +++ b/src/swarm.cpp @@ -5,7 +5,10 @@ #include "SDL.h" #include "PDL.h" #include "Pixel.h" -#define NPIXELS 2000 + +#define NPIXELS 2500 +#define SCREENW 320 +#define SCREENH 480 SDL_Surface* screen; // Screen surface Uint16 mx, my; @@ -28,7 +31,7 @@ void init() { glClearColor(0.5f, 0.5f, 0.5f, 0.0f); glMatrixMode(GL_PROJECTION); glLoadIdentity(); - glOrthof(0.0f, 320.0f, 400.0f, 0.0f, -1.0f, 1.0f); + glOrthof(0.0f, (float)screen->w, (float)screen->h, 0.0f, -1.0f, 1.0f); glColor4f(0.0f, 0.0f, 0.0f, 1.0f); // Initialize vertices @@ -38,13 +41,13 @@ void init() { glVertexPointer(3, GL_FLOAT, 0, vertices); // Center cursor - mx = 160; - my = 200; + mx = screen->w / 2; + my = screen->h / 2; // Initialize pixel objects pixels = new Pixel*[NPIXELS]; for (int x = 0; x < NPIXELS; x++) { - pixels[x] = new Pixel(); + pixels[x] = new Pixel(screen); } } @@ -120,12 +123,13 @@ int main(int argc, char** argv) SDL_GL_SetAttribute(SDL_GL_CONTEXT_MAJOR_VERSION, 1); // Set the video mode to full screen with OpenGL-ES support - screen = SDL_SetVideoMode(320, 400, 0, SDL_OPENGL); + screen = SDL_SetVideoMode(SCREENW, SCREENH, 0, SDL_OPENGL); if (!screen) { printf("Could not initialize video!\n"); exit(1); } printf("width: %d, height, %d\n", screen->w, screen->h); + printf("Starting up with %d pixels\n", NPIXELS); #if WIN32 // Load the desktop OpenGL-ES emulation library @@ -146,18 +150,6 @@ int main(int argc, char** argv) SDL_WaitEvent(NULL); while (SDL_PollEvent(&Event)) { switch (Event.type) { - // List of keys that have been pressed - case SDL_KEYDOWN: - switch (Event.key.keysym.sym) { - // Escape forces us to quit the app - // this is also sent when the user makes a back gesture - case SDLK_ESCAPE: - Event.type = SDL_QUIT; - break; - default: - break; - } - break; case SDL_MOUSEMOTION: mx = Event.motion.x; my = Event.motion.y;