video/null.c
changeset 2171 008122046f7f
equal deleted inserted replaced
2170:b8a5a7dc0cd2 2171:008122046f7f
       
     1 #include "stdafx.h"
       
     2 #include "openttd.h"
       
     3 #include "gfx.h"
       
     4 #include "variables.h"
       
     5 #include "video/null.h"
       
     6 #include "window.h"
       
     7 
       
     8 static void* _null_video_mem = NULL;
       
     9 
       
    10 static const char* NullVideoStart(const char* const* parm)
       
    11 {
       
    12 	_screen.width = _screen.pitch = _cur_resolution[0];
       
    13 	_screen.height = _cur_resolution[1];
       
    14 	_null_video_mem = malloc(_cur_resolution[0] * _cur_resolution[1]);
       
    15 	return NULL;
       
    16 }
       
    17 
       
    18 static void NullVideoStop(void) { free(_null_video_mem); }
       
    19 
       
    20 static void NullVideoMakeDirty(int left, int top, int width, int height) {}
       
    21 
       
    22 static int NullVideoMainLoop(void)
       
    23 {
       
    24 	uint i;
       
    25 
       
    26 	for (i = 0; i < 1000; i++) {
       
    27 		GameLoop();
       
    28 		_screen.dst_ptr = _null_video_mem;
       
    29 		UpdateWindows();
       
    30 	}
       
    31 
       
    32 	return ML_QUIT;
       
    33 }
       
    34 
       
    35 static bool NullVideoChangeRes(int w, int h) { return false; }
       
    36 static void NullVideoFullScreen(bool fs) {}
       
    37 
       
    38 const HalVideoDriver _null_video_driver = {
       
    39 	NullVideoStart,
       
    40 	NullVideoStop,
       
    41 	NullVideoMakeDirty,
       
    42 	NullVideoMainLoop,
       
    43 	NullVideoChangeRes,
       
    44 	NullVideoFullScreen,
       
    45 };