]> icculus.org git repositories - btb/d2x.git/blob - unused/win95/winmono.c
remove rcs tags
[btb/d2x.git] / unused / win95 / winmono.c
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.  
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14
15
16 #include <windows.h>
17 #include <malloc.h>
18 #include <stdlib.h>
19 #include <stdio.h>
20 #include <stdarg.h>
21 #include <string.h>
22
23
24 static int                              WinMonoInitialized = 0;
25 static HANDLE                   hConOutput = 0;
26
27
28
29 //      ----------------------------------------------------------------------------
30 //      Functions
31 //      ----------------------------------------------------------------------------
32
33 int minit(void)
34 {
35
36         if (WinMonoInitialized) return 1;
37
38         if (!AllocConsole()) return 0;
39         hConOutput = GetStdHandle(STD_OUTPUT_HANDLE);
40         if (hConOutput == INVALID_HANDLE_VALUE) return 0;
41
42         WinMonoInitialized = 1;
43         
44         return 1;
45
46 }
47
48 int mkill(void)
49 {
50         FreeConsole();
51
52         return 1;
53 }
54
55
56 void mopen(short n, short row, short col, short width, short height, char *title)
57 {
58         if (!WinMonoInitialized) return;
59 }
60                 
61
62 void mclose(int n)
63 {
64         if (!WinMonoInitialized) return;
65 }       
66
67
68 void msetcursor(short row, short col)
69 {
70         COORD coord;
71
72         coord.X =  col;
73         coord.Y =  row;
74
75         SetConsoleCursorPosition(hConOutput, coord);
76 }
77
78
79 void mputc(short n, char c)
80 {
81         char buf[2];
82         DWORD chwritten;
83
84         if (!WinMonoInitialized) return;
85
86         buf[0] = c; buf[1] = 0;
87
88         WriteConsole(hConOutput, buf, 1, &chwritten,  NULL); 
89 }
90
91
92 void mputc_at(short n, short row, short col, char c)
93 {
94         if (!WinMonoInitialized) return;
95         
96         msetcursor(row,col);
97
98         mputc(n, c);
99 }
100
101
102 void scroll(short n)
103 {
104 }               
105
106
107 static char temp_m_buffer[1000];
108
109 void mprintf(short n, char *format, ...)
110 {
111         char *ptr = temp_m_buffer;
112         va_list args;
113         DWORD chwritten;
114         
115         if (!WinMonoInitialized) return;
116
117         va_start(args, format);
118         vsprintf(temp_m_buffer, format, args);
119         WriteConsole(hConOutput, ptr, strlen(ptr), &chwritten, NULL); 
120 }
121
122
123 void mprintf_at(short n, short row, short col, char *format, ...)
124 {
125         char *ptr = temp_m_buffer;
126         va_list args;
127         DWORD chwritten;
128         
129         if (!WinMonoInitialized) return;
130
131         va_start(args, format);
132         vsprintf(temp_m_buffer, format, args);
133         msetcursor(row, col);
134         WriteConsole(hConOutput, ptr, strlen(ptr), &chwritten, NULL); 
135 }
136         
137
138 void drawbox(short n)
139 {
140 //      Obsolete in the New Order
141 }
142
143
144 void mrefresh(short n)
145 {
146 //      Huh??? :)
147 }
148