- [FIX] El cursor es mostra sempre damunt de les finestres zx_screen i z80debug
- [FIX] el dibuixat del crosshair en la finestra z80analyze causaba potencialment una escritura fora de rang - [NEW] Refresc de la finestra z80analyze millorat
This commit is contained in:
@@ -12,6 +12,8 @@ namespace z80analyze
|
||||
SDL_Texture *tex = nullptr;
|
||||
SDL_Texture *uitex = nullptr;
|
||||
uint16_t address = 0;
|
||||
int mx, my;
|
||||
bool needs_refresh = true;
|
||||
|
||||
void refreshTitle();
|
||||
|
||||
@@ -34,8 +36,11 @@ namespace z80analyze
|
||||
{
|
||||
if (e->motion.windowID == SDL_GetWindowID(win)) {
|
||||
SDL_ShowCursor(SDL_DISABLE);
|
||||
mx = e->motion.x/2;
|
||||
my = e->motion.y/2;
|
||||
|
||||
refreshTitle();
|
||||
refresh();
|
||||
needs_refresh=true;
|
||||
focus();
|
||||
}
|
||||
}
|
||||
@@ -70,15 +75,17 @@ namespace z80analyze
|
||||
char tmp[10];
|
||||
void refreshTitle()
|
||||
{
|
||||
int mx, my;
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
mx/=2; my/=2;
|
||||
address = mx+my*256;
|
||||
SDL_SetWindowTitle(win, SDL_itoa(address, tmp, 16));
|
||||
if (mx>=0 && my>=0 && mx<256 && my<256) {
|
||||
address = mx+my*256;
|
||||
SDL_SetWindowTitle(win, SDL_itoa(address, tmp, 16));
|
||||
}
|
||||
}
|
||||
void refresh()
|
||||
void refresh(const bool conditional)
|
||||
{
|
||||
if (!win) return;
|
||||
if (conditional && !needs_refresh) return;
|
||||
needs_refresh = false;
|
||||
|
||||
ui::setrenderer(ren, uitex);
|
||||
|
||||
Uint32 *pixels;
|
||||
@@ -94,17 +101,16 @@ namespace z80analyze
|
||||
}
|
||||
pixels[z80::getPC()] = 0xFFFFFF;
|
||||
|
||||
int mx, my;
|
||||
SDL_GetMouseState(&mx, &my);
|
||||
mx/=2; my/=2;
|
||||
pixels[(mx-2)+(my)*256] = 0x000000;
|
||||
pixels[(mx-1)+(my)*256] = 0x000000;
|
||||
pixels[(mx+1)+(my)*256] = 0x000000;
|
||||
pixels[(mx+2)+(my)*256] = 0x000000;
|
||||
pixels[(mx)+(my-1)*256] = 0x000000;
|
||||
pixels[(mx)+(my-2)*256] = 0x000000;
|
||||
pixels[(mx)+(my+1)*256] = 0x000000;
|
||||
pixels[(mx)+(my+2)*256] = 0x000000;
|
||||
if (mx>=0 && my>=0 && mx<256 && my<256) {
|
||||
if (mx>2) pixels[(mx-2)+(my)*256] = 0x000000;
|
||||
if (mx>1) pixels[(mx-1)+(my)*256] = 0x000000;
|
||||
if (mx<255) pixels[(mx+1)+(my)*256] = 0x000000;
|
||||
if (mx<254) pixels[(mx+2)+(my)*256] = 0x000000;
|
||||
if (my>1) pixels[(mx)+(my-1)*256] = 0x000000;
|
||||
if (my>2) pixels[(mx)+(my-2)*256] = 0x000000;
|
||||
if (my<255) pixels[(mx)+(my+1)*256] = 0x000000;
|
||||
if (my<254) pixels[(mx)+(my+2)*256] = 0x000000;
|
||||
}
|
||||
|
||||
SDL_UnlockTexture(tex);
|
||||
SDL_RenderCopy(ren, tex, NULL, NULL);
|
||||
|
||||
Reference in New Issue
Block a user