// Copyright (c) FIRST and other WPILib contributors. // Open Source Software; you can modify and/or share it under the terms of // the WPILib BSD license file in the root directory of this project. #pragma once #include #include #include #include #include #include #include namespace wpi::gui { struct SavedSettings { bool loadedWidthHeight = false; int width; int height; bool maximized = false; int xPos = -1; int yPos = -1; int userScale = 100; int style = 0; int fps = 120; std::string defaultFontName = "Proggy Dotted"; }; struct Context : public SavedSettings { std::atomic_bool exit{false}; std::string title; int defaultWidth; int defaultHeight; bool isPlatformRendering{false}; GLFWwindow* window = nullptr; std::function loadSettings; std::function loadIniSettings; std::function saveSettings; std::vector> initializers; std::vector> windowScalers; class FontMaker { public: FontMaker( std::string name, std::function func) : name{std::move(name)}, func{std::move(func)} {} const std::string& GetName() const { return name; } ImFont* GetFont() const; private: std::string name; mutable ImFont* font = nullptr; std::function func; }; std::vector makeFonts; ImVec4 clearColor = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); std::vector> earlyExecutors; std::vector> lateExecutors; std::vector icons; std::string iniPath = "imgui.ini"; bool resetOnExit = false; }; extern Context* gContext; void PlatformCreateContext(); void PlatformDestroyContext(); void PlatformGlfwInitHints(); void PlatformGlfwWindowHints(); bool PlatformInitRenderer(); void PlatformRenderFrame(); void PlatformShutdown(); void PlatformFramebufferSizeChanged(int width, int height); void CommonRenderFrame(); } // namespace wpi::gui