Rev 249 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
249 | Ghost | 1 | |
2 | |||
3 | |||
4 | #include "string.h" |
||
5 | #include "mesys.h" |
||
6 | |||
7 | |||
539 | spraid | 8 | int i; |
249 | Ghost | 9 | |
10 | |||
11 | char* caption = "Console test - colors"; |
||
12 | |||
13 | |||
14 | dword* dll_ver; |
||
15 | void stdcall (* con_init)(dword wnd_width, dword wnd_height, dword scr_width, dword scr_height, const char* title); |
||
16 | void stdcall (* con_write_asciiz)(dword flags, const char* string); |
||
17 | void cdecl (* con_printf)(dword flags, const char* format, ...); |
||
18 | void stdcall (* con_exit)(dword bCloseWindow); |
||
19 | |||
20 | |||
21 | char *name; |
||
22 | void *data; |
||
23 | }; |
||
24 | |||
25 | |||
26 | void* __msys_cofflib_getproc(struct import *lib, char *name){ |
||
27 | int i; |
||
28 | for(i = 0; lib[i].name && strcmp(name, lib[i].name); i++); |
||
29 | if(lib[i].name)return lib[i].data; |
||
30 | else return NULL; |
||
31 | } |
||
32 | |||
33 | |||
34 | dll_start = (dword (*)(dword)) |
||
35 | __msys_cofflib_getproc(exp, imports[0]); |
||
36 | dll_ver = (dword*) |
||
37 | __msys_cofflib_getproc(exp, imports[1]); |
||
38 | con_init = (void stdcall (*)(dword , dword, dword, dword, const char*)) |
||
39 | __msys_cofflib_getproc(exp, imports[2]); |
||
40 | con_write_asciiz = (void stdcall (*)(dword, const char*)) |
||
41 | __msys_cofflib_getproc(exp, imports[3]); |
||
42 | con_printf = (void cdecl (*)(dword, const char*, ...)) |
||
43 | __msys_cofflib_getproc(exp, imports[4]); |
||
44 | con_exit = (void stdcall (*)(dword)) |
||
45 | __msys_cofflib_getproc(exp, imports[5]); |
||
46 | } |
||
47 | |||
48 | |||
49 | struct import * hDll; |
||
50 | |||
51 | |||
52 | debug_out_str("can't load lib\n\r"); |
||
53 | return 1; |
||
54 | } |
||
55 | link(hDll, imports); |
||
56 | debug_out_str("dll loaded\n\r"); |
||
57 | |||
58 | |||
59 | debug_out_str("dll_start failed\n\r"); |
||
60 | return 1; |
||
61 | } |
||
62 | |||
63 | |||
64 | for(i = 0; i < 256; i++){ |
||
65 | con_printf(7, "Color 0x%02X: ", i); |
||
66 | con_write_asciiz(i, "Text sample."); |
||
67 | |||
68 | |||
69 | } |
||
70 | |||
71 | |||
72 | debug_out_str("all right's ;)\n\r"); |
||
73 | }> |
||
74 |