mirror of
https://github.com/ivanizag/izapple2.git
synced 2024-09-22 19:59:13 +00:00
Support for inverse and flash in text mode
This commit is contained in:
parent
9fcd499241
commit
90250cdf3e
@ -6,6 +6,7 @@ import (
|
|||||||
"image/color"
|
"image/color"
|
||||||
"image/png"
|
"image/png"
|
||||||
"os"
|
"os"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
// Snapshot the currently visible screen
|
// Snapshot the currently visible screen
|
||||||
@ -101,12 +102,13 @@ func getTextChar(a *Apple2, col int, line int, page int) uint8 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func snapshotTextMode(a *Apple2, page int) *image.RGBA {
|
func snapshotTextMode(a *Apple2, page int) *image.RGBA {
|
||||||
// TODO: Missing inverse and flash modes
|
|
||||||
|
|
||||||
// Color for typical Apple ][ period green phosphor monitors
|
// Color for typical Apple ][ period green phosphor monitors
|
||||||
// See: https://superuser.com/questions/361297/what-colour-is-the-dark-green-on-old-fashioned-green-screen-computer-displays
|
// See: https://superuser.com/questions/361297/what-colour-is-the-dark-green-on-old-fashioned-green-screen-computer-displays
|
||||||
p1GreenPhosphorColor := color.RGBA{65, 255, 0, 255}
|
p1GreenPhosphorColor := color.RGBA{65, 255, 0, 255}
|
||||||
|
|
||||||
|
// Flash mode is 2Hz
|
||||||
|
isFlashedFrame := time.Now().Nanosecond() > (1 * 1000 * 1000 * 1000 / 2)
|
||||||
|
|
||||||
width := textColumns * charWidth
|
width := textColumns * charWidth
|
||||||
height := textLines * charHeight
|
height := textLines * charHeight
|
||||||
size := image.Rect(0, 0, width, height)
|
size := image.Rect(0, 0, width, height)
|
||||||
@ -119,7 +121,12 @@ func snapshotTextMode(a *Apple2, page int) *image.RGBA {
|
|||||||
rowInChar := y % charHeight
|
rowInChar := y % charHeight
|
||||||
colInChar := x % charWidth
|
colInChar := x % charWidth
|
||||||
char := getTextChar(a, col, line, page)
|
char := getTextChar(a, col, line, page)
|
||||||
|
topBits := char >> 6
|
||||||
|
isInverse := topBits == 0
|
||||||
|
isFlash := topBits == 1
|
||||||
|
|
||||||
pixel := a.cg.getPixel(char, rowInChar, colInChar)
|
pixel := a.cg.getPixel(char, rowInChar, colInChar)
|
||||||
|
pixel = pixel != (isInverse || (isFlash && isFlashedFrame))
|
||||||
var colour color.Color
|
var colour color.Color
|
||||||
if pixel {
|
if pixel {
|
||||||
colour = p1GreenPhosphorColor
|
colour = p1GreenPhosphorColor
|
||||||
|
Loading…
Reference in New Issue
Block a user