]> Shamusworld >> Repos - apple2/commitdiff
Fixed cross-compilation, added more GUI glue.
authorShamus Hammons <jlhamm@acm.org>
Wed, 26 Mar 2014 13:05:47 +0000 (08:05 -0500)
committerShamus Hammons <jlhamm@acm.org>
Wed, 26 Mar 2014 13:05:47 +0000 (08:05 -0500)
Makefile
cross-compile
src/gui/diskselector.cpp
src/gui/gui.cpp

index 017b7ec0d2cfa426a9cd5196ff32691fc7d77f6e..8f36aecd52cb7cb4f615fc3dcbfc767d8795f3cf 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -93,7 +93,8 @@ LDFLAGS =
 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -lgcov
 # Link in the gprof lib
 #LIBS = -L/usr/local/lib -L/usr/lib `sdl2-config $(SDLLIBTYPE)` -lstdc++ -lz $(GLLIB) -pg
-LIBS = -L/usr/local/lib -L/usr/lib $(SDL_LIBS) -lstdc++ -lz $(GLLIB) -pg
+#LIBS = -L/usr/local/lib -L/usr/lib $(SDL_LIBS) -lstdc++ -lz $(GLLIB) -pg
+LIBS = $(SDL_LIBS) -lstdc++ -lz $(GLLIB) -pg
 
 #INCS = -I. -I./src -I/usr/local/include -I/usr/include
 INCS = -I. -I./src
@@ -197,7 +198,7 @@ obj/%.o: src/gui/%.cpp
 
 $(TARGET)$(EXESUFFIX): $(OBJS)
        @echo -e "\033[01;33m***\033[00;32m Linking it all together...\033[00m"
-       @$(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
+       $(LD) $(LDFLAGS) -o $@ $(OBJS) $(LIBS)
 #      strip --strip-all vj$(EXESUFFIX)
 #      upx -9 vj$(EXESUFFIX)
 
index 517fc72c3be7c072384b5f2d50f2a997f43c46eb..ec0745077a8b1791682f7ea99e9f531a8ef85b0c 100755 (executable)
@@ -7,6 +7,7 @@
 #
 export PATH=/opt/mxe/usr/bin:$PATH
 make CROSS=i686-pc-mingw32- clean  && make CROSS=i686-pc-mingw32-
+upx -9v apple2.exe
 
 #TARGET = apple2
 #echo "Cross compiling $(TARGET) for Win32..."
index d8fc6c1fa5ca38377a605c88b49d4d0503419213..69db0e7f178904ca747d3fe636809bd0e9aaeaf3 100644 (file)
@@ -201,7 +201,7 @@ void DiskSelector::DrawCharacter(SDL_Renderer * renderer, int x, int y, uint8_t
 
        SDL_SetRenderDrawColor(renderer, 0x00, 0x00, 0x00, 0x00);
 #else
-       uint32_t pixel = 0xFFFFA000;
+       uint32_t pixel = 0xFFFFA020;
        uint8_t * ptr = (uint8_t *)&font10pt[(c - 0x20) * FONT_WIDTH * FONT_HEIGHT];
        SDL_Rect dst;
        dst.x = x * FONT_WIDTH, dst.y = y * FONT_HEIGHT, dst.w = FONT_WIDTH, dst.h = FONT_HEIGHT;
index 6865d5feb193efae54bbab9b0da579417e63ccb9..29358c8be844b65e57e2415251110683c650afa3 100644 (file)
@@ -115,6 +115,9 @@ const char iconHelp[7][80] = { "Turn emulated Apple off/on",
        "Insert floppy image into drive #1", "Insert floppy image into drive #2",
        "Swap disks", "Save emulator state", "Load emulator state",
        "Configure Apple2" };
+bool disk1EjectHovered = false;
+bool disk2EjectHovered = false;
+
 
 #define SIDEBAR_X_POS  (VIRTUAL_SCREEN_WIDTH - 80)
 
@@ -204,6 +207,48 @@ SDL_Texture * GUI::CreateTexture(SDL_Renderer * renderer, const void * source)
 
 void GUI::MouseDown(int32_t x, int32_t y, uint32_t buttons)
 {
+       if (sidebarState != SBS_SHOWN)
+               return;
+
+       switch (iconSelected)
+       {
+       // Power
+       case 0:
+               SpawnMessage("*** POWER ***");
+               break;
+       // Disk #1
+       case 1:
+               SpawnMessage("*** DISK #1 ***");
+
+               if (disk1EjectHovered && !floppyDrive.IsEmpty(0))
+                       SpawnMessage("*** EJECT DISK #1 ***");
+
+               break;
+       // Disk #2
+       case 2:
+               SpawnMessage("*** DISK #2 ***");
+
+               if (disk2EjectHovered && !floppyDrive.IsEmpty(1))
+                       SpawnMessage("*** EJECT DISK #2 ***");
+
+               break;
+       // Swap disks
+       case 3:
+               SpawnMessage("*** SWAP DISKS ***");
+               break;
+       // Save state
+       case 4:
+               SpawnMessage("*** SAVE STATE ***");
+               break;
+       // Load state
+       case 5:
+               SpawnMessage("*** LOAD STATE ***");
+               break;
+       // Configuration
+       case 6:
+               SpawnMessage("*** CONFIGURATION ***");
+               break;
+       }
 }
 
 
@@ -252,6 +297,17 @@ void GUI::MouseMove(int32_t x, int32_t y, uint32_t buttons)
                        else
                                iconSelected = (y - 4) / 54;
 
+                       // It's y+2 because the sidebar sits at (SIDEBAR_X_POS, 2)
+                       disk1EjectHovered = ((x >= (SIDEBAR_X_POS + 24 + 29))
+                               && (x < (SIDEBAR_X_POS + 24 + 29 + 8))
+                               && (y >= (63 + 31 + 2))
+                               && (y < (63 + 31 + 2 + 7))) ? true : false);
+
+                       disk2EjectHovered = ((x >= (SIDEBAR_X_POS + 24 + 29))
+                               && (x < (SIDEBAR_X_POS + 24 + 29 + 8))
+                               && (y >= (117 + 31 + 2))
+                               && (y < (117 + 31 + 2 + 7)) ? true : false);
+
                        if (iconSelected != lastIconSelected)
                        {
                                HandleIconSelection(sdlRenderer);
@@ -335,7 +391,14 @@ void GUI::DrawEjectButton(SDL_Renderer * renderer, int driveNumber)
        if (floppyDrive.IsEmpty(driveNumber))
                return;
 
-       DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, 0x00, 0xAA, 0x00);
+       uint8_t r = 0x00, g = 0xAA, b = 0x00;
+
+       if ((driveNumber == 0 && disk1EjectHovered)
+               || (driveNumber == 1 && disk2EjectHovered))
+               r = 0x20, g = 0xFF, b = 0x20;
+
+//     DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, 0x00, 0xAA, 0x00);
+       DrawCharArray(renderer, ejectIcon, 29, 31, 8, 7, r, g, b);
 }