forked from Apple-2-Tools/jace
Issue #13: Added monochrome modes and ctrl+shift+g switches between various display modes.
This commit is contained in:
parent
3123ee1eec
commit
3f115624e6
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package jace;
|
package jace;
|
||||||
|
|
||||||
|
import com.sun.javafx.tk.quantum.OverlayWarning;
|
||||||
import jace.apple2e.MOS65C02;
|
import jace.apple2e.MOS65C02;
|
||||||
import jace.apple2e.RAM128k;
|
import jace.apple2e.RAM128k;
|
||||||
import jace.apple2e.SoftSwitches;
|
import jace.apple2e.SoftSwitches;
|
||||||
@ -497,6 +498,12 @@ public class EmulatorUILogic implements Reconfigurable {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void notify(String message) {
|
||||||
|
if (JaceApplication.singleton != null) {
|
||||||
|
JaceApplication.singleton.controller.displayNotification(message);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return "Jace User Interface";
|
return "Jace User Interface";
|
||||||
|
@ -34,6 +34,7 @@ import javafx.event.EventHandler;
|
|||||||
import javafx.fxml.FXML;
|
import javafx.fxml.FXML;
|
||||||
import javafx.geometry.Insets;
|
import javafx.geometry.Insets;
|
||||||
import javafx.scene.control.Label;
|
import javafx.scene.control.Label;
|
||||||
|
import javafx.scene.effect.DropShadow;
|
||||||
import javafx.scene.image.ImageView;
|
import javafx.scene.image.ImageView;
|
||||||
import javafx.scene.input.DragEvent;
|
import javafx.scene.input.DragEvent;
|
||||||
import javafx.scene.input.KeyEvent;
|
import javafx.scene.input.KeyEvent;
|
||||||
@ -241,4 +242,28 @@ public class JaceUIController {
|
|||||||
public void removeMouseListener(EventHandler<MouseEvent> handler) {
|
public void removeMouseListener(EventHandler<MouseEvent> handler) {
|
||||||
appleScreen.removeEventHandler(MouseEvent.ANY, handler);
|
appleScreen.removeEventHandler(MouseEvent.ANY, handler);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Label currentNotification = null;
|
||||||
|
public void displayNotification(String message) {
|
||||||
|
if (currentNotification != null) {
|
||||||
|
Label remove = currentNotification;
|
||||||
|
Application.invokeLater(() -> {
|
||||||
|
stackPane.getChildren().remove(remove);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
Label notification = new Label(message);
|
||||||
|
notification.setEffect(new DropShadow(1.0, Color.DARKGREY));
|
||||||
|
notification.setTextFill(Color.WHITE);
|
||||||
|
Application.invokeLater(() -> {
|
||||||
|
stackPane.getChildren().add(notification);
|
||||||
|
});
|
||||||
|
currentNotification = notification;
|
||||||
|
|
||||||
|
notificationExecutor.schedule(()->{
|
||||||
|
Application.invokeLater(() -> {
|
||||||
|
stackPane.getChildren().remove(notification);
|
||||||
|
currentNotification = null;
|
||||||
|
});
|
||||||
|
}, 4, TimeUnit.SECONDS);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -635,7 +635,7 @@ public class VideoDHGR extends Video {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
static final Color BLACK = Color.BLACK;
|
static final Color BLACK = Color.BLACK;
|
||||||
static final Color WHITE = Color.WHITE;
|
static Color WHITE = Color.WHITE;
|
||||||
static final int[][] XY_OFFSET;
|
static final int[][] XY_OFFSET;
|
||||||
|
|
||||||
static {
|
static {
|
||||||
|
@ -18,8 +18,11 @@
|
|||||||
*/
|
*/
|
||||||
package jace.apple2e;
|
package jace.apple2e;
|
||||||
|
|
||||||
|
import jace.Emulator;
|
||||||
|
import jace.EmulatorUILogic;
|
||||||
import static jace.apple2e.VideoDHGR.BLACK;
|
import static jace.apple2e.VideoDHGR.BLACK;
|
||||||
import jace.config.ConfigurableField;
|
import jace.config.ConfigurableField;
|
||||||
|
import jace.config.InvokableAction;
|
||||||
import jace.core.Computer;
|
import jace.core.Computer;
|
||||||
import jace.core.RAM;
|
import jace.core.RAM;
|
||||||
import jace.core.RAMEvent;
|
import jace.core.RAMEvent;
|
||||||
@ -29,6 +32,7 @@ import java.util.HashSet;
|
|||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
import javafx.scene.image.PixelWriter;
|
import javafx.scene.image.PixelWriter;
|
||||||
import javafx.scene.image.WritableImage;
|
import javafx.scene.image.WritableImage;
|
||||||
|
import javafx.scene.paint.Color;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a clean color monitor simulation, complete with text-friendly
|
* Provides a clean color monitor simulation, complete with text-friendly
|
||||||
@ -68,6 +72,67 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
registerStateListeners();
|
registerStateListeners();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static enum VideoMode {
|
||||||
|
Color("Color"),
|
||||||
|
TextFriendly("Text-friendly color"),
|
||||||
|
Mode7("Mode7 Mixed RGB"),
|
||||||
|
Mode7TextFriendly("Mode7 with Text-friendly palette"),
|
||||||
|
Monochrome("Mono"),
|
||||||
|
Greenscreen("Green"),
|
||||||
|
Amber("Amber");
|
||||||
|
String name;
|
||||||
|
VideoMode(String n) {
|
||||||
|
name = n;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static int currentMode = -1;
|
||||||
|
@InvokableAction(name = "Toggle video mode",
|
||||||
|
category = "video",
|
||||||
|
alternatives = "mode,color,b&w,monochrome",
|
||||||
|
defaultKeyMapping = {"ctrl+shift+g"})
|
||||||
|
public static void changeVideoMode() {
|
||||||
|
VideoNTSC thiss = (VideoNTSC) Emulator.computer.video;
|
||||||
|
currentMode++;
|
||||||
|
if (currentMode >= VideoMode.values().length) {
|
||||||
|
currentMode = 0;
|
||||||
|
}
|
||||||
|
thiss.monochomeMode = false;
|
||||||
|
WHITE = Color.WHITE;
|
||||||
|
switch (VideoMode.values()[currentMode]) {
|
||||||
|
case Amber:
|
||||||
|
thiss.monochomeMode = true;
|
||||||
|
WHITE = Color.web("ff8000");
|
||||||
|
break;
|
||||||
|
case Greenscreen:
|
||||||
|
thiss.monochomeMode = true;
|
||||||
|
WHITE = Color.web("0ccc68");
|
||||||
|
break;
|
||||||
|
case Monochrome:
|
||||||
|
thiss.monochomeMode = true;
|
||||||
|
break;
|
||||||
|
case Color:
|
||||||
|
thiss.useTextPalette = false;
|
||||||
|
thiss.enableVideo7 = false;
|
||||||
|
break;
|
||||||
|
case Mode7:
|
||||||
|
thiss.useTextPalette = false;
|
||||||
|
thiss.enableVideo7 = true;
|
||||||
|
break;
|
||||||
|
case Mode7TextFriendly:
|
||||||
|
thiss.useTextPalette = true;
|
||||||
|
thiss.enableVideo7 = true;
|
||||||
|
break;
|
||||||
|
case TextFriendly:
|
||||||
|
thiss.useTextPalette = true;
|
||||||
|
thiss.enableVideo7 = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
thiss.activePalette = thiss.useTextPalette ? TEXT_PALETTE : SOLID_PALETTE;
|
||||||
|
EmulatorUILogic.notify("Video mode: "+VideoMode.values()[currentMode].name);
|
||||||
|
forceRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void showBW(WritableImage screen, int x, int y, int dhgrWord) {
|
protected void showBW(WritableImage screen, int x, int y, int dhgrWord) {
|
||||||
int pos = divBy28[x];
|
int pos = divBy28[x];
|
||||||
@ -169,6 +234,7 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
boolean monochomeMode = false;
|
||||||
private void renderScanline(WritableImage screen, int y) {
|
private void renderScanline(WritableImage screen, int y) {
|
||||||
int p = 0;
|
int p = 0;
|
||||||
if (rowStart != 0) {
|
if (rowStart != 0) {
|
||||||
@ -202,7 +268,7 @@ public class VideoNTSC extends VideoDHGR {
|
|||||||
boolean mixed = enableVideo7 && dhgrMode && graphicsMode == rgbMode.MIX;
|
boolean mixed = enableVideo7 && dhgrMode && graphicsMode == rgbMode.MIX;
|
||||||
for (int i = 0; i < 28; i++) {
|
for (int i = 0; i < 28; i++) {
|
||||||
if (i % 7 == 0) {
|
if (i % 7 == 0) {
|
||||||
isBW = !colorActive[byteCounter] || (mixed && !hiresMode && !useColor[byteCounter]);
|
isBW = monochomeMode || !colorActive[byteCounter] || (mixed && !hiresMode && !useColor[byteCounter]);
|
||||||
byteCounter++;
|
byteCounter++;
|
||||||
}
|
}
|
||||||
if (isBW) {
|
if (isBW) {
|
||||||
|
@ -18,6 +18,7 @@
|
|||||||
*/
|
*/
|
||||||
package jace.core;
|
package jace.core;
|
||||||
|
|
||||||
|
import jace.Emulator;
|
||||||
import jace.state.Stateful;
|
import jace.state.Stateful;
|
||||||
import jace.config.ConfigurableField;
|
import jace.config.ConfigurableField;
|
||||||
import jace.config.InvokableAction;
|
import jace.config.InvokableAction;
|
||||||
@ -273,11 +274,13 @@ public abstract class Video extends Device {
|
|||||||
category = "display",
|
category = "display",
|
||||||
description = "Marks screen contents as changed, forcing full screen redraw",
|
description = "Marks screen contents as changed, forcing full screen redraw",
|
||||||
alternatives = "redraw",
|
alternatives = "redraw",
|
||||||
defaultKeyMapping = "ctrl+shift+r")
|
defaultKeyMapping = {"ctrl+shift+r"})
|
||||||
public final void forceRefresh() {
|
public static final void forceRefresh() {
|
||||||
lineDirty = true;
|
if (Emulator.computer != null && Emulator.computer.video != null) {
|
||||||
screenDirty = true;
|
Emulator.computer.video.lineDirty = true;
|
||||||
forceRedrawRowCount = APPLE_SCREEN_LINES + 1;
|
Emulator.computer.video.screenDirty = true;
|
||||||
|
Emulator.computer.video.forceRedrawRowCount = APPLE_SCREEN_LINES + 1;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user