Cleaning for opengl rendering prep.
This commit is contained in:
parent
402f381d10
commit
7c6a92f4ec
58 changed files with 570 additions and 533 deletions
|
@ -1,23 +1,30 @@
|
|||
#include "Window.h"
|
||||
|
||||
#include "IPlatformWindow.h"
|
||||
#include "PaintEvent.h"
|
||||
#include "MouseEvent.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "KeyboardEvent.h"
|
||||
#include "Image.h"
|
||||
|
||||
#include "Widget.h"
|
||||
#include "VisualLayer.h"
|
||||
#include "Scene.h"
|
||||
#include "TriMesh.h"
|
||||
#include "AbstractPainter.h"
|
||||
#include "DrawingContext.h"
|
||||
|
||||
#include "IPlatformWindow.h"
|
||||
#include "Screen.h"
|
||||
#include "Image.h"
|
||||
|
||||
namespace mt
|
||||
{
|
||||
|
||||
Window::Window()
|
||||
:mWidth(800),
|
||||
mHeight(600),
|
||||
mBackingImage(std::make_unique<Image<uint8_t> >(mWidth, mHeight)),
|
||||
mWidget(Widget::Create())
|
||||
: DrawingSurface(),
|
||||
mWidget(Widget::Create())
|
||||
{
|
||||
mWidget->setBounds(mWidth, mHeight);
|
||||
mWidth = 800;
|
||||
mHeight = 600;
|
||||
}
|
||||
|
||||
Window::~Window()
|
||||
|
@ -30,33 +37,27 @@ std::unique_ptr<Window> Window::Create()
|
|||
return std::make_unique<Window>();
|
||||
}
|
||||
|
||||
std::vector<VisualLayer*> Window::GetLayers()
|
||||
{
|
||||
return mWidget->getLayers();
|
||||
}
|
||||
|
||||
void Window::clearPlatformWindow()
|
||||
{
|
||||
mPlatformWindow.reset();
|
||||
}
|
||||
|
||||
|
||||
void Window::OnMouseEvent(const MouseEvent* event)
|
||||
void Window::onMouseEvent(const MouseEvent* event)
|
||||
{
|
||||
mWidget->onMouseEvent(event);
|
||||
}
|
||||
|
||||
void Window::OnKeyboardEvent(const KeyboardEvent* event)
|
||||
void Window::onKeyboardEvent(const KeyboardEvent* event)
|
||||
{
|
||||
mWidget->onKeyboardEvent(event);
|
||||
}
|
||||
|
||||
void Window::OnPaint(const PaintEvent* event)
|
||||
void Window::onPaint(const PaintEvent* event)
|
||||
{
|
||||
mWidget->onPaintEvent(event);
|
||||
}
|
||||
|
||||
void Window::AddWidget(WidgetUPtr widget)
|
||||
void Window::setWidget(WidgetPtr widget)
|
||||
{
|
||||
if (mWidget)
|
||||
{
|
||||
|
@ -66,29 +67,7 @@ void Window::AddWidget(WidgetUPtr widget)
|
|||
mWidget->setBounds(mWidth, mHeight);
|
||||
}
|
||||
|
||||
Widget* Window::GetWidget() const
|
||||
{
|
||||
return mWidget.get();
|
||||
}
|
||||
|
||||
unsigned Window::GetWidth() const
|
||||
{
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
unsigned Window::GetHeight() const
|
||||
{
|
||||
return mHeight;
|
||||
}
|
||||
|
||||
void Window::SetSize(unsigned width, unsigned height)
|
||||
{
|
||||
mWidth = width;
|
||||
mHeight = height;
|
||||
mWidget->setBounds(mWidth, mHeight);
|
||||
}
|
||||
|
||||
IPlatformWindow* Window::GetPlatformWindow() const
|
||||
IPlatformWindow* Window::getPlatformWindow() const
|
||||
{
|
||||
if (mPlatformWindow)
|
||||
{
|
||||
|
@ -97,14 +76,10 @@ IPlatformWindow* Window::GetPlatformWindow() const
|
|||
return nullptr;
|
||||
}
|
||||
|
||||
void Window::SetPlatformWindow(IPlatformWindowPtr window)
|
||||
void Window::setPlatformWindow(IPlatformWindowPtr window, DrawingMode drawingMode)
|
||||
{
|
||||
mPlatformWindow = std::move(window);
|
||||
}
|
||||
|
||||
Image<uint8_t>* Window::getBackingImage() const
|
||||
{
|
||||
return mBackingImage.get();
|
||||
mDrawingContext = std::make_unique<DrawingContext>(this, drawingMode);
|
||||
}
|
||||
|
||||
void Window::map()
|
||||
|
@ -127,7 +102,13 @@ void Window::doPaint(mt::Screen* screen)
|
|||
{
|
||||
if (mPlatformWindow)
|
||||
{
|
||||
mPlatformWindow->paint(screen);
|
||||
mPlatformWindow->beforePaint(screen);
|
||||
|
||||
mDrawingContext->getScene()->setLayers(mWidget->getLayers());
|
||||
|
||||
mDrawingContext->paint();
|
||||
|
||||
mPlatformWindow->afterPaint(screen);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue