mirror of
https://github.com/trudnai/Steve2.git
synced 2024-12-21 14:30:09 +00:00
Selectable Mono Color
This commit is contained in:
parent
ac36139d0d
commit
15b4b3252e
@ -1388,13 +1388,13 @@
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
<stackView distribution="fill" orientation="vertical" alignment="leading" horizontalStackHuggingPriority="249.99998474121094" verticalStackHuggingPriority="249.99998474121094" detachesHiddenViews="YES" translatesAutoresizingMaskIntoConstraints="NO" id="lVP-FP-u6x" userLabel="CPU Speed Selection">
|
||||
<rect key="frame" x="8" y="8" width="104" height="522"/>
|
||||
<rect key="frame" x="8" y="8" width="104" height="596"/>
|
||||
<subviews>
|
||||
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="7yw-J0-Fmj">
|
||||
<rect key="frame" x="0.0" y="519" width="96" height="5"/>
|
||||
<rect key="frame" x="0.0" y="593" width="96" height="5"/>
|
||||
</box>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="isd-yh-gCV">
|
||||
<rect key="frame" x="-2" y="497" width="98" height="18"/>
|
||||
<rect key="frame" x="-2" y="571" width="98" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="CRT Monitor" bezelStyle="regularSquare" imagePosition="left" inset="2" id="UQ8-Nn-Kt7">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
@ -1403,14 +1403,44 @@
|
||||
<action selector="CRTMonitorOnOff:" target="XfG-lQ-9wD" id="2V4-GI-erE"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="WzH-g6-yxF">
|
||||
<rect key="frame" x="-2" y="475" width="105" height="18"/>
|
||||
<buttonCell key="cell" type="check" title="Color Monitor" bezelStyle="regularSquare" imagePosition="left" state="on" inset="2" id="jLh-hF-6Z2">
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="kmk-ZV-ubT">
|
||||
<rect key="frame" x="-1" y="548" width="105" height="18"/>
|
||||
<buttonCell key="cell" type="radio" title="Color Monitor" bezelStyle="regularSquare" imagePosition="left" alignment="left" refusesFirstResponder="YES" state="on" inset="2" id="dIU-uM-oqn">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="ColorMonitorOnOff:" target="XfG-lQ-9wD" id="Aea-ZM-p6Q"/>
|
||||
<action selector="MonitorChange:" target="XfG-lQ-9wD" id="crt-Cx-eyx"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="hi6-xc-XvO">
|
||||
<rect key="frame" x="-1" y="524" width="95" height="18"/>
|
||||
<buttonCell key="cell" type="radio" title="White Mono" bezelStyle="regularSquare" imagePosition="left" alignment="left" refusesFirstResponder="YES" inset="2" id="NOI-xa-uDn">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="MonitorChange:" target="XfG-lQ-9wD" id="EqE-0v-Uap"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="0TV-RF-TRX">
|
||||
<rect key="frame" x="-1" y="500" width="97" height="18"/>
|
||||
<buttonCell key="cell" type="radio" title="Green Mono" bezelStyle="regularSquare" imagePosition="left" alignment="left" refusesFirstResponder="YES" inset="2" id="3IU-9X-jIe">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="MonitorChange:" target="XfG-lQ-9wD" id="Rbp-fx-YDU"/>
|
||||
</connections>
|
||||
</button>
|
||||
<button verticalHuggingPriority="750" translatesAutoresizingMaskIntoConstraints="NO" id="PDL-Db-4L2">
|
||||
<rect key="frame" x="-1" y="476" width="100" height="18"/>
|
||||
<buttonCell key="cell" type="radio" title="Amber Mono" bezelStyle="regularSquare" imagePosition="left" alignment="left" refusesFirstResponder="YES" inset="2" id="8c4-i2-4Tf">
|
||||
<behavior key="behavior" changeContents="YES" doesNotDimImage="YES" lightByContents="YES"/>
|
||||
<font key="font" metaFont="system"/>
|
||||
</buttonCell>
|
||||
<connections>
|
||||
<action selector="MonitorChange:" target="XfG-lQ-9wD" id="wrg-jk-a1b"/>
|
||||
</connections>
|
||||
</button>
|
||||
<box verticalHuggingPriority="750" boxType="separator" translatesAutoresizingMaskIntoConstraints="NO" id="t35-xh-L18">
|
||||
@ -1473,7 +1503,7 @@
|
||||
<rect key="frame" x="0.0" y="338" width="96" height="5"/>
|
||||
</box>
|
||||
<splitView hidden="YES" dividerStyle="thin" vertical="YES" translatesAutoresizingMaskIntoConstraints="NO" id="Ge3-qD-JO6">
|
||||
<rect key="frame" x="0.0" y="499" width="104" height="23"/>
|
||||
<rect key="frame" x="0.0" y="573" width="104" height="23"/>
|
||||
<subviews>
|
||||
<textField verticalHuggingPriority="750" fixedFrame="YES" id="SNE-lV-JXn" userLabel="SoundGap">
|
||||
<rect key="frame" x="0.0" y="0.0" width="90" height="23"/>
|
||||
@ -1677,6 +1707,9 @@
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
<integer value="1000"/>
|
||||
</visibilityPriorities>
|
||||
<customSpacing>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
@ -1707,6 +1740,9 @@
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
<real value="3.4028234663852886e+38"/>
|
||||
</customSpacing>
|
||||
</stackView>
|
||||
</subviews>
|
||||
|
@ -167,6 +167,9 @@ class HiRes: NSView {
|
||||
let color_turquis : UInt32 = 0xFF11BBBB;
|
||||
let color_yellow : UInt32 = 0xFFBBBB11;
|
||||
|
||||
// default is green
|
||||
var monoColor : UInt32 = 0xFF2BD84A;
|
||||
|
||||
|
||||
func refreshChanged( blockSize : Int ) {
|
||||
// refresh changed block only
|
||||
@ -193,14 +196,37 @@ class HiRes: NSView {
|
||||
}
|
||||
|
||||
|
||||
func UpdateMono() {
|
||||
blockChanged = [Bool](repeating: false, count: HiRes.blockRows * HiRes.blockCols)
|
||||
func RenderMono() {
|
||||
var height = HiRes.PixelHeight
|
||||
|
||||
// do not even render it...
|
||||
if videoMode.text == 1 {
|
||||
return
|
||||
}
|
||||
else {
|
||||
if videoMode.mixed == 1 {
|
||||
height = HiRes.MixedHeight
|
||||
}
|
||||
if MEMcfg.txt_page_2 == 1 {
|
||||
HiResBufferPointer = HiResBuffer2
|
||||
}
|
||||
else {
|
||||
HiResBufferPointer = HiResBuffer1
|
||||
}
|
||||
}
|
||||
|
||||
var pixelAddr = 0
|
||||
|
||||
var y = 0
|
||||
|
||||
blockChanged = [Bool](repeating: false, count: HiRes.blockRows * HiRes.blockCols)
|
||||
|
||||
for lineAddr in HiResLineAddrTbl {
|
||||
if ( height <= 0 ) {
|
||||
break
|
||||
}
|
||||
height -= 1
|
||||
|
||||
let blockVertIdx = y / HiRes.blockHeight * HiRes.blockCols
|
||||
|
||||
for blockHorIdx in 0..<HiRes.blockCols {
|
||||
@ -214,7 +240,7 @@ class HiRes: NSView {
|
||||
for bit in stride(from: 0, through: 6, by: 1) {
|
||||
let bitMask = 1 << bit
|
||||
if (block & bitMask) != 0 {
|
||||
HiRes.pixelsSRGB[pixelAddr] = color_green;
|
||||
HiRes.pixelsSRGB[pixelAddr] = monoColor;
|
||||
}
|
||||
else {
|
||||
HiRes.pixelsSRGB[pixelAddr] = color_black;
|
||||
@ -324,7 +350,7 @@ class HiRes: NSView {
|
||||
}
|
||||
|
||||
|
||||
func UpdateColor() {
|
||||
func RenderColor() {
|
||||
var height = HiRes.PixelHeight
|
||||
|
||||
// do not even render it...
|
||||
@ -368,14 +394,14 @@ class HiRes: NSView {
|
||||
let blockL = Int(HiResBufferPointer[ Int(lineAddr + blockHorIdx * 2) + 1 ])
|
||||
let blockL7 = ( blockL >> 5 ) & 0x04
|
||||
|
||||
let block = ( blockL << 7 ) | ( blockH & 0x7F ) & 0x3FFF
|
||||
let block8 = ( blockL << 8 ) | blockH
|
||||
let block = ( ( blockL & 0x7F ) << 7 ) | ( blockH & 0x7F )
|
||||
let block14 = ( blockL << 8 ) | blockH
|
||||
|
||||
let screenIdx = y * HiRes.blockCols + blockHorIdx
|
||||
|
||||
// get all changed blocks
|
||||
blockChanged[ blockVertIdx + blockHorIdx ] = blockChanged[ blockVertIdx + blockHorIdx ] || shadowScreen[ screenIdx ] != block8
|
||||
shadowScreen[ screenIdx ] = block8
|
||||
blockChanged[ blockVertIdx + blockHorIdx ] = blockChanged[ blockVertIdx + blockHorIdx ] || shadowScreen[ screenIdx ] != block14
|
||||
shadowScreen[ screenIdx ] = block14
|
||||
|
||||
for px in 0 ... 2 {
|
||||
// let bitMask = 3 << ( px * 2 )
|
||||
@ -408,19 +434,19 @@ class HiRes: NSView {
|
||||
|
||||
}
|
||||
|
||||
|
||||
func Update() {
|
||||
|
||||
func Render() {
|
||||
if ( ViewController.current?.ColorMonitor ?? true ) {
|
||||
UpdateColor()
|
||||
RenderColor()
|
||||
}
|
||||
else {
|
||||
UpdateMono()
|
||||
RenderMono()
|
||||
}
|
||||
}
|
||||
|
||||
func fullUpdate() {
|
||||
|
||||
func RenderFullScreen() {
|
||||
needsDisplay = true
|
||||
Update()
|
||||
Render()
|
||||
}
|
||||
|
||||
|
||||
|
@ -323,7 +323,7 @@ class LoRes: NSView {
|
||||
}
|
||||
|
||||
|
||||
func Update() {
|
||||
func Render() {
|
||||
var height = LoRes.PixelHeight / 2
|
||||
|
||||
// do not even render it...
|
||||
|
@ -22,6 +22,12 @@ let GB : Double = (MB * KB)
|
||||
let TB : Double = (GB * KB)
|
||||
|
||||
|
||||
let colorWhite = NSColor.init( red:0.9296875, green:0.9296875, blue:0.9296875, alpha: 1 )
|
||||
let colorGreen = NSColor.init( red:0.16796875, green:0.84375, blue:0.2890625, alpha: 1 )
|
||||
let colorOrange = NSColor.init( red:1, green:0.38671875, blue:0.0078125, alpha: 1 )
|
||||
|
||||
var monoColor = colorGreen;
|
||||
|
||||
var spk_up: AVAudioPlayer?
|
||||
var spk_dn: AVAudioPlayer?
|
||||
|
||||
@ -543,11 +549,9 @@ class ViewController: NSViewController {
|
||||
frameCnt += 1
|
||||
|
||||
if ( frameCnt == fpsHalf ) {
|
||||
// flashingSpace = blockChar
|
||||
ViewController.charConvTbl = ViewController.charConvTblFlashOn
|
||||
}
|
||||
else if ( frameCnt >= fps ) {
|
||||
// flashingSpace = spaceChar
|
||||
ViewController.charConvTbl = ViewController.charConvTblFlashOff
|
||||
frameCnt = 0
|
||||
}
|
||||
@ -578,7 +582,6 @@ class ViewController: NSViewController {
|
||||
self.txtArr[ y * (self.textCols * charDisposition + self.lineEndChars) + self.textCols * charDisposition] = "\n"
|
||||
}
|
||||
|
||||
|
||||
// 40 col
|
||||
if videoMode.col80 == 0 {
|
||||
if MEMcfg.txt_page_2 == 0 {
|
||||
@ -600,7 +603,7 @@ class ViewController: NSViewController {
|
||||
self.txtArr[ y * (self.textCols + self.lineEndChars) + self.textCols ] = "\n"
|
||||
}
|
||||
}
|
||||
// 80 col
|
||||
// 80 col
|
||||
else {
|
||||
let auxPage = ( MEMcfg.is_80STORE == 1 ) && ( MEMcfg.txt_page_2 == 1 )
|
||||
|
||||
@ -677,7 +680,7 @@ class ViewController: NSViewController {
|
||||
self.hires.isHidden = true
|
||||
}
|
||||
|
||||
self.lores.Update()
|
||||
self.lores.Render()
|
||||
}
|
||||
else {
|
||||
// when we change video mode, buffer needs to be cleared to avoid artifacts
|
||||
@ -690,7 +693,7 @@ class ViewController: NSViewController {
|
||||
self.lores.isHidden = true
|
||||
}
|
||||
|
||||
hires.Update()
|
||||
hires.Render()
|
||||
}
|
||||
}
|
||||
else if ( self.savedVideoMode.text == 0 ) {
|
||||
@ -983,12 +986,45 @@ class ViewController: NSViewController {
|
||||
@IBAction func CRTMonitorOnOff(_ sender: NSButton) {
|
||||
CRTMonitor = sender.state == .on
|
||||
scanLines.isHidden = !CRTMonitor
|
||||
hires.fullUpdate()
|
||||
hires.RenderFullScreen()
|
||||
}
|
||||
|
||||
@IBAction func ColorMonitorOnOff(_ sender: NSButton) {
|
||||
ColorMonitor = sender.state == .on
|
||||
hires.fullUpdate()
|
||||
hires.RenderFullScreen()
|
||||
|
||||
if ( ColorMonitor ) {
|
||||
display.textColor = colorWhite // .white
|
||||
}
|
||||
else {
|
||||
display.textColor = colorGreen // .green
|
||||
}
|
||||
}
|
||||
|
||||
@IBAction func MonitorChange(_ sender: NSButton) {
|
||||
switch sender.title {
|
||||
case "White Mono":
|
||||
ColorMonitor = false
|
||||
monoColor = colorWhite
|
||||
hires.monoColor = hires.color_white
|
||||
|
||||
case "Green Mono":
|
||||
ColorMonitor = false
|
||||
monoColor = colorGreen
|
||||
hires.monoColor = hires.color_green
|
||||
|
||||
case "Amber Mono":
|
||||
ColorMonitor = false
|
||||
monoColor = colorOrange
|
||||
hires.monoColor = hires.color_orange
|
||||
|
||||
default:
|
||||
ColorMonitor = true
|
||||
monoColor = colorWhite
|
||||
}
|
||||
|
||||
display.textColor = monoColor
|
||||
hires.RenderFullScreen()
|
||||
}
|
||||
|
||||
@IBAction func Keyboard2JoystickOnOff(_ sender: NSButton) {
|
||||
|
Loading…
Reference in New Issue
Block a user