-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
smaludzi
committed
Aug 6, 2020
1 parent
36cdae8
commit f417477
Showing
3 changed files
with
104 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
|
||
module raylib | ||
{ | ||
record Vector2 | ||
{ | ||
x : float; | ||
y : float; | ||
} | ||
|
||
record Color | ||
{ | ||
r : char; | ||
g : char; | ||
b : char; | ||
a : char; | ||
} | ||
|
||
let MOUSE_LEFT_BUTTON = 0; | ||
let MOUSE_RIGHT_BUTTON = 1; | ||
let MOUSE_MIDDLE_BUTTON = 2; | ||
|
||
let DARKBLUE = Color(chr(0), chr(82), chr(172), chr(255)); | ||
let DARKGRAY = Color(chr(80), chr(80), chr(80), chr(255)); | ||
let LIME = Color(chr(0), chr(158), chr(47), chr(255)); | ||
let MAROON = Color(chr(190), chr(33), chr(55), chr(255)); | ||
let RAYWHITE = Color(chr(245), chr(245), chr(245), chr(245)); | ||
|
||
extern "../../raylib/src/libraylib.so" func InitWindow(width : int, height : int, title : string) -> void | ||
extern "../../raylib/src/libraylib.so" func SetTargetFPS(fps : int) -> void | ||
extern "../../raylib/src/libraylib.so" func WindowShouldClose() -> bool | ||
extern "../../raylib/src/libraylib.so" func CloseWindow() -> void | ||
extern "../../raylib/src/libraylib.so" func GetMousePosition() -> Vector2 | ||
extern "../../raylib/src/libraylib.so" func IsMouseButtonPressed(button : int) -> bool | ||
extern "../../raylib/src/libraylib.so" func BeginDrawing() -> void | ||
extern "../../raylib/src/libraylib.so" func EndDrawing() -> void | ||
extern "../../raylib/src/libraylib.so" func ClearBackground(color : Color) -> void | ||
extern "../../raylib/src/libraylib.so" func DrawCircleV(center : Vector2, radius : float, color : Color) -> void | ||
extern "../../raylib/src/libraylib.so" func DrawText(text : string, posX : int, posY : int, fontSize : int, color : Color) -> void | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
|
||
use raylib | ||
|
||
let screenWidth = 800; | ||
let screenHeight = 450; | ||
|
||
func main() -> int | ||
{ | ||
/* | ||
let ballPosition = raylib.Vector2( -100.0, -100.0 ); | ||
let ballColor = raylib.Color; | ||
|
||
ballColor = raylib.DARKBLUE; | ||
|
||
raylib.InitWindow(screenWidth, screenHeight, "Never meets raylib"); | ||
raylib.SetTargetFPS(60); | ||
|
||
while (!raylib.WindowShouldClose()) | ||
{ | ||
ballPosition = raylib.GetMousePosition(); | ||
|
||
if (raylib.IsMouseButtonPressed(raylib.MOUSE_LEFT_BUTTON)) | ||
{ | ||
ballColor = raylib.MAROON | ||
} | ||
else if (raylib.IsMouseButtonPressed(raylib.MOUSE_MIDDLE_BUTTON)) | ||
{ | ||
ballColor = raylib.LIME | ||
} | ||
else if (raylib.IsMouseButtonPressed(raylib.MOUSE_RIGHT_BUTTON)) | ||
{ | ||
ballColor = raylib.DARKBLUE | ||
} | ||
else | ||
{ | ||
ballColor | ||
}; | ||
|
||
raylib.BeginDrawing(); | ||
|
||
raylib.ClearBackground(raylib.RAYWHITE); | ||
raylib.DrawCircleV(ballPosition, 40.0, ballColor); | ||
raylib.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, raylib.DARKGRAY); | ||
|
||
raylib.EndDrawing() | ||
}; | ||
|
||
raylib.CloseWindow(); | ||
*/ | ||
0 | ||
} |