37 AscContext asc_context; |
37 AscContext asc_context; |
38 |
38 |
39 void asc_context_initialize(void) { |
39 void asc_context_initialize(void) { |
40 if (asc_test_flag(asc_context.flags, ASC_FLAG_INITILIZED)) |
40 if (asc_test_flag(asc_context.flags, ASC_FLAG_INITILIZED)) |
41 return; |
41 return; |
42 asc_clear_flag(&asc_context.flags, ASC_FLAG_HAS_ERROR); |
42 memset(&asc_context, 0, sizeof(AscContext)); |
43 |
43 |
44 // initialize error buffer |
44 // initialize error buffer |
45 cxBufferInit( |
45 cxBufferInit( |
46 &asc_context.error_buffer, |
46 &asc_context.error_buffer, |
47 NULL, |
47 NULL, |
48 256, |
48 256, |
49 NULL, |
49 NULL, |
50 CX_BUFFER_AUTO_EXTEND |
50 CX_BUFFER_AUTO_EXTEND |
51 ); |
51 ); |
52 |
|
53 // initialize data |
|
54 memset(asc_context.windows, 0, sizeof (asc_context.windows)); |
|
55 |
52 |
56 // initialize SDL |
53 // initialize SDL |
57 if (SDL_Init(SDL_INIT_VIDEO) < 0) { |
54 if (SDL_Init(SDL_INIT_VIDEO) < 0) { |
58 asc_error(SDL_GetError()); |
55 asc_error(SDL_GetError()); |
59 } else { |
56 } else { |