Starshatter_Open
Open source Starshatter engine
Main Page
Classes
Files
File List
File Members
All
Classes
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Friends
Macros
DataLoader.h
Go to the documentation of this file.
1
/* Project nGenEx
2
Destroyer Studios LLC
3
Copyright © 1997-2004. All Rights Reserved.
4
5
SUBSYSTEM: nGenEx.lib
6
FILE: DataLoader.h
7
AUTHOR: John DiCamillo
8
9
*/
10
11
#ifndef DataLoader_h
12
#define DataLoader_h
13
14
#include "
Types.h
"
15
#include "
List.h
"
16
#include "
Text.h
"
17
18
// +--------------------------------------------------------------------+
19
20
class
Bitmap
;
21
class
Sound
;
22
class
Video
;
23
24
// +--------------------------------------------------------------------+
25
26
class
DataLoader
27
{
28
public
:
29
static
const
char
*
TYPENAME
() {
return
"DataLoader"
; }
30
31
enum
{
DATAFILE_OK
,
DATAFILE_INVALID
,
DATAFILE_NOTEXIST
};
32
33
DataLoader
();
34
35
static
DataLoader
*
GetLoader
() {
return
loader; }
36
static
void
Initialize
();
37
static
void
Close
();
38
39
void
Reset
();
40
void
UseFileSystem
(
bool
use=
true
);
41
void
UseVideo
(
Video
* v);
42
void
EnableMedia
(
bool
enable=
true
);
43
44
int
EnableDatafile
(
const
char
* name);
45
int
DisableDatafile
(
const
char
* name);
46
47
void
SetDataPath
(
const
char
* path);
48
const
char
*
GetDataPath
()
const
{
return
datapath; }
49
50
bool
IsFileSystemEnabled
()
const
{
return
use_file_system; }
51
bool
IsMediaLoadEnabled
()
const
{
return
enable_media; }
52
53
bool
FindFile
(
const
char
* fname);
54
int
ListFiles
(
const
char
* filter,
List<Text>
& list,
bool
recurse=
false
);
55
int
ListArchiveFiles
(
const
char
* archive,
const
char
* filter,
List<Text>
& list);
56
int
LoadBuffer
(
const
char
* name, BYTE*& buf,
bool
null_terminate=
false
,
bool
optional=
false
);
57
int
LoadBitmap
(
const
char
* name,
Bitmap
& bmp,
int
type=0,
bool
optional=
false
);
58
int
CacheBitmap
(
const
char
* name,
Bitmap
*& bmp,
int
type=0,
bool
optional=
false
);
59
int
LoadTexture
(
const
char
* name,
Bitmap
*& bmp,
int
type=0,
bool
preload_cache=
false
,
bool
optional=
false
);
60
int
LoadSound
(
const
char
* fname,
Sound
*& snd, DWORD flags=0,
bool
optional=
false
);
61
int
LoadStream
(
const
char
* fname,
Sound
*& snd,
bool
optional=
false
);
62
63
void
ReleaseBuffer
(BYTE*& buf);
64
int
fread
(
void
* buffer,
size_t
size,
size_t
count, BYTE*& stream);
65
66
private
:
67
int
LoadIndexed(
const
char
* name,
Bitmap
& bmp,
int
type);
68
int
LoadHiColor(
const
char
* name,
Bitmap
& bmp,
int
type);
69
int
LoadAlpha(
const
char
* name,
Bitmap
& bmp,
int
type);
70
71
void
ListFileSystem(
const
char
* filter,
List<Text>
& list,
Text
base_path,
bool
recurse);
72
int
LoadPartialFile(
const
char
* fname, BYTE*& buf,
int
max_load,
bool
optional=
false
);
73
int
LoadOggStream(
const
char
* fname,
Sound
*& snd);
74
75
Text
datapath;
76
Video
* video;
77
bool
use_file_system;
78
bool
enable_media;
79
80
static
DataLoader
* loader;
81
};
82
83
// +--------------------------------------------------------------------+
84
85
#endif DataLoader_h
86
nGenEx
DataLoader.h
Generated on Tue Jun 5 2012 20:46:21 for Starshatter_Open by
1.8.1