Subversion Repositories Shiroi

Rev

Rev 4 | Rev 6 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4 Rev 5
Line 1... Line 1...
1
/* $Id: main.c 4 2024-08-28 10:07:23Z nishi $ */
1
/* $Id: main.c 5 2024-08-28 10:10:03Z nishi $ */
2
 
2
 
3
#include <stdio.h>
3
#include <stdio.h>
4
#include <stdbool.h>
4
#include <stdbool.h>
5
#include <sys/stat.h>
5
#include <sys/stat.h>
6
#include <stdlib.h>
6
#include <stdlib.h>
Line 157... Line 157...
157
		ClearBackground(BLACK);
157
		ClearBackground(BLACK);
158
 
158
 
159
		if(text != NULL) {
159
		if(text != NULL) {
160
			/*
160
			/*
161
			 * / 1 2 3 4 5 6 7 8 9 10 11 12 13
161
			 * / 1 2 3 4 5 6 7 8 9 10 11 12 13
162
			 * 1 1 2 3 4 5 6 7 8 9 0  -  =  
162
			 * 1 1 2 3 4 5 6 7 8 9 0  -  =
163
			 * 2 q w e r t y u i o p  [  ]  rt
163
			 * 2 q w e r t y u i o p  [  ]  rt
164
			 * 3 a s d f g h j k l ;  '  \  cl
164
			 * 3 a s d f g h j k l ;  '  \  cl
165
			 * 4 z x c v b n m , . /  sp
165
			 * 4 z x c v b n m , . /  sp
166
			 */
166
			 */
167
			int c = GetKeyPressed();
167
			int c = GetKeyPressed();
168
			if(c == 0){
168
			if(c == 0) {
169
				text->key = 0;
169
				text->key = 0;
170
			}else if(KEY_ONE <= c && c <= KEY_NINE){
170
			} else if(KEY_ONE <= c && c <= KEY_NINE) {
171
				text->key = (1 << 4) | (c - KEY_ONE + 1);
171
				text->key = (1 << 4) | (c - KEY_ONE + 1);
172
			}else if(c == KEY_ZERO){
172
			} else if(c == KEY_ZERO) {
173
				text->key = (1 << 4) | 10;
173
				text->key = (1 << 4) | 10;
174
			}else if(c == KEY_MINUS){
174
			} else if(c == KEY_MINUS) {
175
				text->key = (1 << 4) | 11;
175
				text->key = (1 << 4) | 11;
176
			}else if(c == KEY_EQUAL){
176
			} else if(c == KEY_EQUAL) {
177
				text->key = (1 << 4) | 12;
177
				text->key = (1 << 4) | 12;
178
			}else if(c == KEY_LEFT_BRACKET){
178
			} else if(c == KEY_LEFT_BRACKET) {
179
				text->key = (2 << 4) | 11;
179
				text->key = (2 << 4) | 11;
180
			}else if(c == KEY_RIGHT_BRACKET){
180
			} else if(c == KEY_RIGHT_BRACKET) {
181
				text->key = (2 << 4) | 12;
181
				text->key = (2 << 4) | 12;
182
			}else if(c == KEY_ENTER){
182
			} else if(c == KEY_ENTER) {
183
				text->key = (2 << 4) | 13;
183
				text->key = (2 << 4) | 13;
184
			}else if(c == KEY_SEMICOLON){
184
			} else if(c == KEY_SEMICOLON) {
185
				text->key = (3 << 4) | 10;
185
				text->key = (3 << 4) | 10;
186
			}else if(c == KEY_APOSTROPHE){
186
			} else if(c == KEY_APOSTROPHE) {
187
				text->key = (3 << 4) | 11;
187
				text->key = (3 << 4) | 11;
188
			}else if(c == KEY_BACKSLASH){
188
			} else if(c == KEY_BACKSLASH) {
189
				text->key = (3 << 4) | 12;
189
				text->key = (3 << 4) | 12;
190
			}else if(c == KEY_LEFT_SHIFT || c == KEY_RIGHT_SHIFT){
190
			} else if(c == KEY_LEFT_SHIFT || c == KEY_RIGHT_SHIFT) {
191
				text->key = (3 << 4) | 13;
191
				text->key = (3 << 4) | 13;
192
			}else if(c == KEY_COMMA){
192
			} else if(c == KEY_COMMA) {
193
				text->key = (4 << 4) | 8;
193
				text->key = (4 << 4) | 8;
194
			}else if(c == KEY_PERIOD){
194
			} else if(c == KEY_PERIOD) {
195
				text->key = (4 << 4) | 9;
195
				text->key = (4 << 4) | 9;
196
			}else if(c == KEY_SLASH){
196
			} else if(c == KEY_SLASH) {
197
				text->key = (4 << 4) | 10;
197
				text->key = (4 << 4) | 10;
198
			}else if(c == KEY_SPACE){
198
			} else if(c == KEY_SPACE) {
199
				text->key = (4 << 4) | 11;
199
				text->key = (4 << 4) | 11;
200
			}else if(c == KEY_Q){
200
			} else if(c == KEY_Q) {
201
				text->key = (2 << 4) | 1;
201
				text->key = (2 << 4) | 1;
202
			}else if(c == KEY_W){
202
			} else if(c == KEY_W) {
203
				text->key = (2 << 4) | 2;
203
				text->key = (2 << 4) | 2;
204
			}else if(c == KEY_E){
204
			} else if(c == KEY_E) {
205
				text->key = (2 << 4) | 3;
205
				text->key = (2 << 4) | 3;
206
			}else if(c == KEY_R){
206
			} else if(c == KEY_R) {
207
				text->key = (2 << 4) | 4;
207
				text->key = (2 << 4) | 4;
208
			}else if(c == KEY_T){
208
			} else if(c == KEY_T) {
209
				text->key = (2 << 4) | 5;
209
				text->key = (2 << 4) | 5;
210
			}else if(c == KEY_Y){
210
			} else if(c == KEY_Y) {
211
				text->key = (2 << 4) | 6;
211
				text->key = (2 << 4) | 6;
212
			}else if(c == KEY_U){
212
			} else if(c == KEY_U) {
213
				text->key = (2 << 4) | 7;
213
				text->key = (2 << 4) | 7;
214
			}else if(c == KEY_I){
214
			} else if(c == KEY_I) {
215
				text->key = (2 << 4) | 8;
215
				text->key = (2 << 4) | 8;
216
			}else if(c == KEY_O){
216
			} else if(c == KEY_O) {
217
				text->key = (2 << 4) | 9;
217
				text->key = (2 << 4) | 9;
218
			}else if(c == KEY_P){
218
			} else if(c == KEY_P) {
219
				text->key = (2 << 4) | 10;
219
				text->key = (2 << 4) | 10;
220
			}else if(c == KEY_A){
220
			} else if(c == KEY_A) {
221
				text->key = (3 << 4) | 1;
221
				text->key = (3 << 4) | 1;
222
			}else if(c == KEY_S){
222
			} else if(c == KEY_S) {
223
				text->key = (3 << 4) | 2;
223
				text->key = (3 << 4) | 2;
224
			}else if(c == KEY_D){
224
			} else if(c == KEY_D) {
225
				text->key = (3 << 4) | 3;
225
				text->key = (3 << 4) | 3;
226
			}else if(c == KEY_F){
226
			} else if(c == KEY_F) {
227
				text->key = (3 << 4) | 4;
227
				text->key = (3 << 4) | 4;
228
			}else if(c == KEY_G){
228
			} else if(c == KEY_G) {
229
				text->key = (3 << 4) | 5;
229
				text->key = (3 << 4) | 5;
230
			}else if(c == KEY_H){
230
			} else if(c == KEY_H) {
231
				text->key = (3 << 4) | 6;
231
				text->key = (3 << 4) | 6;
232
			}else if(c == KEY_J){
232
			} else if(c == KEY_J) {
233
				text->key = (3 << 4) | 7;
233
				text->key = (3 << 4) | 7;
234
			}else if(c == KEY_K){
234
			} else if(c == KEY_K) {
235
				text->key = (3 << 4) | 8;
235
				text->key = (3 << 4) | 8;
236
			}else if(c == KEY_L){
236
			} else if(c == KEY_L) {
237
				text->key = (3 << 4) | 9;
237
				text->key = (3 << 4) | 9;
238
			}else if(c == KEY_Z){
238
			} else if(c == KEY_Z) {
239
				text->key = (4 << 4) | 1;
239
				text->key = (4 << 4) | 1;
240
			}else if(c == KEY_X){
240
			} else if(c == KEY_X) {
241
				text->key = (4 << 4) | 2;
241
				text->key = (4 << 4) | 2;
242
			}else if(c == KEY_C){
242
			} else if(c == KEY_C) {
243
				text->key = (4 << 4) | 3;
243
				text->key = (4 << 4) | 3;
244
			}else if(c == KEY_V){
244
			} else if(c == KEY_V) {
245
				text->key = (4 << 4) | 4;
245
				text->key = (4 << 4) | 4;
246
			}else if(c == KEY_B){
246
			} else if(c == KEY_B) {
247
				text->key = (4 << 4) | 5;
247
				text->key = (4 << 4) | 5;
248
			}else if(c == KEY_N){
248
			} else if(c == KEY_N) {
249
				text->key = (4 << 4) | 6;
249
				text->key = (4 << 4) | 6;
250
			}else if(c == KEY_M){
250
			} else if(c == KEY_M) {
251
				text->key = (4 << 4) | 7;
251
				text->key = (4 << 4) | 7;
252
			}
252
			}
253
		}
253
		}
254
 
254
 
255
		if(video != NULL) {
255
		if(video != NULL) {