Subversion Repositories Shiroi

Rev

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

Rev 5 Rev 6
Line 1... Line 1...
1
/* $Id: main.c 5 2024-08-28 10:10:03Z nishi $ */
1
/* $Id: main.c 6 2024-08-28 10:29:32Z 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 123... Line 123...
123
		text = textcard->textptr;
123
		text = textcard->textptr;
124
	}
124
	}
125
 
125
 
126
	SetTraceLogLevel(LOG_NONE);
126
	SetTraceLogLevel(LOG_NONE);
127
	if(video != NULL) {
127
	if(video != NULL) {
128
		InitWindow(video->width * scx, video->height * scy, "Shiroi Emulator");
128
		InitWindow(video->width * scx + (text == NULL ? 0 : 100), video->height * scy, "Shiroi Emulator");
129
	} else {
129
	} else {
130
		InitWindow(640, 480, "Shiroi Emulator");
130
		InitWindow(640 + (text == NULL ? 0 : 100), 480, "Shiroi Emulator");
131
	}
131
	}
132
	InitAudioDevice();
132
	InitAudioDevice();
133
	SetAudioStreamBufferSizeDefault(512);
133
	SetAudioStreamBufferSizeDefault(512);
134
	AudioStream as = LoadAudioStream(48000, 16, 1);
134
	AudioStream as = LoadAudioStream(48000, 16, 1);
135
	SetAudioStreamCallback(as, shiroi.play_audio);
135
	SetAudioStreamCallback(as, shiroi.play_audio);
Line 187... Line 187...
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
				text->caps = !text->caps;
192
			} else if(c == KEY_COMMA) {
193
			} else if(c == KEY_COMMA) {
193
				text->key = (4 << 4) | 8;
194
				text->key = (4 << 4) | 8;
194
			} else if(c == KEY_PERIOD) {
195
			} else if(c == KEY_PERIOD) {
195
				text->key = (4 << 4) | 9;
196
				text->key = (4 << 4) | 9;
196
			} else if(c == KEY_SLASH) {
197
			} else if(c == KEY_SLASH) {
Line 267... Line 268...
267
				}
268
				}
268
			}
269
			}
269
 
270
 
270
			EndTextureMode();
271
			EndTextureMode();
271
 
272
 
272
			DrawTexturePro(r.texture, (Rectangle){0, 0, video->width, -video->height}, (Rectangle){0, 0, GetScreenWidth(), GetScreenHeight()}, (Vector2){0, 0}, 0, WHITE);
273
			DrawTexturePro(r.texture, (Rectangle){0, 0, video->width, -video->height}, (Rectangle){text == NULL ? 0 : 100, 0, GetScreenWidth() - (text == NULL ? 0 : 100), GetScreenHeight()}, (Vector2){0, 0}, 0, WHITE);
273
		} else {
274
		} else {
274
			DrawText("No Video", 0, 0, 20, WHITE);
275
			DrawText("No Video", 0, 0, 20, WHITE);
275
		}
276
		}
276
 
277
 
-
 
278
		DrawText("Caps Lock", 5, 5, 10, WHITE);
-
 
279
 
-
 
280
		DrawCircle(100 - 10, 10, 5, text->caps ? RED : BLACK);
-
 
281
 
277
		EndDrawing();
282
		EndDrawing();
278
	}
283
	}
279
	CloseWindow();
284
	CloseWindow();
280
	UnloadAudioStream(as);
285
	UnloadAudioStream(as);
281
	if(video != NULL) UnloadRenderTexture(r);
286
	if(video != NULL) UnloadRenderTexture(r);