/*----------------------------------------------------------------------------*/ /* Copyright (c) 2019-2020 FIRST. All Rights Reserved. */ /* Open Source Software - may be modified and shared by FRC teams. The code */ /* must be accompanied by the FIRST BSD license file in the root directory of */ /* the project. */ /*----------------------------------------------------------------------------*/ #pragma once #include #include #include #include #include #include #include namespace wpi::gui { struct SavedSettings { bool loadedWidthHeight = false; int width; int height; int maximized = 0; int xPos = -1; int yPos = -1; int userScale = 2; int style = 0; }; struct Font { static constexpr int kScaledLevels = 9; ImFont* scaled[kScaledLevels]; }; struct Context : public SavedSettings { std::atomic_bool exit{false}; std::string title; int defaultWidth; int defaultHeight; GLFWwindow* window = nullptr; std::vector> initializers; std::vector> windowScalers; std::vector>> makeFonts; ImVec4 clearColor = ImVec4(0.45f, 0.55f, 0.60f, 1.00f); std::vector> earlyExecutors; std::vector> lateExecutors; int fontScale = 2; // updated by main loop std::vector fonts; std::string iniPath = "imgui.ini"; }; 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