diff --git a/resources/textures/background_no_stars.png b/resources/textures/background_no_stars.png new file mode 100644 index 0000000..ed675c9 Binary files /dev/null and b/resources/textures/background_no_stars.png differ diff --git a/resources/textures/star_1.png b/resources/textures/star_1.png new file mode 100644 index 0000000..e7f3cd9 Binary files /dev/null and b/resources/textures/star_1.png differ diff --git a/resources/textures/star_2.png b/resources/textures/star_2.png new file mode 100644 index 0000000..277c910 Binary files /dev/null and b/resources/textures/star_2.png differ diff --git a/resources/textures/star_3.png b/resources/textures/star_3.png new file mode 100644 index 0000000..f69a40e Binary files /dev/null and b/resources/textures/star_3.png differ diff --git a/resources/textures/star_4.png b/resources/textures/star_4.png new file mode 100644 index 0000000..60c5bf3 Binary files /dev/null and b/resources/textures/star_4.png differ diff --git a/resources/textures/star_5.png b/resources/textures/star_5.png new file mode 100644 index 0000000..1c420be Binary files /dev/null and b/resources/textures/star_5.png differ diff --git a/resources/textures/star_6.png b/resources/textures/star_6.png new file mode 100644 index 0000000..4d04765 Binary files /dev/null and b/resources/textures/star_6.png differ diff --git a/src/wallpaper.c b/src/wallpaper.c index 0b4bc0c..916b5e2 100644 --- a/src/wallpaper.c +++ b/src/wallpaper.c @@ -8,10 +8,31 @@ #include #include #include +#include #define WIDTH 1920 #define HEIGHT 1080 +typedef struct { + const char* name; + int x; + int y; + int cx; + int cy; + float angle; + float angle_step; +} Star; + +static Star stars[] = { + { .name = "star_1.png", .x = 4, .y = 528, .cx = 165, .cy = 166, .angle = 90.0, .angle_step = -0.025 }, + { .name = "star_2.png", .x = 215, .y = 809, .cx = 82, .cy = 83, .angle = 90.0, .angle_step = 0.05 }, + { .name = "star_3.png", .x = 333, .y = 781, .cx = 25, .cy = 31, .angle = 90.0, .angle_step = 0.15 }, + { .name = "star_4.png", .x = 956, .y = 405, .cx = 166, .cy = 167, .angle = 90.0, .angle_step = -0.1 }, + { .name = "star_5.png", .x = 1164, .y = 570, .cx = 66, .cy = 70, .angle = 90.0, .angle_step = 0.075 }, +}; + +#define STARS_COUNT (int)(sizeof(stars) / sizeof(stars[0])) + char *hyprland_socket_path; Vector2 hyprland_get_cursor_position() { @@ -113,9 +134,14 @@ int main(void) { // initialize textures Texture2D distanceFieldTex = load_texture_from_file("resources/textures/background_distance_field.png"); - Texture2D backgroundTex = load_texture_from_file("resources/textures/background_transparent.png"); + Texture2D backgroundTex = load_texture_from_file("resources/textures/background_no_stars.png"); RenderTexture2D target = LoadRenderTexture(WIDTH, HEIGHT); + Texture2D starTextures[STARS_COUNT]; + for (int i = 0; i < STARS_COUNT; i++) { + starTextures[i] = load_texture_from_file(TextFormat("resources/textures/%s", stars[i].name)); + } + // initialize shader Shader shader = load_shader_from_file("resources/shaders/basic.vs", "resources/shaders/distance_field.fs"); @@ -165,12 +191,25 @@ int main(void) { DrawTextureRec(backgroundTex, (Rectangle){0, 0, screenWidth, screenHeight}, (Vector2){0, 0}, WHITE); + for (int i = 0; i < STARS_COUNT; i++) { + stars[i].angle = fmodf(stars[i].angle + stars[i].angle_step, 360.0f); + + Texture2D tex = starTextures[i]; + Rectangle source = {0, 0, (float)tex.width, (float)tex.height}; + Rectangle dest = {stars[i].x, stars[i].y, (float)tex.width, (float)tex.height}; + Vector2 origin = {stars[i].cx, stars[i].cy}; + DrawTexturePro(tex, source, dest, origin, stars[i].angle, WHITE); + } + EndDrawing(); } UnloadRenderTexture(target); UnloadTexture(distanceFieldTex); UnloadTexture(backgroundTex); + for (int i = 0; i < STARS_COUNT; i++) { + UnloadTexture(starTextures[i]); + } UnloadShader(shader); CloseWindow();