Fix windows build, cleanup

Signed-off-by: falkTX <falktx@falktx.com>
This commit is contained in:
falkTX 2021-10-19 14:49:18 +01:00
parent 0dce76052e
commit 2ccdd992bc
No known key found for this signature in database
GPG key ID: CDBAA37ABC74FBA0
4 changed files with 20 additions and 46 deletions

View file

@ -28,5 +28,6 @@
# undef far
# undef near
# define ABC ABC_
# define Chord Chord_
# define VOID VOID_
#endif

View file

@ -24,7 +24,7 @@ PLUGIN_FILES = plugins.cpp
PLUGIN_FILES += $(filter-out AmalgamatedHarmonics/src/AH.cpp,$(wildcard AmalgamatedHarmonics/src/*.cpp))
# modules/types which are present in other plugins
AMALGAMATEDHARMONICS_CUSTOM = BasePinkNoiseGenerator LowFrequencyOscillator Pattern PinkNoiseGenerator RedNoiseGenerator
AMALGAMATEDHARMONICS_CUSTOM = BasePinkNoiseGenerator EvenVCO LowFrequencyOscillator Pattern PinkNoiseGenerator RedNoiseGenerator
# --------------------------------------------------------------
# AnimatedCircuits
@ -38,7 +38,7 @@ PLUGIN_FILES += $(filter-out AS/src/AS.cpp,$(wildcard AS/src/*.cpp))
PLUGIN_FILES += AS/freeverb/revmodel.cpp
# modules/types which are present in other plugins
AS_CUSTOM = ADSR LabelDisplayWidget LowFrequencyOscillator Param VCA allpass comb revmodel
AS_CUSTOM = ADSR LabelDisplayWidget LowFrequencyOscillator VCA allpass comb revmodel
# --------------------------------------------------------------
# AudibleInstruments
@ -145,9 +145,6 @@ PLUGIN_FILES += AudibleInstruments/eurorack/streams/compressor.cc
PLUGIN_FILES += $(filter-out Befaco/src/plugin.cpp,$(wildcard Befaco/src/*.cpp))
PLUGIN_BINARIES += Befaco/src/SpringReverbIR.pcm
# modules/types which are present in other plugins
BEFACO_CUSTOM = EvenVCO
# --------------------------------------------------------------
# Bidoo

View file

@ -34,7 +34,12 @@ GLFWAPI int glfwGetKeyScancode(int key) { return 0; }
namespace rack {
namespace window {
DISTRHO_NAMESPACE::UI* lastUI = nullptr;
struct Window::Internal {
int mods;
DISTRHO_NAMESPACE::UI* ui;
// more stuff below
};
void WindowInit(Window* window, DISTRHO_NAMESPACE::UI* ui);
}
}
@ -77,11 +82,8 @@ public:
fContext->scene = new rack::app::Scene;
fContext->event->rootWidget = fContext->scene;
// Initialize context
d_stdout("UI context ptr %p", NanoVG::getContext());
rack::window::lastUI = this;
fContext->window = new rack::window::Window;
rack::window::lastUI = nullptr;
rack::window::WindowInit(fContext->window, this);
// Hide non-wanted menu entries
typedef rack::ui::Button rButton;

View file

@ -23,7 +23,6 @@
namespace rack {
namespace window {
extern DISTRHO_NAMESPACE::UI* lastUI;
static const math::Vec minWindowSize = math::Vec(640, 480);
@ -69,8 +68,9 @@ std::shared_ptr<Image> Image::load(const std::string& filename) {
struct Window::Internal {
DISTRHO_NAMESPACE::UI* ui;
math::Vec size;
int mods = 0;
DISTRHO_NAMESPACE::UI* ui = nullptr;
math::Vec size = minWindowSize;
std::string lastWindowTitle;
@ -88,24 +88,22 @@ struct Window::Internal {
Window::Window() {
internal = new Internal;
internal->ui = lastUI;
internal->size = minWindowSize;
int err;
}
void WindowInit(Window* const window, DISTRHO_NAMESPACE::UI* const ui)
{
const GLubyte* vendor = glGetString(GL_VENDOR);
const GLubyte* renderer = glGetString(GL_RENDERER);
const GLubyte* version = glGetString(GL_VERSION);
INFO("Renderer: %s %s", vendor, renderer);
INFO("OpenGL: %s", version);
INFO("UI pointer: %p", lastUI);
vg = lastUI->getContext();
fbVg = nvgCreateSharedGL2(vg, NVG_ANTIALIAS);
window->vg = ui->getContext();
window->fbVg = nvgCreateSharedGL2(window->vg, NVG_ANTIALIAS);
// Load default Blendish font
uiFont = loadFont(asset::system("res/fonts/DejaVuSans.ttf"));
bndSetFont(uiFont->handle);
window->uiFont = window->loadFont(asset::system("res/fonts/DejaVuSans.ttf"));
bndSetFont(window->uiFont->handle);
if (APP->scene) {
widget::Widget::ContextCreateEvent e;
@ -113,7 +111,6 @@ Window::Window() {
}
}
Window::~Window() {
if (APP->scene) {
widget::Widget::ContextDestroyEvent e;
@ -326,28 +323,5 @@ bool& Window::fbDirtyOnSubpixelChange() {
}
void mouseButtonCallback(Context* ctx, int button, int action, int mods) {
}
void cursorPosCallback(Context* ctx, double xpos, double ypos) {
}
void cursorEnterCallback(Context* ctx, int entered) {
if (!entered) {
ctx->event->handleLeave();
}
}
void scrollCallback(Context* ctx, double x, double y) {
}
void charCallback(Context* ctx, unsigned int codepoint) {
}
void keyCallback(Context* ctx, int key, int scancode, int action, int mods) {
}
} // namespace window
} // namespace rack