diff options
| author | ilotterytea <iltsu@alright.party> | 2024-12-11 13:11:41 +0500 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2024-12-11 13:11:41 +0500 |
| commit | 493b668742ceb28a4e10ca5016e652f9638429aa (patch) | |
| tree | 4f07933b5e71cc6d73d09d59cd14d202a629439a /src/main.c | |
| parent | 80c74c80615693cf4b8a5090121dad8d14ccfb0f (diff) | |
feat: texture for stars
Diffstat (limited to 'src/main.c')
| -rw-r--r-- | src/main.c | 20 |
1 files changed, 17 insertions, 3 deletions
@@ -14,8 +14,17 @@ int main(int argc, char *argv[]) { Star stars[STAR_AMOUNT] = {}; + Texture2D* texture = NULL; + + if (FileExists("star.png")) { + Image image = LoadImage("star.png"); + Texture2D loadedTexture = LoadTextureFromImage(image); + texture = &loadedTexture; + UnloadImage(image); + } + for (int i = 0; i < STAR_AMOUNT; i++) { - stars[i] = StarCreate(); + stars[i] = StarCreate(texture); } while (!WindowShouldClose()) { @@ -39,8 +48,13 @@ int main(int argc, char *argv[]) { StarUpdate(star, screen_center_x, screen_center_y); - DrawRectangle(star->renderPosition.x, star->renderPosition.y, - star->size.x, star->size.y, star->color); + if (star->texture == NULL) { + DrawRectangle(star->renderPosition.x, star->renderPosition.y, + star->size.x, star->size.y, star->color); + } else { + DrawTextureEx(*star->texture, star->renderPosition, 0.0, + star->size.x / 10.0, star->color); + } } EndDrawing(); |
