src/gfx.cpp
changeset 7856 121ae75a45a0
parent 7666 a5fccd76176a
child 7857 105eabc8fe1a
equal deleted inserted replaced
7855:0465a871522f 7856:121ae75a45a0
    19 #include "debug.h"
    19 #include "debug.h"
    20 #include "zoom.hpp"
    20 #include "zoom.hpp"
    21 #include "texteff.hpp"
    21 #include "texteff.hpp"
    22 #include "blitter/factory.hpp"
    22 #include "blitter/factory.hpp"
    23 #include "video/video_driver.hpp"
    23 #include "video/video_driver.hpp"
       
    24 #include "window.h"
    24 
    25 
    25 byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
    26 byte _dirkeys;        ///< 1 = left, 2 = up, 4 = right, 8 = down
    26 bool _fullscreen;
    27 bool _fullscreen;
    27 CursorVars _cursor;
    28 CursorVars _cursor;
    28 bool _ctrl_pressed;   ///< Is Ctrl pressed?
    29 bool _ctrl_pressed;   ///< Is Ctrl pressed?
  1145 	_cursor.animate_cur = NULL;
  1146 	_cursor.animate_cur = NULL;
  1146 	_cursor.pal = PAL_NONE;
  1147 	_cursor.pal = PAL_NONE;
  1147 	SwitchAnimatedCursor();
  1148 	SwitchAnimatedCursor();
  1148 }
  1149 }
  1149 
  1150 
  1150 bool ChangeResInGame(int w, int h)
  1151 bool ChangeResInGame(int width, int height)
  1151 {
  1152 {
  1152 	return
  1153 	bool ret = (_screen.width == width && _screen.height == height) || _video_driver->ChangeResolution(width, height);
  1153 		(_screen.width == w && _screen.height == h) ||
  1154 
  1154 		_video_driver->ChangeResolution(w, h);
  1155 	int new_width = min(_screen.width, 640);
       
  1156 	Window *w = FindWindowById(WC_MAIN_TOOLBAR, 0);
       
  1157 	if (w != NULL && new_width != w->width) {
       
  1158 		ResizeWindow(w,  new_width - w->width, 0);
       
  1159 
       
  1160 		Window *w2 = FindWindowById(WC_STATUS_BAR, 0);
       
  1161 		if (w2 != NULL) ResizeWindow(w2, max(new_width, 320) - w2->width, 0);
       
  1162 
       
  1163 		WindowEvent e;
       
  1164 		e.event = WE_RESIZE;
       
  1165 		e.we.sizing.size.x = w->width;
       
  1166 		e.we.sizing.size.y = w->height;
       
  1167 		e.we.sizing.diff.x = new_width - w->width;
       
  1168 		e.we.sizing.diff.y = 0;
       
  1169 		w->wndproc(w, &e);
       
  1170 	}
       
  1171 
       
  1172 	return ret;
  1155 }
  1173 }
  1156 
  1174 
  1157 void ToggleFullScreen(bool fs)
  1175 void ToggleFullScreen(bool fs)
  1158 {
  1176 {
  1159 	_video_driver->ToggleFullscreen(fs);
  1177 	_video_driver->ToggleFullscreen(fs);