mirror of https://github.com/OpenTTD/OpenTTD
(svn r10725) -Codechange: move some window related code out of gfx.cpp to windows.cpp
parent
279ed3a9c1
commit
59ff947471
22
src/gfx.cpp
22
src/gfx.cpp
|
@ -21,7 +21,6 @@
|
||||||
#include "texteff.hpp"
|
#include "texteff.hpp"
|
||||||
#include "blitter/factory.hpp"
|
#include "blitter/factory.hpp"
|
||||||
#include "video/video_driver.hpp"
|
#include "video/video_driver.hpp"
|
||||||
#include "window.h"
|
|
||||||
|
|
||||||
byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
|
byte _dirkeys; ///< 1 = left, 2 = up, 4 = right, 8 = down
|
||||||
bool _fullscreen;
|
bool _fullscreen;
|
||||||
|
@ -1150,26 +1149,7 @@ void SetAnimatedMouseCursor(const AnimCursor *table)
|
||||||
|
|
||||||
bool ChangeResInGame(int width, int height)
|
bool ChangeResInGame(int width, int height)
|
||||||
{
|
{
|
||||||
bool ret = (_screen.width == width && _screen.height == height) || _video_driver->ChangeResolution(width, height);
|
return (_screen.width == width && _screen.height == height) || _video_driver->ChangeResolution(width, height);
|
||||||
|
|
||||||
int new_width = min(_screen.width, 640);
|
|
||||||
Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
|
|
||||||
if (w != NULL && new_width != w->width) {
|
|
||||||
ResizeWindow(w, new_width - w->width, 0);
|
|
||||||
|
|
||||||
Window *w2 = FindWindowById(WC_STATUS_BAR, 0);
|
|
||||||
if (w2 != NULL) ResizeWindow(w2, max(new_width, 320) - w2->width, 0);
|
|
||||||
|
|
||||||
WindowEvent e;
|
|
||||||
e.event = WE_RESIZE;
|
|
||||||
e.we.sizing.size.x = w->width;
|
|
||||||
e.we.sizing.size.y = w->height;
|
|
||||||
e.we.sizing.diff.x = new_width - w->width;
|
|
||||||
e.we.sizing.diff.y = 0;
|
|
||||||
w->wndproc(w, &e);
|
|
||||||
}
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void ToggleFullScreen(bool fs)
|
void ToggleFullScreen(bool fs)
|
||||||
|
|
|
@ -2047,6 +2047,18 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
* in a 'backup'-desc that the window should always be centred. */
|
* in a 'backup'-desc that the window should always be centred. */
|
||||||
switch (w->window_class) {
|
switch (w->window_class) {
|
||||||
case WC_MAIN_TOOLBAR:
|
case WC_MAIN_TOOLBAR:
|
||||||
|
if (neww - w->width != 0) {
|
||||||
|
ResizeWindow(w, min(neww, 640) - w->width, 0);
|
||||||
|
|
||||||
|
WindowEvent e;
|
||||||
|
e.event = WE_RESIZE;
|
||||||
|
e.we.sizing.size.x = w->width;
|
||||||
|
e.we.sizing.size.y = w->height;
|
||||||
|
e.we.sizing.diff.x = neww - w->width;
|
||||||
|
e.we.sizing.diff.y = 0;
|
||||||
|
w->wndproc(w, &e);
|
||||||
|
}
|
||||||
|
|
||||||
top = w->top;
|
top = w->top;
|
||||||
left = PositionMainToolbar(w); // changes toolbar orientation
|
left = PositionMainToolbar(w); // changes toolbar orientation
|
||||||
break;
|
break;
|
||||||
|
@ -2064,6 +2076,7 @@ void RelocateAllWindows(int neww, int newh)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case WC_STATUS_BAR:
|
case WC_STATUS_BAR:
|
||||||
|
ResizeWindow(w, clamp(neww, 320, 640) - w->width, 0);
|
||||||
top = newh - w->height;
|
top = newh - w->height;
|
||||||
left = (neww - w->width) >> 1;
|
left = (neww - w->width) >> 1;
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in New Issue