Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
console.log(r.IsKeyDown(r.KEY_ONE))
// console.log(r.GetKeyPressed())
r.DrawText('some basic shapes available on raylib', 20, 20, 20, r.DARKGRAY)
var position = {
x: 100,
y: 100,
}
var size = {
x: 200,
y: 150,
}
r.DrawRectangleV(position, size, r.DARKBLUE)
r.DrawRectangleRec(
{
x: 50,
y: 50,
width: 50,
height: 50,
},
r.PINK
)
/*
DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
DrawTriangle((Vector2){screenWidth/4*3, 80},
(Vector2){screenWidth/4*3 - 60, 150},
r.ClearBackground(r.RAYWHITE);
r.DrawText("some basic shapes available on raylib", 20, 20, 20, r.DARKGRAY);
var position = {
x: 100,
y: 100
}
var size = {
x: 200,
y: 150
}
r.DrawRectangleV(position, size, r.DARKBLUE)
r.DrawRectangleRec({
x: 50,
y: 50,
width: 50,
height: 50
}, r.PINK)
/*
DrawCircle(screenWidth/4, 120, 35, DARKBLUE);
DrawRectangle(screenWidth/4*2 - 60, 100, 120, 60, RED);
DrawRectangleLines(screenWidth/4*2 - 40, 320, 80, 60, ORANGE); // NOTE: Uses QUADS internally, not lines
DrawRectangleGradientH(screenWidth/4*2 - 90, 170, 180, 130, MAROON, GOLD);
DrawTriangle((Vector2){screenWidth/4*3, 80},
(Vector2){screenWidth/4*3 - 60, 150},
(Vector2){screenWidth/4*3 + 60, 150}, VIOLET);
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.BeginMode2D(camera);
r.DrawRectangle(-6000, 320, 13000, 8000, r.DARKGRAY);
for (var i = 0; i < MAX_BUILDINGS; i++) {
r.DrawRectangleRec(buildings[i], buildColors[i]);
}
r.DrawRectangleRec(player, r.RED);
r.DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, r.GREEN);
r.DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, r.GREEN);
r.EndMode2D();
r.DrawText("SCREEN AREA", 640, 10, 20, r.RED);
r.DrawRectangle(0, 0, screenWidth, 5, r.RED);
r.DrawRectangle(0, 5, 5, screenHeight - 10, r.RED);
r.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, r.RED);
r.DrawRectangle(0, screenHeight - 5, screenWidth, 5, r.RED);
r.DrawRectangle( 10, 10, 250, 113, r.Fade(r.SKYBLUE, 0.5));
r.DrawRectangleLines( 10, 10, 250, 113, r.BLUE);
camera.rotation = 0
}
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.BeginMode2D(camera);
r.DrawRectangle(-6000, 320, 13000, 8000, r.DARKGRAY);
for (var i = 0; i < MAX_BUILDINGS; i++) {
r.DrawRectangleRec(buildings[i], buildColors[i]);
}
r.DrawRectangleRec(player, r.RED);
r.DrawLine(camera.target.x, -screenHeight*10, camera.target.x, screenHeight*10, r.GREEN);
r.DrawLine(-screenWidth*10, camera.target.y, screenWidth*10, camera.target.y, r.GREEN);
r.EndMode2D();
r.DrawText("SCREEN AREA", 640, 10, 20, r.RED);
r.DrawRectangle(0, 0, screenWidth, 5, r.RED);
r.DrawRectangle(0, 5, 5, screenHeight - 10, r.RED);
r.DrawRectangle(screenWidth - 5, 5, 5, screenHeight - 10, r.RED);
r.DrawRectangle(0, screenHeight - 5, screenWidth, 5, r.RED);
y.forEach((x, j) => {
if (x) {
r.DrawRectangleRec(
{
x: j * multiplier,
y: i * multiplier,
width: multiplier,
height: multiplier,
},
r.GREEN
)
} else {
r.DrawRectangleRec(
{
x: j * multiplier,
y: i * multiplier,
width: multiplier,
height: multiplier,
},
y.forEach((x, j) => {
if (x) {
r.DrawRectangleRec(
{
x: j * multiplier,
y: i * multiplier,
width: multiplier,
height: multiplier,
},
r.GREEN
)
} else {
r.DrawRectangleRec(
{
x: j * multiplier,
y: i * multiplier,
width: multiplier,
height: multiplier,
},
r.BLACK
)
}
})
})