Browse Source

More demo work

pull/1/head
falkTX 11 years ago
parent
commit
0d15dd6cf2
3 changed files with 10 additions and 13 deletions
  1. +8
    -11
      examples/demo.cpp
  2. +1
    -1
      examples/widgets/ExampleColorWidget.hpp
  3. +1
    -1
      examples/widgets/ExampleShapesWidget.hpp

+ 8
- 11
examples/demo.cpp View File

@@ -43,8 +43,7 @@ class LeftSizeWidget : public Widget
{
public:
LeftSizeWidget(Window& parent)
: Widget(parent),
rect(0, 0, 100, 0)
: Widget(parent)
{
}

@@ -52,21 +51,19 @@ protected:
void onDisplay() override
{
glColor3f(0.302f/5, 0.337f/5, 0.361f/5);
rect.draw();
bg.draw();

// reset color
glColor4f(1.0f, 1.0f, 1.0f, 1.0f);
}

void onReshape(int, int height) override
void onReshape(int, int) override
{
// always 100px width
rect.setHeight(height);
setSize(100, height);
bg = getArea();
}

private:
Rectangle<int> rect;
Rectangle<int> bg;
};

// ------------------------------------------------------
@@ -85,7 +82,7 @@ public:
b1(*this, Image()),
b2(*this, Image())
{
//wColor.hide();
wColor.hide();
wImages.hide();
wRects.hide();
wShapes.hide();
@@ -97,8 +94,6 @@ public:

setSize(600, 500);
setTitle("DGL Demo");

//wLeft.toFront();
}

void onReshape(int width, int height) override
@@ -109,6 +104,8 @@ public:
wRects.setSize(size);
wShapes.setSize(size);

wLeft.setSize(100, height);

Window::onReshape(width, height);
}



+ 1
- 1
examples/widgets/ExampleColorWidget.hpp View File

@@ -122,7 +122,7 @@ protected:
const int height = getHeight();

// full bg
bgFull = Rectangle<int>(cx, cy, width, height);
bgFull = getArea();

// small bg, centered 2/3 size
bgSmall = Rectangle<int>(cx+width/6, cy+height/6, width*2/3, height*2/3);


+ 1
- 1
examples/widgets/ExampleShapesWidget.hpp View File

@@ -89,7 +89,7 @@ protected:
const int height = getHeight();

// background
bg = Rectangle<int>(cx, cy, width, height);
bg = getArea();

// rectangle
rect = Rectangle<int>(cx+20, cy+10, width-40, height-20);


Loading…
Cancel
Save