2017-01-02 21:07:43 -05:00
|
|
|
// Copyright (c) Charles J. Cliffe
|
|
|
|
// SPDX-License-Identifier: GPL-2.0+
|
|
|
|
|
2015-06-20 20:19:52 -04:00
|
|
|
#include "UITestContext.h"
|
|
|
|
#include "UITestCanvas.h"
|
|
|
|
#include "ColorTheme.h"
|
|
|
|
|
|
|
|
UITestContext::UITestContext(UITestCanvas *canvas, wxGLContext *sharedContext) :
|
2016-07-06 23:16:25 -04:00
|
|
|
PrimaryGLContext(canvas, sharedContext), testMeter("TEST",0,100,50) {
|
2015-06-21 11:58:14 -04:00
|
|
|
|
2015-06-20 20:19:52 -04:00
|
|
|
testPanel.setPosition(0.0, 0.0);
|
|
|
|
testPanel.setSize(1.0, 1.0);
|
2015-06-27 01:26:07 -04:00
|
|
|
testPanel.setMarginPx(10);
|
2016-07-06 23:16:25 -04:00
|
|
|
testPanel.setFill(GLPanel::GLPANEL_FILL_SOLID);
|
|
|
|
testPanel.setFillColor(RGBA4f(0.0,0.0,1.0));
|
2015-06-21 11:58:14 -04:00
|
|
|
|
2015-06-20 20:19:52 -04:00
|
|
|
testChildPanel.setPosition(0.0, 0.0);
|
2015-07-06 23:05:49 -04:00
|
|
|
testChildPanel.setMarginPx(5);
|
2016-06-01 19:42:34 -04:00
|
|
|
testChildPanel.setSize(1.0f, 0.33f);
|
2015-07-06 23:05:49 -04:00
|
|
|
testChildPanel.setCoordinateSystem(GLPanel::GLPANEL_Y_DOWN_ZERO_ONE);
|
2015-06-21 11:58:14 -04:00
|
|
|
testChildPanel.setFill(GLPanel::GLPANEL_FILL_GRAD_BAR_X);
|
2015-08-17 21:52:38 -04:00
|
|
|
testChildPanel.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
|
2015-06-27 01:26:07 -04:00
|
|
|
testChildPanel.setBorderPx(1);
|
2015-06-21 11:58:14 -04:00
|
|
|
|
2016-06-01 19:42:34 -04:00
|
|
|
testChildPanel2.setPosition(0.0f, -0.66f);
|
|
|
|
testChildPanel2.setSize(1.0f, 0.33f);
|
2015-07-06 23:05:49 -04:00
|
|
|
testChildPanel2.setMarginPx(5);
|
2015-06-21 11:58:14 -04:00
|
|
|
testChildPanel2.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
|
2015-08-17 21:52:38 -04:00
|
|
|
testChildPanel2.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
|
|
|
|
testChildPanel2.setBorderColor(RGBA4f(1.0,0.0,0.0));
|
2015-06-27 01:55:39 -04:00
|
|
|
testChildPanel2.setBorderPx(1);
|
2015-07-05 18:54:46 -04:00
|
|
|
|
2016-06-01 19:42:34 -04:00
|
|
|
testChildPanel3.setPosition(0.0f, 0.66f);
|
|
|
|
testChildPanel3.setSize(1.0f, 0.33f);
|
2015-07-06 23:05:49 -04:00
|
|
|
testChildPanel3.setMarginPx(5);
|
2015-07-05 18:54:46 -04:00
|
|
|
testChildPanel3.setFill(GLPanel::GLPANEL_FILL_GRAD_X);
|
2015-08-17 21:52:38 -04:00
|
|
|
testChildPanel3.setFillColor(RGBA4f(0.0,0.0,1.0), RGBA4f(0.0,1.0,0.0));
|
|
|
|
testChildPanel3.setBorderColor(RGBA4f(1.0,0.0,0.0));
|
2015-07-05 18:54:46 -04:00
|
|
|
testChildPanel3.setBorderPx(1);
|
|
|
|
|
2015-07-01 00:34:32 -04:00
|
|
|
testText1.setText("Testing 123..");
|
|
|
|
testText1.setFill(GLPanel::GLPANEL_FILL_NONE);
|
|
|
|
testChildPanel2.addChild(&testText1);
|
|
|
|
|
2016-07-06 23:16:25 -04:00
|
|
|
// testPanel.addChild(&testChildPanel);
|
|
|
|
// testPanel.addChild(&testChildPanel2);
|
|
|
|
// testPanel.addChild(&testChildPanel3);
|
2017-01-28 08:57:27 -05:00
|
|
|
testMeter.setSize(0.1f,0.9f);
|
2016-07-06 23:16:25 -04:00
|
|
|
testPanel.addChild(&testMeter);
|
2015-06-20 20:19:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void UITestContext::DrawBegin() {
|
|
|
|
glDisable(GL_CULL_FACE);
|
|
|
|
glDisable(GL_DEPTH_TEST);
|
|
|
|
|
|
|
|
glClearColor(ThemeMgr::mgr.currentTheme->generalBackground.r, ThemeMgr::mgr.currentTheme->generalBackground.g, ThemeMgr::mgr.currentTheme->generalBackground.b, 1.0);
|
|
|
|
glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
|
|
|
|
|
|
|
|
glMatrixMode(GL_MODELVIEW);
|
|
|
|
glLoadIdentity();
|
|
|
|
|
|
|
|
glDisable(GL_TEXTURE_2D);
|
|
|
|
}
|
|
|
|
|
|
|
|
void UITestContext::Draw() {
|
2015-07-05 19:10:48 -04:00
|
|
|
testPanel.calcTransform(CubicVR::mat4::identity());
|
|
|
|
testPanel.draw();
|
2015-06-20 20:19:52 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void UITestContext::DrawEnd() {
|
2016-03-31 20:24:38 -04:00
|
|
|
// glFlush();
|
2015-06-20 20:19:52 -04:00
|
|
|
|
2016-03-31 20:24:38 -04:00
|
|
|
// CheckGLError();
|
2015-06-20 20:19:52 -04:00
|
|
|
}
|
|
|
|
|