Welcome to collectivesolver - Programming & Software Q&A with code examples. A website with trusted programming answers. All programs are tested and work.

Contact: aviboots(AT)netvision.net.il

Buy a domain name - Register cheap domain names from $0.99 - Namecheap

Scalable Hosting That Grows With You

Secure & Reliable Web Hosting, Free Domain, Free SSL, 1-Click WordPress Install, Expert 24/7 Support

Semrush - keyword research tool

Boost your online presence with premium web hosting and servers

Disclosure: My content contains affiliate links.

39,855 questions

51,776 answers

573 users

How to draw a small running triangle from the top left corner to top right with Raylib in C

1 Answer

0 votes
#include "raylib.h"

#define WIDTH 800
#define HEIGHT 600

int main(void)
{
    InitWindow(WIDTH, HEIGHT, "Raylib - Draw a small running triangle from the top left corner to the end of the screen");

    SetTargetFPS(60);

    float pos = 0.0f;
    float gap = 0.0f;

    // Main game loop
    while (!WindowShouldClose())
    {
        BeginDrawing();

        ClearBackground(BLACK);
                   
        
        DrawTriangle((Vector2) { 5.0f + pos + gap, 0.0f },
                     (Vector2) { 0.0f + pos + gap, 5.0f },
                     (Vector2) { 10.0f + pos + gap, 5.0f}, GREEN);

        pos += 5.0f;
        gap += 4.0f;
   
        EndDrawing();
    }

    CloseWindow(); // Close window and OpenGL context

    return 0;
}



/*
run:


*/

 



answered Jan 28, 2025 by avibootz

Related questions

1 answer 109 views
109 views asked Jan 12, 2025 by avibootz
1 answer 86 views
86 views asked Jan 16, 2025 by avibootz
1 answer 120 views
120 views asked Jan 12, 2025 by avibootz
1 answer 100 views
100 views asked Jan 12, 2025 by avibootz
1 answer 90 views
...