diff --git a/openBeken_win32_mvsc2017.vcxproj b/openBeken_win32_mvsc2017.vcxproj
index db16fc558..51e7b39b9 100644
--- a/openBeken_win32_mvsc2017.vcxproj
+++ b/openBeken_win32_mvsc2017.vcxproj
@@ -573,19 +573,35 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
true
true
diff --git a/openBeken_win32_mvsc2017.vcxproj.filters b/openBeken_win32_mvsc2017.vcxproj.filters
index 75711587e..808ba70c7 100644
--- a/openBeken_win32_mvsc2017.vcxproj.filters
+++ b/openBeken_win32_mvsc2017.vcxproj.filters
@@ -503,6 +503,54 @@
Simulator
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
+
+ Simulator
+
diff --git a/src/debug_tuyaMCUsimulator.c b/src/debug_tuyaMCUsimulator.c
index 6452985a7..5cc613b24 100644
--- a/src/debug_tuyaMCUsimulator.c
+++ b/src/debug_tuyaMCUsimulator.c
@@ -7,6 +7,8 @@ const char *dataToSimulate[] =
// dummy entry in order to avoid problems with empty table
"",
#if 1
+
+#elif 0
"55AA00050005010400010110",
"55AA0005000501040001000F"
#elif 0
diff --git a/src/sim/Junction.cpp b/src/sim/Junction.cpp
index 3d4451f19..28d52ded4 100644
--- a/src/sim/Junction.cpp
+++ b/src/sim/Junction.cpp
@@ -21,7 +21,7 @@ CShape *CJunction::cloneShape() {
float CJunction::drawInformation2D(float x, float h) {
h = CShape::drawInformation2D(x, h);
- h = drawText(x, h, "Position: %f %f", getX(), getY());
+ h = drawText(NULL, x, h, "Position: %f %f", getX(), getY());
return h;
}
bool CJunction::isWireJunction() const {
diff --git a/src/sim/Shape.cpp b/src/sim/Shape.cpp
index 2706d77b5..4be5a4a4a 100644
--- a/src/sim/Shape.cpp
+++ b/src/sim/Shape.cpp
@@ -58,16 +58,16 @@ CShape *CShape::cloneShape() {
}
float CShape::drawPrivateInformation2D(float x, float h) {
- h = drawText(x, h, "Position: %f %f", this->getX(), getY());
+ h = drawText(NULL, x, h, "Position: %f %f", this->getX(), getY());
return h;
}
float CShape::drawInformation2D(float x, float h) {
- h = drawText(x, h, "ClassName: %s, int. name %s", this->getClassName(), this->getName());
+ h = drawText(NULL, x, h, "ClassName: %s, int. name %s", this->getClassName(), this->getName());
h = drawPrivateInformation2D(x, h);
if (shapes.size()) {
- h = drawText(x, h, "SubShapes: %i", shapes.size());
+ h = drawText(NULL, x, h, "SubShapes: %i", shapes.size());
for (int i = 0; i < shapes.size(); i++) {
- h = drawText(x + 20, h, "SubShape: %i/%i", i, shapes.size());
+ h = drawText(NULL, x + 20, h, "SubShape: %i/%i", i, shapes.size());
h = shapes[i]->drawInformation2D(x + 40, h);
}
}
diff --git a/src/sim/Simulation.cpp b/src/sim/Simulation.cpp
index b16560d4c..e84cc415f 100644
--- a/src/sim/Simulation.cpp
+++ b/src/sim/Simulation.cpp
@@ -28,7 +28,7 @@ void CSimulation::removeJunction(class CJunction *ju) {
junctions.remove(ju);
}
int CSimulation::drawTextStats(int h) {
- h = drawText(10, h, "Objects %i, wires %i", objects.size(), wires.size());
+ h = drawText(NULL, 10, h, "Objects %i, wires %i", objects.size(), wires.size());
return h;
}
void CSimulation::recalcBounds() {
diff --git a/src/sim/Simulator.cpp b/src/sim/Simulator.cpp
index 5b98cf86a..9acba0309 100644
--- a/src/sim/Simulator.cpp
+++ b/src/sim/Simulator.cpp
@@ -149,19 +149,19 @@ void CSimulator::drawWindow() {
glOrtho(0.0f, WinWidth, WinHeight, 0.0f, 0.0f, 1.0f);
int h = 40;
- h = drawText(10, h, "OpenBeken Simulator");
+ h = drawText(NULL, 10, h, "OpenBeken Simulator");
if (sim != 0) {
h = sim->drawTextStats(h);
}
if (activeTool != 0) {
- h = drawText(10, h, "Active Tool: %s", activeTool->getName());
+ h = drawText(NULL, 10, h, "Active Tool: %s", activeTool->getName());
h = activeTool->drawTextStats(h);
}
if (currentlyEditingText) {
- h = drawText(10, h, "You are currently editing a text field.");
+ h = drawText(NULL, 10, h, "You are currently editing a text field.");
}
glColor3f(1.0f, 0.0f, 0.0f);
- drawText(260, 40, "WARNING: The following sketch may not be a correct circuit schematic. Connections in this simulator are simplified.");
+ drawText(&g_style_text_red, 260, 40, "WARNING: The following sketch may not be a correct circuit schematic. Connections in this simulator are simplified.");
glColor3f(0.7f, 0.7f, 0.7f);
glLineWidth(0.25f);
diff --git a/src/sim/Text.cpp b/src/sim/Text.cpp
index 0a1c8b630..17022fe7f 100644
--- a/src/sim/Text.cpp
+++ b/src/sim/Text.cpp
@@ -98,17 +98,17 @@ void CText::drawShape() {
buffer[cursorPos] = 0;
strcat(buffer, "|");
strcat(buffer, txt.c_str()+ cursorPos);
- drawText(getX(), getY(), buffer);
+ drawText(NULL, getX(), getY(), buffer);
}
else {
- drawText(getX(), getY(), txt.c_str());
+ drawText(NULL, getX(), getY(), txt.c_str());
}
}
float CText::drawPrivateInformation2D(float x, float h) {
- h = drawText(x, h, "Text: %s", this->txt.c_str());
+ h = drawText(NULL, x, h, "Text: %s", this->txt.c_str());
return h;
}
diff --git a/src/sim/Tool_Info.cpp b/src/sim/Tool_Info.cpp
index cf5694558..3778a36d8 100644
--- a/src/sim/Tool_Info.cpp
+++ b/src/sim/Tool_Info.cpp
@@ -26,7 +26,7 @@ void Tool_Info::drawTool() {
//h = drawString(pos.getX(), h, "Nothing");
}
else {
- h = drawText(pos.getX(), h, "Nothing");
+ h = drawText(NULL, pos.getX(), h, "Nothing");
}
}
diff --git a/src/sim/Tool_Move.cpp b/src/sim/Tool_Move.cpp
index 1960d9c9a..f7be8a97c 100644
--- a/src/sim/Tool_Move.cpp
+++ b/src/sim/Tool_Move.cpp
@@ -18,14 +18,14 @@ void Tool_Move::onEnd() {
int Tool_Move::drawTextStats(int h) {
if (currentTarget) {
if (bMovingButtonHeld) {
- h = drawText(20, h, "Moving %s", currentTarget->getClassName());
+ h = drawText(NULL, 20, h, "Moving %s", currentTarget->getClassName());
}
else {
- h = drawText(20, h, "Last target %s", currentTarget->getClassName());
+ h = drawText(NULL, 20, h, "Last target %s", currentTarget->getClassName());
}
}
else {
- h = drawText(20, h, "No target");
+ h = drawText(NULL, 20, h, "No target");
}
return h;
}
diff --git a/src/sim/sim_local.h b/src/sim/sim_local.h
index 93c56036c..c26881eba 100644
--- a/src/sim/sim_local.h
+++ b/src/sim/sim_local.h
@@ -32,7 +32,7 @@ enum {
#define WINDOWS_MOUSE_MENUBAR_OFFSET 20
-int drawText(int x, int y, const char* fmt, ...);
+int drawText(class CStyle *style, int x, int y, const char* fmt, ...);
#include "Coord.h"
Coord roundToGrid(Coord c);
Coord GetMousePos();
@@ -169,6 +169,7 @@ public:
extern CStyle g_style_shapes;
extern CStyle g_style_wires;
extern CStyle g_style_text;
+extern CStyle g_style_text_red;
#endif
#endif
diff --git a/src/sim/sim_sdl.cpp b/src/sim/sim_sdl.cpp
index 0babbcd1c..917f211f9 100644
--- a/src/sim/sim_sdl.cpp
+++ b/src/sim/sim_sdl.cpp
@@ -31,6 +31,7 @@ int WinHeight = 940;
CStyle g_style_shapes(CColor(165, 75, 75), 3.0f);
CStyle g_style_wires(CColor(75, 165, 75), 3.0f);
CStyle g_style_text(CColor(131, 131, 131), 3.0f);
+CStyle g_style_text_red(CColor(255, 131, 131), 3.0f);
int drawTextInternal(float x, float y, const char *buffer) {
glRasterPos2f(x, y);
@@ -49,7 +50,7 @@ int drawTextInternal(float x, float y, const char *buffer) {
return y;
}
-int drawText(int x, int y, const char* fmt, ...) {
+int drawText(class CStyle *style, int x, int y, const char* fmt, ...) {
va_list argList;
char buffer2[512];
char buffer[512];
@@ -57,7 +58,12 @@ int drawText(int x, int y, const char* fmt, ...) {
vsnprintf(buffer2, sizeof(buffer2), fmt, argList);
va_end(argList);
CMD_ExpandConstantsWithinString(buffer2, buffer, sizeof(buffer));
- g_style_text.apply();
+ if (style == 0) {
+ g_style_text.apply();
+ }
+ else {
+ style->apply();
+ }
float ret = drawTextInternal(x, y, buffer);
drawTextInternal(x + 0.5f, y + 0.5f, buffer);
drawTextInternal(x - 0.5f, y - 0.5f, buffer);