bzr branch
http://gegoxaren.bato24.eu/bzr/%2Bjunk/c_sdl_joypad_ducktape
21
by Gustav Hatvigsson
* added Modeline to (almost) all files. |
1 |
/* c-basic-offset: 2; tab-width: 2; indent-tabs-mode: nil
|
2 |
* vi: set shiftwidth=2 tabstop=2 expandtab:
|
|
3 |
* :indentSize=2:tabSize=2:noTabs=true:
|
|
4 |
*/
|
|
5 |
||
7
by Gustav Hartvigsson
* Added licensing information to the files. |
6 |
#ifndef __H_JS_PARSER__
|
7 |
#define __H_JS_PARSER__
|
|
8 |
||
9 |
/** @file
|
|
23
by Gustav Hartvigsson
* Started work on porting to Ducktape from MozJs. |
10 |
*
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
11 |
*
|
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
12 |
* Author Gustav Hartvigsson <gustav.hartvigsson _at_ gmail.com> 2014
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
13 |
*
|
14 |
*/
|
|
15 |
||
24
by Gustav Hartvigsson
* it compiles... |
16 |
#include "duktape.h" |
7
by Gustav Hartvigsson
* Added licensing information to the files. |
17 |
#include "Game.h" |
18 |
||
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
19 |
/******************************************************************************/
|
20 |
||
16
by Gustav Hartvigsson
* made the code compile. |
21 |
typedef struct GameJSParser GameJSParser; |
22 |
||
23 |
/**
|
|
24 |
* Function prototype to be used for loading context data, this is user-defined
|
|
25 |
* so any data can be loaded into the JS context.
|
|
26 |
*/
|
|
27 |
typedef void (* GameJSParserLoadDataFunc)(GameJSParser * self, void * data); |
|
28 |
||
29 |
/**
|
|
30 |
* Function that is used to dump data from the JS context, it is user-defined.
|
|
31 |
*/
|
|
32 |
typedef void * (* GameJSParserDumpDataFunc)(GameJSParser * self); |
|
33 |
||
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
34 |
/**
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
35 |
* The data structure that represents the EcmaScript/JavaScript parser/engine
|
36 |
* that can be used when creating games.
|
|
37 |
*/
|
|
12
by Gustav Hartvigsson
* reorganising code to be remove extra typedefs. |
38 |
typedef struct GameJSParser { |
7
by Gustav Hartvigsson
* Added licensing information to the files. |
39 |
GameJSParserLoadDataFunc load_data_func; |
40 |
GameJSParserDumpDataFunc dump_data_func; |
|
41 |
|
|
24
by Gustav Hartvigsson
* it compiles... |
42 |
duk_context * ctx; |
43 |
duk_function_list_entry * function_array; |
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
44 |
|
45 |
Game * game; /**< DO NOT FREE! */ |
|
46 |
|
|
16
by Gustav Hartvigsson
* made the code compile. |
47 |
char * file_name; |
48 |
char * script; |
|
7
by Gustav Hartvigsson
* Added licensing information to the files. |
49 |
} GameJSParser; |
50 |
||
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
51 |
/******************************************************************************/
|
52 |
||
7
by Gustav Hartvigsson
* Added licensing information to the files. |
53 |
/**
|
54 |
* Need to know a bit about the game, like screen and renderer and such.
|
|
55 |
*
|
|
56 |
* Note that file_name and script parameters are mutually exclusive. If both are
|
|
57 |
* set, the function will return NULL, and print an error to stderr.
|
|
58 |
*/
|
|
59 |
GameJSParser * game_js_parser_new (Game * game, |
|
60 |
char * file_name, |
|
61 |
char * script); |
|
62 |
||
63 |
/**
|
|
64 |
*
|
|
65 |
*/
|
|
66 |
void game_js_parser_free (GameJSParser * self); |
|
67 |
||
68 |
/**
|
|
69 |
*
|
|
70 |
*/
|
|
71 |
void game_js_parser_set_settings_loader (GameJSParser * self, |
|
72 |
GameJSParserLoadDataFunc func); |
|
73 |
||
74 |
void game_js_parser_set_settings_dump (GameJSParser * self, |
|
75 |
GameJSParserDumpDataFunc func); |
|
76 |
||
16
by Gustav Hartvigsson
* made the code compile. |
77 |
void game_js_parser_load_settings (GameJSParser * self, void * data); |
7
by Gustav Hartvigsson
* Added licensing information to the files. |
78 |
|
79 |
void * game_js_parser_dump_settings (GameJSParser * self); |
|
80 |
||
81 |
||
82 |
void game_js_parser_run (GameJSParser * self); |
|
83 |
||
8
by Gustav Hartvigsson
* added and changed little in the files Lincening information. |
84 |
/******************************************************************************/
|
85 |
||
86 |
||
7
by Gustav Hartvigsson
* Added licensing information to the files. |
87 |
#endif
|