aboutsummaryrefslogtreecommitdiffstats
path: root/source/main.cpp
diff options
context:
space:
mode:
authorClyne Sullivan <clyne@bitgloo.com>2022-01-09 12:28:19 -0500
committerClyne Sullivan <clyne@bitgloo.com>2022-01-09 12:28:19 -0500
commit1b176cf6cd75c8031a140961655cdd3c16589a68 (patch)
tree8415664e40a9a768d8c3a35fd81252bfdefb72f9 /source/main.cpp
parentfde531e7c44ea917f745a9f800178fbe83fa19b5 (diff)
small changes; sig gen square(), triangle(), pulse()
Diffstat (limited to 'source/main.cpp')
-rw-r--r--source/main.cpp48
1 files changed, 26 insertions, 22 deletions
diff --git a/source/main.cpp b/source/main.cpp
index 5eac338..e8641bc 100644
--- a/source/main.cpp
+++ b/source/main.cpp
@@ -19,37 +19,31 @@
#include <chrono>
#include <cmath>
+#include <iostream>
#include <string>
#include <thread>
-extern ImFont *fontSans;
-extern ImFont *fontMono;
-
-bool guiInitialize();
-bool guiHandleEvents();
-void guiShutdown();
-void guiRender(void (*func)());
-
-void fileRenderMenu();
-void fileRenderDialog();
-void fileInit();
-
void codeEditorInit();
void codeRenderMenu();
void codeRenderToolbar();
void codeRenderWidgets();
-
void deviceRenderDraw();
void deviceRenderMenu();
void deviceRenderToolbar();
void deviceRenderWidgets();
+void fileRenderMenu();
+void fileRenderDialog();
+void fileInit();
+bool guiInitialize();
+bool guiHandleEvents();
+void guiShutdown();
+void guiRender();
-static LogView logView;
+void log(const std::string& str);
-void log(const std::string& str)
-{
- logView.AddLog(str);
-}
+static LogView logView;
+static ImFont *fontSans = nullptr;
+static ImFont *fontMono = nullptr;
static void renderWindow();
@@ -58,6 +52,14 @@ int main(int, char **)
if (!guiInitialize())
return -1;
+ auto& io = ImGui::GetIO();
+ fontSans = io.Fonts->AddFontFromFileTTF("fonts/Roboto-Regular.ttf", 20);
+ fontMono = io.Fonts->AddFontFromFileTTF("fonts/RobotoMono-Regular.ttf", 20);
+ if (fontSans == nullptr || fontMono == nullptr) {
+ std::cout << "Failed to load fonts!" << std::endl;
+ return -1;
+ }
+
codeEditorInit();
fileInit();
@@ -78,6 +80,11 @@ int main(int, char **)
return 0;
}
+void log(const std::string& str)
+{
+ logView.AddLog(str);
+}
+
void renderWindow()
{
// Start the new window frame and render the menu bar.
@@ -124,9 +131,6 @@ void renderWindow()
deviceRenderDraw();
// Draw everything to the screen.
- ImGui::Render();
- guiRender([] {
- ImGui_ImplOpenGL2_RenderDrawData(ImGui::GetDrawData());
- });
+ guiRender();
}