Fixed cross-compilation, added more GUI glue.
This commit is contained in:
parent
c7beef2408
commit
0574860ec5
5
Makefile
5
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)
|
||||
|
||||
|
|
|
@ -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..."
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue