Learning C - liballeg/allegro_wiki GitHub Wiki

#include "raylib.h"

int main(void) {)
const int screenWidth = 600; const int screenHeight = 400; InitWindow(screenWidth, screenHeight, "raylib basic window"); SetTargetFPS(60); int n1= 0; n2=0; n3=0; const char *result ="Press SPIN" rectangle spinbutton = {250, 300, 100 , 50}
srand(time(NULL));
while (!WindowShouldClose()) {
if

(checkCollisionPointRec(GetMousePosition(), spinButton) && IsmouseButtonPressed(MOUSE_LEFT_BUTTON)) {

n1= rand()% 10; n2= rand()% 10; n3= rand()% 10;

if (n1== n2 && n2 ==n3)
result = "JACKPOT !!";
else if (n1==n2 || n1==n3 || n2==n3)
result = "YOU WIN!!"
else
result= "YOU LOSE !!"
}
BeginDrawing(); ClearBackground(RAYWHITE); DrawText("SLOT MACHINE", 180, 20 , 30, DARKBLUE); Drawrectangle(150 ,120 ,80 ,80 ,LIGHTGRAY); Drawrectangle(260 ,120 ,80 ,80 ,LIGHTGRAY); Drawrectangle(370 ,120 ,80 ,80 ,LIGHTGRAY); Drawtext(textFormat("%d", n1),180 , 140 , 40, BLACK); Drawtext(textFormat("%d", n1),290 , 140 , 40, BLACK); Drawtext(textFormat("%d", n1),400 , 140 , 40, BLACK); DrawrectzangleRec(spinButton,BLUE); DrawText("SPIN", 275, 315, 20, WHITE); DrawText(result, 230, 230, 25, RED); EndDrawing();

} CloseWindow(); return 0;

}

⚠️ **GitHub.com Fallback** ⚠️