diff options
| author | Bryan Hoyle <starfoxprime@gmail.com> | 2012-06-23 01:09:13 (GMT) |
|---|---|---|
| committer | Bryan Hoyle <starfoxprime@gmail.com> | 2012-06-23 01:09:13 (GMT) |
| commit | 4cf42e786bd0e2871a5bc580bed14f4d2c742788 (patch) | |
| tree | cac5f9054b6a85a6da0979fa0bc76934649cb7f4 /src/game/GameView.cpp | |
| parent | 83c51307c442fa668c5a39c4e1816928ed17b522 (diff) | |
| download | powder-4cf42e786bd0e2871a5bc580bed14f4d2c742788.zip powder-4cf42e786bd0e2871a5bc580bed14f4d2c742788.tar.gz | |
Scrollbar appearance and code changes
Diffstat (limited to 'src/game/GameView.cpp')
| -rw-r--r-- | src/game/GameView.cpp | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/game/GameView.cpp b/src/game/GameView.cpp index 61a4dbc..faacad4 100644 --- a/src/game/GameView.cpp +++ b/src/game/GameView.cpp @@ -46,8 +46,13 @@ GameView::GameView(): v->c->OpenSearch(); } }; - scrollBar = new ui::Button(ui::Point(XRES+50,YRES+50), ui::Point(50, 3), ""); + + scrollBar = new ui::Button(ui::Point(0,YRES+21), ui::Point(XRES, 2), ""); + scrollBar->Appearance.BackgroundInactive = ui::Colour(255, 255, 255); + scrollBar->Appearance.HorizontalAlign = ui::Appearance::AlignCentre; + scrollBar->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; AddComponent(scrollBar); + searchButton = new ui::Button(ui::Point(currentX, Size.Y-16), ui::Point(17, 15)); //Open searchButton->SetIcon(IconOpen); currentX+=18; @@ -839,17 +844,13 @@ void GameView::DoMouseMove(int x, int y, int dx, int dy) int scrollSize = (int)(((float)(XRES-15))/((float)totalWidth) * ((float)XRES-15)); if (scrollSize>XRES) scrollSize = XRES; - scrollBar->Position.Y = toolButtons[0]->Position.Y + 19; if(totalWidth > XRES-15) { int mouseX = x; if(mouseX > XRES) mouseX = XRES; - float frac = (float)mouseX/((float)XRES-15); - scrollBar->Position.X = (int)(frac*(float)(XRES-scrollSize)); - scrollBar->Appearance.BackgroundInactive = ui::Colour(255, 255, 255); - scrollBar->Appearance.HorizontalAlign = ui::Appearance::AlignCentre; - scrollBar->Appearance.VerticalAlign = ui::Appearance::AlignMiddle; + + scrollBar->Position.X = (int)(((float)mouseX/((float)XRES-15))*(float)(XRES-scrollSize)); float overflow = totalWidth-(XRES-15), mouseLocation = float(XRES)/float(mouseX-(XRES)); setToolButtonOffset(overflow/mouseLocation); |
