Dump of macOS tests, starting integrating some code, very WIP

This commit is contained in:
falkTX 2021-10-07 21:23:11 +01:00
parent 093ef1d39c
commit d6dcdfff55
8 changed files with 593 additions and 22 deletions

View file

@ -14,19 +14,92 @@
* CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#include <app/common.hpp>
#include <app/Scene.hpp>
#include <context.hpp>
#include <engine/Engine.hpp>
#include <patch.hpp>
#include <ui/common.hpp>
#include <window/Window.hpp>
#include "DistrhoUI.hpp"
GLFWAPI const char* glfwGetClipboardString(GLFWwindow* window) { return nullptr; }
GLFWAPI void glfwSetClipboardString(GLFWwindow* window, const char*) {}
GLFWAPI const char* glfwGetKeyName(int key, int scancode) { return nullptr; }
GLFWAPI int glfwGetKeyScancode(int key) { return 0; }
namespace rack {
namespace window {
DISTRHO_NAMESPACE::UI* lastUI = nullptr;
}
}
START_NAMESPACE_DISTRHO
// -----------------------------------------------------------------------------------------------------------
struct Initializer {
Initializer()
{
using namespace rack;
ui::init();
window::init();
}
~Initializer()
{
using namespace rack;
window::destroy();
ui::destroy();
}
};
static Initializer& getInitializerInstance()
{
static Initializer init;
return init;
}
class CVCRackUI : public UI
{
public:
CVCRackUI()
: UI(128, 512)
: UI(1280, 720)
{
setGeometryConstraints(32, 128, false);
using namespace rack;
// Initialize context
INFO("Initializing context");
window::lastUI = this;
contextSet(new Context);
APP->engine = new engine::Engine;
APP->history = new history::State;
APP->event = new widget::EventState;
APP->scene = new app::Scene;
APP->event->rootWidget = APP->scene;
APP->patch = new patch::Manager;
/*if (!settings::headless)*/ {
APP->window = new window::Window;
}
window::lastUI = nullptr;
APP->engine->startFallbackThread();
}
~CVCRackUI() override
{
using namespace rack;
delete APP;
contextSet(NULL);
}
void onNanoDisplay() override
{
APP->window->step();
}
protected:
@ -41,16 +114,6 @@ protected:
{
}
/* --------------------------------------------------------------------------------------------------------
* Widget Callbacks */
/**
The drawing function.
*/
void onDisplay() override
{
}
// -------------------------------------------------------------------------------------------------------
private:
@ -65,6 +128,7 @@ private:
UI* createUI()
{
getInitializerInstance();
return new CVCRackUI();
}