mineschemer/main.c

90 lines
2 KiB
C
Raw Normal View History

2023-12-21 14:30:43 -05:00
#include "raylib.h"
2023-12-21 14:40:51 -05:00
#include <stdio.h>
2023-12-21 14:30:43 -05:00
int main() {
InitWindow(100, 100, "hello from C");
2023-12-21 14:40:51 -05:00
printf("%s\n", GetApplicationDirectory());
2023-12-21 14:30:43 -05:00
Texture2D texture = LoadTexture("skins/xp-flowers.bmp");
2023-12-21 14:40:51 -05:00
Texture2D fail = LoadTexture("fail");
2023-12-21 14:30:43 -05:00
SetTargetFPS(120);
while (!WindowShouldClose()) {
BeginDrawing();
ClearBackground(RAYWHITE);
2023-12-21 14:40:51 -05:00
DrawTexture(texture, 0, 0, WHITE);
2023-12-21 14:30:43 -05:00
EndDrawing();
}
UnloadTexture(texture);
CloseWindow();
return 0;
}
2023-12-22 00:40:33 -05:00
void a(const char* path) {
printf("%s\n", path);
printf("%s\n", path);
}
Image b(const char* path) {
printf("%s\n", path);
Image img = LoadImage(path);
printf("%s\n", path);
return img;
}
const char *id(const char* str) {
return str;
}
FILE* fopen_wrapper(const char* path) {
FILE* file = fopen(path, "rb");
printf("file = %p and NULL = %p\n", file, NULL);
return file;
}
void println(const char* str) {
if (str == NULL) {
printf("got a null str :(\n");
return;
}
printf("%c\n", str[0]);
printf("%c\n", str[1]);
printf("%p\n", str);
printf("%c\n", str[0]);
printf("%c\n", str[1]);
printf("%c\n", str[2]);
printf("%c\n", str[3]);
printf("%c\n", str[4]);
printf("%c\n", str[5]);
printf("%s\n", str);
printf("%s\n", str);
}
// doesn't work. nice!
Image load_image(const char* path) {
// YES! the string is empty
// but why?
printf("%p: '%s'\n", path, path);
printf("'%c'\n", path[0]);
printf("'%c'\n", path[1]);
printf("'%c'\n", path[2]);
printf("'%c'\n", path[3]);
printf("'%c'\n", path[4]);
return LoadImage(path);
}
Image load_image2(const char* str) {
// YES! the string is empty
// but why?
printf("%s\n", str);
//printf("%p: '%s'\n", str, str);
/* printf("'%c'\n", str[0]); */
/* printf("'%c'\n", str[1]); */
/* printf("'%c'\n", str[2]); */
/* printf("'%c'\n", str[3]); */
/* printf("'%c'\n", str[4]); */
return LoadImage(str);
}