More resizing
This commit is contained in:
parent
9ade0e2d4b
commit
be94bf0185
11 changed files with 44 additions and 3 deletions
|
@ -19,6 +19,8 @@ void OpenGlPainter::paint(DrawingContext* context)
|
|||
const auto width = double(surface->getWidth());
|
||||
const auto height = double(surface->getHeight());
|
||||
|
||||
std::cout << "Painting into width " << width << " and height " << height << std::endl;
|
||||
|
||||
const auto num_mesh = context->getScene()->getNumMeshes();
|
||||
|
||||
glClearColor(1.0, 1.0, 1.0, 0.0);
|
||||
|
@ -55,6 +57,11 @@ void OpenGlPainter::paint(DrawingContext* context)
|
|||
glVertex3f(x1, y1, 0);
|
||||
glVertex3f(x2, y2, 0);
|
||||
|
||||
// std::cout << "Verts0| " << x0 << " | " << y0 << " | "<< std::endl;
|
||||
// std::cout << "Verts1| " << x1 << " | " << y1 << " | "<< std::endl;
|
||||
// std::cout << "Verts2| " << x2 << " | " << y2 << " | "<< std::endl;
|
||||
// std::cout << "****************" << std::endl;
|
||||
|
||||
glEnd();
|
||||
|
||||
counter++;
|
||||
|
|
|
@ -33,6 +33,8 @@ public:
|
|||
|
||||
virtual void clear() = 0;
|
||||
|
||||
virtual void onResize(unsigned width, unsigned height) = 0;
|
||||
|
||||
protected:
|
||||
mt::Window* mWindow{nullptr};
|
||||
};
|
||||
|
|
|
@ -15,6 +15,8 @@
|
|||
#include "Screen.h"
|
||||
#include "Image.h"
|
||||
|
||||
#include <iostream>
|
||||
|
||||
namespace mt
|
||||
{
|
||||
|
||||
|
@ -41,6 +43,11 @@ void Window::setSize(unsigned width, unsigned height)
|
|||
{
|
||||
DrawingSurface::setSize(width, height);
|
||||
mWidget->setBounds(width, height);
|
||||
|
||||
if (mPlatformWindow)
|
||||
{
|
||||
mPlatformWindow->onResize(width, height);
|
||||
}
|
||||
}
|
||||
|
||||
void Window::clearPlatformWindow()
|
||||
|
|
|
@ -2,8 +2,8 @@
|
|||
|
||||
ResizeEvent::ResizeEvent(unsigned width, unsigned height)
|
||||
: UiEvent(),
|
||||
mWidth(),
|
||||
mHeight()
|
||||
mWidth(width),
|
||||
mHeight(height)
|
||||
{
|
||||
mType = UiEvent::Type::Resize;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include <algorithm>
|
||||
#include <numeric>
|
||||
#include <iostream>
|
||||
|
||||
HorizontalSpacer::HorizontalSpacer()
|
||||
: Widget(),
|
||||
|
@ -35,6 +36,7 @@ void HorizontalSpacer::addChildLayers(const PaintEvent* event)
|
|||
{
|
||||
height = mSize.mMaxHeight;
|
||||
}
|
||||
|
||||
for(std::size_t idx=0; idx<mChildren.size(); idx++)
|
||||
{
|
||||
auto& child = mChildren[idx];
|
||||
|
|
|
@ -71,7 +71,7 @@ void DesktopManager::onUiEvent(UiEventUPtr eventUPtr)
|
|||
{
|
||||
auto resize_event = dynamic_cast<const ResizeEvent*>(event);
|
||||
mWindowManager->onResizeEvent(resize_event);
|
||||
//mModified = true;
|
||||
mModified = true;
|
||||
break;
|
||||
}
|
||||
case (UiEvent::Type::Mouse):
|
||||
|
|
|
@ -34,6 +34,11 @@ public:
|
|||
|
||||
void clear();
|
||||
|
||||
void onResize(unsigned width, unsigned height)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private:
|
||||
void initialize();
|
||||
|
||||
|
|
|
@ -2,6 +2,7 @@
|
|||
|
||||
#include "XcbGlInterface.h"
|
||||
#include "FileLogger.h"
|
||||
#include <iostream>
|
||||
|
||||
#include <GL/gl.h>
|
||||
|
||||
|
@ -56,6 +57,11 @@ bool XcbGlWindowInterface::initialize(xcb_window_t window)
|
|||
return true;
|
||||
}
|
||||
|
||||
void XcbGlWindowInterface::resizeViewPort(unsigned width, unsigned height)
|
||||
{
|
||||
glViewport(0, 0, width, height);
|
||||
}
|
||||
|
||||
void XcbGlWindowInterface::destroyWindow()
|
||||
{
|
||||
glXDestroyWindow(mGlInterface->getDisplay(), mWindow);
|
||||
|
|
|
@ -16,6 +16,8 @@ public:
|
|||
|
||||
void afterPaint();
|
||||
|
||||
void resizeViewPort(unsigned width, unsigned height);
|
||||
|
||||
private:
|
||||
void destroyWindow();
|
||||
void swapBuffers();
|
||||
|
|
|
@ -112,3 +112,11 @@ void XcbWindow::map()
|
|||
xcb_map_window(mConnection, mHandle);
|
||||
xcb_flush(mConnection);
|
||||
}
|
||||
|
||||
void XcbWindow::onResize(unsigned width, unsigned height)
|
||||
{
|
||||
if (mGlInterface)
|
||||
{
|
||||
mGlInterface->resizeViewPort(width, height);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -34,6 +34,8 @@ public:
|
|||
|
||||
void map() override;
|
||||
|
||||
void onResize(unsigned width, unsigned height) override;
|
||||
|
||||
private:
|
||||
int mHandle{-1};
|
||||
unsigned mGraphicsContext {0};
|
||||
|
|
Loading…
Reference in a new issue