90 lines
2 KiB
C
90 lines
2 KiB
C
#include "raylib.h"
|
|
#include <stdio.h>
|
|
|
|
int main() {
|
|
InitWindow(100, 100, "hello from C");
|
|
printf("%s\n", GetApplicationDirectory());
|
|
|
|
Texture2D texture = LoadTexture("skins/xp-flowers.bmp");
|
|
Texture2D fail = LoadTexture("fail");
|
|
SetTargetFPS(120);
|
|
|
|
while (!WindowShouldClose()) {
|
|
BeginDrawing();
|
|
ClearBackground(RAYWHITE);
|
|
DrawTexture(texture, 0, 0, WHITE);
|
|
EndDrawing();
|
|
}
|
|
|
|
UnloadTexture(texture);
|
|
CloseWindow();
|
|
|
|
return 0;
|
|
}
|
|
|
|
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);
|
|
}
|