]> Shamusworld >> Repos - virtualjaguar/commitdiff
Fixes to mouse support
authorShamus Hammons <jlhamm@acm.org>
Fri, 5 Sep 2003 18:07:57 +0000 (18:07 +0000)
committerShamus Hammons <jlhamm@acm.org>
Fri, 5 Sep 2003 18:07:57 +0000 (18:07 +0000)
src/gui.cpp

index e1bf5c1e15c450344d0d7c532a65f75b8a8f905d..613cf88206cc1e7ce76f535508643eee3f740736 100644 (file)
@@ -20,9 +20,15 @@ using namespace std;                                                         // For STL stuff
 
 // Private function prototypes
 
+// Local global variables
+
+int mouseX, mouseY;
+
 
 void InitGUI(void)
 {
+       SDL_ShowCursor(SDL_DISABLE);
+       SDL_GetMouseState(&mouseX, &mouseY);
 }
 
 void GUIDone(void)
@@ -95,7 +101,7 @@ bool UserSelectFile(char * path, char * filename)
                sort(fileList.begin(), fileList.end());
 
                bool done = false;
-               uint32 limit = (fileList.size() > 24 ? 24 : fileList.size());
+               uint32 limit = (fileList.size() > 30 ? 30 : fileList.size());
                SDL_Event event;
 
                while (!done)
@@ -103,7 +109,8 @@ bool UserSelectFile(char * path, char * filename)
                        while (SDL_PollEvent(&event))
                        {
                                // Draw the GUI...
-                               memset(backbuffer, 0x11, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
+//                             memset(backbuffer, 0x11, tom_getVideoModeWidth() * tom_getVideoModeHeight() * 2);
+                               memset(backbuffer, 0x11, tom_getVideoModeWidth() * 240 * 2);
 
                                for(uint32 i=0; i<limit; i++)
                                {
@@ -115,6 +122,11 @@ bool UserSelectFile(char * path, char * filename)
                                        DrawString(backbuffer, 0, i*8, invert, " %s ", s.c_str());
                                }
 
+                                       uint32 pitch = GetSDLScreenPitch() / 2; // Returns pitch in bytes but we need words...
+//                                     uint32 address = x + (y * pitch);
+                                       backbuffer[mouseX + (mouseY * pitch)] = 0xFFFF;
+
+
                                RenderBackbuffer();
 
                                if (event.type == SDL_KEYDOWN)
@@ -175,6 +187,12 @@ bool UserSelectFile(char * path, char * filename)
                                                }
                                        }
                                }
+                               else if (event.type == SDL_MOUSEMOTION)
+                               {
+                                       //Kludge: divide by two in order to display properly on our blown up
+                                       //        screen...
+                                       mouseX = event.motion.x / 2, mouseY = event.motion.y / 2;
+                               }
                        }
                }
        }