]> Shamusworld >> Repos - apple2/commitdiff
Initial stab at fixing the GUI classes so that they work properly.
authorShamus Hammons <jlhamm@acm.org>
Thu, 5 Jun 2008 12:11:39 +0000 (12:11 +0000)
committerShamus Hammons <jlhamm@acm.org>
Thu, 5 Jun 2008 12:11:39 +0000 (12:11 +0000)
apple2.cfg
src/applevideo.cpp
src/gui/draggablewindow2.cpp
src/gui/draggablewindow2.h
src/gui/gui.cpp

index e494c0c5235ae662ddbc43a1a6086630eace9271..c2aee792f666a897a142af9262aa0741cf49bcdf 100755 (executable)
@@ -28,7 +28,7 @@ floppyImage1 = ./disks/bt1_boot.dsk
 #floppyImage1 = ./disks/bt3_boot.dsk
 # Yes
 #floppyImage1 = ./disks/Sabotage.dsk
-# ???
+# ??? (//c or //e w/128K required)
 #floppyImage1 = ./disks/airheart.dsk
 # Yes
 #floppyImage1 = ./disks/drol.dsk
@@ -38,7 +38,7 @@ floppyImage1 = ./disks/bt1_boot.dsk
 #floppyImage1 = ./disks/wolfenstein_dos32.nib
 # Yes, keys???
 #floppyImage1 = ./disks/MidnightMagic_etc.dsk
-# ???
+# ??? (PRODOS 8 V1.4 - UNABLE TO LOAD ATINIT FILE)
 #floppyImage1 = ./disks/battle_chess_1.dsk
 # Yes 
 #floppyImage1 = ./disks/MoebiusI-1.dsk
index 932422e232f34af1c175daaf49154c7c1986eeb1..86eeeda3899919cc47c2fb9e947036f340ad1c2b 100755 (executable)
@@ -638,6 +638,7 @@ static void RenderHiRes(uint16 toLine/*= 192*/)
        uint32 pixelOn = (screenType == ST_WHITE_MONO ? 0xFFFFFFFF : 0xFF61FF61);
 #else
 // Now it is. Now roll this fix into all the other places... !!! FIX !!!
+// The colors are set in the 8-bit array as R G B A
        uint8 monoColors[8] = { 0xFF, 0xFF, 0xFF, 0xFF, 0x61, 0xFF, 0x61, 0xFF };
        uint32 * colorPtr = (uint32 *)monoColors;
        uint32 pixelOn = (screenType == ST_WHITE_MONO ? colorPtr[0] : colorPtr[1]);
