Start implementing "config mode" graphics

I still need to re-do most of the rendering system to throw out all the
jank, but this feels like a half-decent start imo.

Yes, every page is just a separate .png file. I'm lazy. That works.
This commit is contained in:
InvisibleUp 2020-07-01 22:11:38 -04:00
parent 5c930e348e
commit fa4bbacf3a
17 changed files with 120 additions and 195 deletions

BIN
gfx/bootdlg/base.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gfx/bootdlg/model.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

BIN
gfx/bootdlg/model_se30.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

BIN
gfx/bootdlg/start.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.2 KiB

View File

@ -38,7 +38,7 @@ conf = configuration_data({
# Enable about dialog # Enable about dialog
'NeedDoAboutMsg': 1, 'NeedDoAboutMsg': 1,
# Enable Control Mode (options menu) # Enable Control Mode (options menu)
'UseControlKeys': 1, 'UseControlKeys': 0,
# Include international characters for Control Mode # Include international characters for Control Mode
'NeedIntlChars': 0, 'NeedIntlChars': 0,
# Force keyboard to match Mac layout on Windows # Force keyboard to match Mac layout on Windows
@ -131,34 +131,22 @@ MAC_SRC = {
} }
# User interface definitions # User interface definitions
UI_SRC = { UI_SRC = [
'WIN32': [ 'src/UI/COMOSGLU.c',
'src/UI/COMOSGLU.c', 'src/UI/CONTROLM.c',
'src/UI/CONTROLM.c', 'src/UI/CONFIGM.c',
'src/UI/WIN32/DBGLOG.c', 'src/UI/SDL2/OSGLUSD2.c',
'src/UI/WIN32/INTLKBRD.c', #'src/UI/SDL2/CLIPBRD.c',
'src/UI/WIN32/KEYBOARD.c', 'src/UI/SDL2/DBGLOG.c',
'src/UI/WIN32/OSGLUWIN.c', 'src/UI/SDL2/DRIVES.c',
'src/UI/WIN32/SOUND.c', 'src/UI/SDL2/INTL.c',
'src/UI/WIN32/TIMEDATE.c', 'src/UI/SDL2/KEYBOARD.c',
'rsrc/WIN32/main.rc', 'src/UI/SDL2/MOUSE.c',
], 'src/UI/SDL2/ROM.c',
'SDL2': [ 'src/UI/SDL2/SOUND.c',
'src/UI/COMOSGLU.c', 'src/UI/SDL2/TIMEDATE.c',
'src/UI/CONTROLM.c', 'src/UI/SDL2/VIDEO.c',
'src/UI/SDL2/OSGLUSD2.c', ]
#'src/UI/SDL2/CLIPBRD.c',
'src/UI/SDL2/DBGLOG.c',
'src/UI/SDL2/DRIVES.c',
'src/UI/SDL2/INTL.c',
'src/UI/SDL2/KEYBOARD.c',
'src/UI/SDL2/MOUSE.c',
'src/UI/SDL2/ROM.c',
'src/UI/SDL2/SOUND.c',
'src/UI/SDL2/TIMEDATE.c',
'src/UI/SDL2/VIDEO.c',
]
}
EMU_SRC = [ EMU_SRC = [
'src/PROGMAIN.c', 'src/PROGMAIN.c',
@ -177,7 +165,7 @@ EMU_INC = include_directories([
# Just gonna do an SDL2 Mac Plus for now # Just gonna do an SDL2 Mac Plus for now
executable( executable(
'microvmac', 'microvmac',
sources: MAC_SRC['Plus'] + UI_SRC['SDL2'] + EMU_SRC, sources: MAC_SRC['Plus'] + UI_SRC + EMU_SRC,
dependencies: [lSDL2], dependencies: [lSDL2],
include_directories: EMU_INC, include_directories: EMU_INC,
) )

53
src/HW/SCREEN/SCRNMAPR.c Normal file
View File

@ -0,0 +1,53 @@
/*
HW/SCREEN/SCRNMAPR.h
Copyright (C) 2012 Paul C. Pratt
You can redistribute this file and/or modify it under the terms
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
license for more details.
*/
/*
SCReeN MAPpeR
*/
#include "SCRNMAPR.h"
#include <assert.h>
void ScrnMapr_DoMap(
rect_t region, rect_t bounds,
const color_t *src, color_t *dst,
uint8_t src_depth, uint8_t dst_depth,
const color_t *map, uint8_t scale
) {
/* check of parameters */
assert(src_depth >= 0);
assert(src_depth <= 3);
assert(dst_depth >= src_depth);
/* define variables */
int x, y, sx, sy; // loop vars
uint16_t line_width = bounds.right - bounds.left;
for (y = region.top; y < region.bottom; y += 1)
{
for (sy = 0; sy < scale - 1; sy += 1)
{
for (x = region.left; x < region.right; x += 1)
{
color_t color = src[(y+sy)*line_width + x];
for (sx = 0; sx < scale - 1; sx += 1)
{
dst[(y+sy)*line_width + x*scale + sx] = map[color];
}
}
}
}
}

View File

@ -1,168 +1,19 @@
/* /* SCRNMAPR.h */
HW/SCREEN/SCRNMAPR.h #include <stdint.h>
#pragma once
Copyright (C) 2012 Paul C. Pratt typedef struct {
uint16_t top;
uint16_t left;
uint16_t right;
uint16_t bottom;
} rect_t;
You can redistribute this file and/or modify it under the terms typedef uint32_t color_t;
of version 2 of the GNU General Public License as published by
the Free Software Foundation. You should have received a copy
of the license along with this file; see the file COPYING.
This file is distributed in the hope that it will be useful, // Copy a rectangular bitmap region, scaling and converting color depth as needed
but WITHOUT ANY WARRANTY; without even the implied warranty of void ScrnMapr_DoMap(
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the rect_t bounds,
license for more details. const uint8_t *src, uint8_t *dst, uint8_t src_depth, uint8_t dst_depth,
*/ const uint8_t *map, uint8_t scale
);
/*
SCReeN MAPpeR
*/
/* required arguments for this template */
#ifndef ScrnMapr_DoMap /* procedure to be created by this template */
#error "ScrnMapr_DoMap not defined"
#endif
#ifndef ScrnMapr_Src
#error "ScrnMapr_Src not defined"
#endif
#ifndef ScrnMapr_Dst
#error "ScrnMapr_Dst not defined"
#endif
#ifndef ScrnMapr_SrcDepth
#error "ScrnMapr_SrcDepth not defined"
#endif
#ifndef ScrnMapr_DstDepth
#error "ScrnMapr_DstDepth not defined"
#endif
#ifndef ScrnMapr_Map
#error "ScrnMapr_Map not defined"
#endif
/* optional argument for this template */
#ifndef ScrnMapr_Scale
#define ScrnMapr_Scale 1
#endif
/* check of parameters */
#if (ScrnMapr_SrcDepth < 0) || (ScrnMapr_SrcDepth > 3)
#error "bad ScrnMapr_SrcDepth"
#endif
#if (ScrnMapr_DstDepth < ScrnMapr_SrcDepth)
#error "bad ScrnMapr_Dst"
#endif
/* calculate a few things local to this template */
#define ScrnMapr_MapElSz \
(ScrnMapr_Scale << (ScrnMapr_DstDepth - ScrnMapr_SrcDepth))
#if 0 == (ScrnMapr_MapElSz & 3)
#define ScrnMapr_TranT uint32_t
#define ScrnMapr_TranLn2Sz 2
#elif 0 == (ScrnMapr_MapElSz & 1)
#define ScrnMapr_TranT uint16_t
#define ScrnMapr_TranLn2Sz 1
#else
#define ScrnMapr_TranT uint8_t
#define ScrnMapr_TranLn2Sz 0
#endif
#define ScrnMapr_TranN (ScrnMapr_MapElSz >> ScrnMapr_TranLn2Sz)
#define ScrnMapr_ScrnWB (vMacScreenWidth >> (3 - ScrnMapr_SrcDepth))
/* now define the procedure */
LOCALPROC ScrnMapr_DoMap(int16_t top, int16_t left,
int16_t bottom, int16_t right)
{
int i;
int j;
#if (ScrnMapr_TranN > 4) || (ScrnMapr_Scale > 2)
int k;
#endif
uint32_t t0;
ScrnMapr_TranT *pMap;
#if ScrnMapr_Scale > 1
ScrnMapr_TranT *p3;
#endif
uint16_t leftB = left >> (3 - ScrnMapr_SrcDepth);
uint16_t rightB = (right + (1 << (3 - ScrnMapr_SrcDepth)) - 1)
>> (3 - ScrnMapr_SrcDepth);
uint16_t jn = rightB - leftB;
uint16_t SrcSkip = ScrnMapr_ScrnWB - jn;
uint8_t *pSrc = ((uint8_t *)ScrnMapr_Src)
+ leftB + ScrnMapr_ScrnWB * (uint32_t)top;
ScrnMapr_TranT *pDst = ((ScrnMapr_TranT *)ScrnMapr_Dst)
+ ((leftB + ScrnMapr_ScrnWB * ScrnMapr_Scale * (uint32_t)top)
* ScrnMapr_TranN);
uint32_t DstSkip = SrcSkip * ScrnMapr_TranN;
for (i = bottom - top; --i >= 0; ) {
#if ScrnMapr_Scale > 1
p3 = pDst;
#endif
for (j = jn; --j >= 0; ) {
t0 = *pSrc++;
pMap =
&((ScrnMapr_TranT *)ScrnMapr_Map)[t0 * ScrnMapr_TranN];
#if ScrnMapr_TranN > 4
for (k = ScrnMapr_TranN; --k >= 0; ) {
*pDst++ = *pMap++;
}
#else
#if ScrnMapr_TranN >= 2
*pDst++ = *pMap++;
#endif
#if ScrnMapr_TranN >= 3
*pDst++ = *pMap++;
#endif
#if ScrnMapr_TranN >= 4
*pDst++ = *pMap++;
#endif
*pDst++ = *pMap;
#endif /* ! ScrnMapr_TranN > 4 */
}
pSrc += SrcSkip;
pDst += DstSkip;
#if ScrnMapr_Scale > 1
#if ScrnMapr_Scale > 2
for (k = ScrnMapr_Scale - 1; --k >= 0; )
#endif
{
pMap = p3;
for (j = ScrnMapr_TranN * jn; --j >= 0; ) {
*pDst++ = *pMap++;
}
pDst += DstSkip;
}
#endif /* ScrnMapr_Scale > 1 */
}
}
/* undefine template locals and parameters */
#undef ScrnMapr_ScrnWB
#undef ScrnMapr_TranN
#undef ScrnMapr_TranLn2Sz
#undef ScrnMapr_TranT
#undef ScrnMapr_MapElSz
#undef ScrnMapr_DoMap
#undef ScrnMapr_Src
#undef ScrnMapr_Dst
#undef ScrnMapr_SrcDepth
#undef ScrnMapr_DstDepth
#undef ScrnMapr_Map
#undef ScrnMapr_Scale

22
src/UI/CONFIGM.c Normal file
View File

@ -0,0 +1,22 @@
/*
* CONFIG Mode
*
* A replacement for Control Mode, with prettier grapgics and actual settings
*
*/
#include <SDL2.h> // everything else is deprecated now
#include <stdlib.h>
#include <stdint.h>
#include "CONFIGM.h"
#include "UI/SDL2/OSGLUSD2.h"
/* -- Public Functions -- */
void ConfigMode_Tick()
{
// Get the screen context and just draw something there for now
SDL_SetRenderDrawColor(renderer, 255, 255, 255, 255);
SDL_RenderDrawRect(renderer, {.x = 16, .y = 16, .w = 128, .h = 128});
}

11
src/UI/CONFIGM.h Normal file
View File

@ -0,0 +1,11 @@
/*
* CONFIG Mode
*
* A replacement for Control Mode, with prettier grapgics and actual settings
*
*/
/* -- functions -- */
// Run this once every frame, I guess
void ConfigMode_Tick();