Skip to content

Commit bc6e8d0

Browse files
authored
Merge pull request #148 from RobLoach/parser
Add raymath and raygui support through the new Parser
2 parents c12fe0f + a542777 commit bc6e8d0

File tree

12 files changed

+7780
-2974
lines changed

12 files changed

+7780
-2974
lines changed

docs/API.md

Lines changed: 595 additions & 281 deletions
Large diffs are not rendered by default.

examples/models/models_rlgl_solar_system.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,7 @@ camera.target = r.Vector3(0, 0, 0)
7373
camera.up = r.Vector3(0, 1, 0)
7474
camera.fovy = 45
7575
camera.type = r.CAMERA_PERSPECTIVE
76+
camera.projection = r.CAMERA_PERSPECTIVE
7677

7778
r.SetCameraMode(camera, r.CAMERA_FREE)
7879

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
/*******************************************************************************************
2+
*
3+
* raylib [raygui] example - Basic window
4+
*
5+
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
6+
*
7+
* Copyright (c) 2022 Rob Loach (@RobLoach)
8+
*
9+
********************************************************************************************/
10+
11+
const r = require('raylib')
12+
13+
// Initialization
14+
// --------------------------------------------------------------------------------------
15+
const screenWidth = 800
16+
const screenHeight = 450
17+
let showMessageBox = false
18+
let backgroundColor = r.RAYWHITE
19+
20+
r.InitWindow(screenWidth, screenHeight, 'raylib [raygui] example - basic window')
21+
22+
r.SetTargetFPS(60)
23+
24+
// r.GuiLoadStyleDefault()
25+
// --------------------------------------------------------------------------------------
26+
27+
// Main game loop
28+
while (!r.WindowShouldClose()) { // Detect window close button or ESC key
29+
// Update
30+
// ----------------------------------------------------------------------------------
31+
// TODO: Update your variables here
32+
// ----------------------------------------------------------------------------------
33+
34+
// Draw
35+
// ----------------------------------------------------------------------------------
36+
r.BeginDrawing()
37+
38+
r.ClearBackground(backgroundColor)
39+
40+
if (r.GuiButton(r.Rectangle(30, 100, 200, 30), 'Change Background Color')) {
41+
showMessageBox = true
42+
}
43+
44+
if (showMessageBox) {
45+
switch (r.GuiMessageBox(r.Rectangle(r.GetScreenWidth() / 2 - 200, r.GetScreenHeight() / 2 - 50, 400, 100), 'Change Background Color', 'Do you really want to change the background?', 'Yes;No')) {
46+
case 0:
47+
case 2:
48+
showMessageBox = false
49+
break
50+
case 1: // Yes
51+
backgroundColor = r.Color(
52+
r.GetRandomValue(0, 255),
53+
r.GetRandomValue(0, 255),
54+
r.GetRandomValue(0, 255),
55+
255
56+
)
57+
showMessageBox = false
58+
}
59+
}
60+
61+
r.EndDrawing()
62+
// ----------------------------------------------------------------------------------
63+
}
64+
65+
// De-Initialization
66+
// --------------------------------------------------------------------------------------
67+
r.CloseWindow() // Close window and OpenGL context
68+
// --------------------------------------------------------------------------------------

package-lock.json

Lines changed: 13 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@
6262
"module-alias": "^2.2.2"
6363
},
6464
"devDependencies": {
65+
"@raylib/api": "^4.0.0",
6566
"archiver": "^5.3.1",
6667
"jest": "^28.1.0",
6768
"jsdoc-to-markdown": "^7.1.1",

0 commit comments

Comments
 (0)