index 25df4d0e95039a6349cafc92dc710f23fbd6dacb..be4207ca25cb6918a463d993cef5a8b587029769 100755 (executable)
@@ -53,18 +53,22 @@ DraggableWindow2::DraggableWindow2(uint32 x/*= 0*/, uint32 y/*= 0*/, uint32 w/*=
        uint16 imgHeight = (floppyDiskImg[2] << 8) | floppyDiskImg[3];
        img = SDL_CreateRGBSurfaceFrom(&floppyDiskImg[4], imgWidth, imgHeight, 32, imgWidth * 4,
                MASK_R, MASK_G, MASK_B, MASK_A);
-       label = SDL_CreateRGBSurface(SDL_SWSURFACE, 16*7, 32, 32,
-               MASK_R, MASK_G, MASK_B, MASK_A);
+//     label = SDL_CreateRGBSurface(SDL_SWSURFACE, 16*7, 32, 32,
+//             MASK_R, MASK_G, MASK_B, MASK_A);
 
 //Prolly should draw this in the constructor...
 //Now is! :-D
        extern char textChar2e[];
        uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8);
        SetNewFont(Font(fontAddr, 7, 8));
-       DrawStringOpaque(label, 0,  0, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo");
-       DrawStringOpaque(label, 0,  8, 0xFF000000, 0xFFFFFFFF, "0123456789012345");
-       DrawStringOpaque(label, 0, 16, 0xFF000000, 0xFFFFFFFF, "1234567890123456");
-       DrawStringOpaque(label, 0, 24, 0xFF000000, 0xFFFFFFFF, "2345678901234567");
+//     DrawStringOpaque(label, 0,  0, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo");
+//     DrawStringOpaque(label, 0,  8, 0xFF000000, 0xFFFFFFFF, "0123456789012345");
+//     DrawStringOpaque(label, 0, 16, 0xFF000000, 0xFFFFFFFF, "1234567890123456");
+//     DrawStringOpaque(label, 0, 24, 0xFF000000, 0xFFFFFFFF, "2345678901234567");
+       DrawStringOpaque(img, 8,  6, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo");
+       DrawStringOpaque(img, 8, 14, 0xFF000000, 0xFFFFFFFF, "t Disk6789012345");
+       DrawStringOpaque(img, 8, 22, 0xFF000000, 0xFFFFFFFF, "1234567890123456");
+       DrawStringOpaque(img, 6, 30, 0xFF000000, 0xFFFFFFFF, "2345678901234567");
        RestoreOldFont();
 #endif
 
@@ -84,7 +88,7 @@ printf("Inside ~DraggableWindow2()...\n");
 
 #ifdef BACKGROUND_IMG_TEST
        SDL_FreeSurface(img);
-       SDL_FreeSurface(label);
+//     SDL_FreeSurface(label);
 #endif
 }
 
@@ -112,6 +116,10 @@ void DraggableWindow2::HandleMouseMove(uint32 x, uint32 y)
                extents.x = newX;
                extents.y = newY;
                SaveScreenToBackstore();
+#ifdef USE_COVERAGE_LISTS
+//If we don't do this, the coverage list doesn't move with the window...!
+               ResetCoverageList();
+#endif
 //             SDL_BlitSurface(screen, &extents, backstore, NULL);
                Draw();
 
@@ -149,6 +157,7 @@ void DraggableWindow2::HandleMouseButton(uint32 x, uint32 y, bool mouseDown)
 
 void DraggableWindow2::Draw(void)
 {
+//NOTE: What we need to do here is render into a surface THEN do the blits from the coverage list. !!! FIX !!!
 #ifdef USE_COVERAGE_LISTS
        // These are *always* top level and parentless, so no need to traverse up through
        // the parent chain...
@@ -160,11 +169,12 @@ void DraggableWindow2::Draw(void)
                SDL_BlitSurface(img, &src, screen, &dst);
        }
 
+// HUH??!?!? The label should have been drawn into img already!!! !!! FIX !!! [DONE]
 //This doesn't get clipped at all... !!! FIX !!!
-       SDL_Rect src, dst;
-       src.x = 0, src.y = 0, src.w = label->w, src.h = label->h;
-       dst.x = extents.x + 8, dst.y = extents.y + 6;
-       SDL_BlitSurface(label, &src, screen, &dst);
+//     SDL_Rect src, dst;
+//     src.x = 0, src.y = 0, src.w = label->w, src.h = label->h;
+//     dst.x = extents.x + 8, dst.y = extents.y + 6;
+//     SDL_BlitSurface(label, &src, screen, &dst);
 
        // Handle the items this window contains...
        for(uint32 i=0; i<list.size(); i++)
@@ -180,14 +190,15 @@ void DraggableWindow2::Draw(void)
        dst.x = extents.x, dst.y = extents.y;
        SDL_BlitSurface(img, &src, screen, &dst);
 
-       extern char textChar2e[];
-       uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8);
-       SetNewFont(Font(fontAddr, 7, 8));
-       DrawStringOpaque(screen, extents.x + 8, extents.y +  6, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo");
-       DrawStringOpaque(screen, extents.x + 8, extents.y + 14, 0xFF000000, 0xFFFFFFFF, "0123456789012345");
-       DrawStringOpaque(screen, extents.x + 8, extents.y + 22, 0xFF000000, 0xFFFFFFFF, "1234567890123456");
-       DrawStringOpaque(screen, extents.x + 8, extents.y + 30, 0xFF000000, 0xFFFFFFFF, "2345678901234567");
-       RestoreOldFont();
+//WTF? Unnecessary!
+//     extern char textChar2e[];
+//     uint8 * fontAddr = (uint8 *)textChar2e + ((128 + 32) * 7 * 8);
+//     SetNewFont(Font(fontAddr, 7, 8));
+//     DrawStringOpaque(screen, extents.x + 8, extents.y +  6, 0xFF000000, 0xFFFFFFFF, "Ultima III - Boo");
+//     DrawStringOpaque(screen, extents.x + 8, extents.y + 14, 0xFF000000, 0xFFFFFFFF, "0123456789012345");
+//     DrawStringOpaque(screen, extents.x + 8, extents.y + 22, 0xFF000000, 0xFFFFFFFF, "1234567890123456");
+//     DrawStringOpaque(screen, extents.x + 8, extents.y + 30, 0xFF000000, 0xFFFFFFFF, "2345678901234567");
+//     RestoreOldFont();
 #else
        SDL_FillRect(screen, &extents, bgColor);
 #endif
index 47113ff0d283e4de5bc43576a91e1b57ec8a9815..0942ec944fd4c5d45278a63512d7a7e67393fc1a 100755 (executable)
@@ -26,7 +26,7 @@ class DraggableWindow2: public Window
 
        private:
                SDL_Surface * img;
-               SDL_Surface * label;
+//             SDL_Surface * label;
 };
 
 #endif // __DRAGGABLEWINDOW2_H__
index e9325c8fbb0e59268421218831b91cbc35ed6f64..fb6a00080bd9d19fd45ac53b56a8d4eba95cf6ef 100755 (executable)
@@ -192,7 +192,7 @@ WriteLog(" -- SDL_MOUSEMOTION\n");
 //Though, it seems to screw other things up. Maybe it IS better to pass it to all windows?
 //Or maybe to just the ones that aren't completely obscured?
 //Probably. Right now, a disk's close button that should be obscured by one sitting on
-//top of it gets redrawn. Not good.
+//top of it gets redrawn. Not good. !!! FIX !!!
                                for(i=windowList.begin(); i!=windowList.end(); i++)
                                        (*i)->HandleMouseMove(mouse.x, mouse.y);
 //                             windowList.back()->HandleMouseMove(mouse.x, mouse.y);
@@ -347,9 +347,12 @@ Also, when doing a window drag, the coverage lists for all windows have to be re
 //*misses* to everyone else... Otherwise, you can have overlapping draggable windows
 //and be able to drag both by clicking on a point that intersects both...
 //(though that may be an interesting way to handle things!)
+//The thing is that you want to do it on purpose (like with a special grouping widget)
+//instead of by accident. So, !!! FIX !!!
                                // Pass the click on to all windows
-                               for(i=windowList.begin(); i!=windowList.end(); i++)
-                                       (*i)->HandleMouseButton(event.button.x, event.button.y, true);
+//                             for(i=windowList.begin(); i!=windowList.end(); i++)
+//                                     (*i)->HandleMouseButton(event.button.x, event.button.y, true);
+                               windowList.back()->HandleMouseButton(event.button.x, event.button.y, true);
 
 //                             // & bail if nothing changed...
                                if (movedWindow)
@@ -360,6 +363,8 @@ Also, when doing a window drag, the coverage lists for all windows have to be re
 //the Z order where the previous window was.
                                for(i=windowList.begin(); i!=windowList.end(); i++)
                                {
+//One other little quirk: Probably need to clear the backing store as well!
+//Not sure...
                                        (*i)->ResetCoverageList();
 
                                        // This looks odd, but it's just a consequence of iterator weirdness.