+ calling ControlRegisterUpdated Event

~ fixed setPixel performance
This commit is contained in:
Julian Hinxlage 2019-12-04 13:08:21 +01:00
parent 128951d856
commit 9ced919be4
2 changed files with 15 additions and 4 deletions

View File

@ -50,18 +50,21 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->layout_version = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto setCharactersPerColumn(int newValue) -> void {
lockSharedMemory();
getRegisters()->characters_per_column = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto setCharactersPerRow(int newValue) -> void {
lockSharedMemory();
getRegisters()->characters_per_row = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto setMousePosition(int x, int y) -> void {
@ -69,6 +72,7 @@ namespace vkvm {
getRegisters()->mouse_pos_x = x;
getRegisters()->mouse_pos_y = y;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto buttonPressed(KeyCode keyCode) -> void {

View File

@ -18,7 +18,6 @@ namespace vkvm {
auto setDefaultValues() -> void {
impl.localMemoryWarn = false;
if (getSharedMemory() != nullptr) {
//set default values
setMode(GraphicMode::RGB);
setCharactersPerRow(60);
setCharactersPerColumn(20);
@ -67,7 +66,7 @@ namespace vkvm {
if (x > getWidth() || y > getHeight()) {
return false;
}
lockSharedMemory();
//lockSharedMemory();
auto reg = getRegisters();
const int bitsPerPixel = 8;
@ -111,7 +110,7 @@ namespace vkvm {
break;
}
}
unlockSharedMemory();
//unlockSharedMemory();
return true;
}
@ -164,7 +163,7 @@ namespace vkvm {
auto setText(std::string text) -> bool {
lockSharedMemory();
char *ptr = getTextArea();
for (int i = 0; i < text.size(); i++) {
for (int i = 0; i < static_cast<int>(text.size()); i++) {
if (i < getCharactersPerColumn() * getCharactersPerRow()) {
ptr[i] = text[i];
}
@ -209,6 +208,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->width_pixels = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getHeight() -> int {
@ -219,6 +219,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->height_pixels = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getMode() -> GraphicMode {
@ -254,6 +255,7 @@ namespace vkvm {
reg->graphicMode = newValue;
}
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getRedrawInterval() -> int {
@ -264,6 +266,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->autoRedrawInterval = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getTimerInterruptInterval() -> int {
@ -274,6 +277,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->timerInterruptInterval = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getBackgroundColor() -> Color {
@ -284,6 +288,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->background_color = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getForegroundColor() -> Color {
@ -294,6 +299,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->foreground_color = newValue;
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getCharactersPerRow() -> int {
@ -314,6 +320,7 @@ namespace vkvm {
lockSharedMemory();
getRegisters()->textMode_font = newValue.getId();
unlockSharedMemory();
callEvent(EventType::UpdateControlRegisters);
}
auto getMousePosition() -> Coordinates {