hal.h
author bjarni
Thu, 05 Oct 2006 12:59:28 +0000
changeset 4739 e626ef1b522e
parent 4223 d4c9ef555f43
child 5167 12c46fb7eccf
permissions -rw-r--r--
(svn r6651) -Coding feature: added the windowevent WE_INVALIDATE_DATA
This gives the ability to invalidate some window data and recalculate as needed instead of doing it for each WE_PAINT

This event is called right away when using InvalidateWindowData(), so it may be a good idea to set a bool or similar in the window
or similar and then act on that bool in WE_PAINT instead of doing a lot of stuff in WE_INVALIDATE_DATA as it might be called more than once before WE_PAINT is called

InvalidateWindowData() will not automatically repaint the window, so if you want to repaint it as well, you need to mark it dirty as well.

Made the depot windows use WE_INVALIDATE_DATA to set when to generate the engine and wagon lists instead of at each redraw
It makes no sense to regenerate the list when say using the scrollbar if we know that no vehicle have entered or left the list

NOTE: currently there is a piece of code to generate the list when it's not needed and compare it to the stored list and assert if they mismatch
This check is somewhat slow and kills the whole idea of WE_INVALIDATE_DATA, so it's a short lived one to verify that InvalidateWindowData() is used everywhere where it's needed
2186
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2177
diff changeset
     1
/* $Id$ */
db48cf29b983 (svn r2701) Insert Id tags into all source files
tron
parents: 2177
diff changeset
     2
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     3
#ifndef HAL_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     4
#define HAL_H
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     5
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     6
typedef struct {
1301
bf64ba5b6774 (svn r1805) Teach the driver layer a few things about const correctness
tron
parents: 1093
diff changeset
     7
	const char *(*start)(const char * const *parm);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
     8
	void (*stop)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
     9
} HalCommonDriver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    10
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    11
typedef struct {
1301
bf64ba5b6774 (svn r1805) Teach the driver layer a few things about const correctness
tron
parents: 1093
diff changeset
    12
	const char *(*start)(const char * const *parm);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    13
	void (*stop)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    14
	void (*make_dirty)(int left, int top, int width, int height);
2228
93cdde0f85ba (svn r2748) Remove unused cruft from the main loop
tron
parents: 2219
diff changeset
    15
	void (*main_loop)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    16
	bool (*change_resolution)(int w, int h);
1829
e90fe433fa7d (svn r2334) - Fix (regression): moved togglefullscreen into the video-driver, now windows works, dedicated works and sdl works. Also reverted the change to the makefile.
Darkvater
parents: 1596
diff changeset
    17
	void (*toggle_fullscreen)(bool fullscreen);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    18
} HalVideoDriver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    19
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    20
typedef struct {
1301
bf64ba5b6774 (svn r1805) Teach the driver layer a few things about const correctness
tron
parents: 1093
diff changeset
    21
	const char *(*start)(const char * const *parm);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    22
	void (*stop)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    23
} HalSoundDriver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    24
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    25
typedef struct {
1301
bf64ba5b6774 (svn r1805) Teach the driver layer a few things about const correctness
tron
parents: 1093
diff changeset
    26
	const char *(*start)(const char * const *parm);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    27
	void (*stop)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    28
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    29
	void (*play_song)(const char *filename);
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    30
	void (*stop_song)(void);
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    31
	bool (*is_song_playing)(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    32
	void (*set_volume)(byte vol);
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    33
} HalMusicDriver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    34
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    35
VARDEF HalMusicDriver *_music_driver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    36
VARDEF HalSoundDriver *_sound_driver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    37
VARDEF HalVideoDriver *_video_driver;
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    38
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    39
enum DriverType {
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    40
	VIDEO_DRIVER = 0,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    41
	SOUND_DRIVER = 1,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    42
	MUSIC_DRIVER = 2,
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    43
};
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    44
4217
b5427dc6b82f (svn r5761) - Cleanup: Really minor whitespace changes, and remove an extern from a function decleration in header file.
Darkvater
parents: 3329
diff changeset
    45
void GameLoop(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    46
1093
4fdc46eaf423 (svn r1594) Convert all undefined parameter lists to (void) and add the appropriate warning flags in the Makefile
tron
parents: 810
diff changeset
    47
void CreateConsole(void);
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    48
3329
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    49
#if defined(WIN32) || defined(WIN64) || defined(__WATCOMC__)
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    50
# define FS2OTTD(name) name
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    51
# define OTTD2FS(name) name
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    52
#else
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    53
const char *FS2OTTD(const char *name);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    54
const char *OTTD2FS(const char *name);
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    55
#endif
9885789ecaf7 (svn r4105) - Feature: Add proper ISO-8859-15 <> LOCALCODE conversion. As the mess that is makefile can't properly support it at the moment, it is only available for MACOSX. Windows doesn't need FS conversion and I have no idea about OS/2 so it's disabled for them.
Darkvater
parents: 3287
diff changeset
    56
0
29654efe3188 (svn r1) Import of revision 975 of old (crashed) SVN
truelight
parents:
diff changeset
    57
#endif /* HAL_H */