Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
console.log('5')
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, r.WHITE);
r.DrawText("this IS a texture loaded from an image!", 300, 370, 10, r.GRAY);
r.EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(texture); // Texture unloading
r.CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
const texture = r.LoadTextureFromImage(image); // Image converted to texture, GPU memory (VRAM)
r.UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
//---------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
console.log('5')
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, r.WHITE);
r.DrawText("this IS a texture loaded from an image!", 300, 370, 10, r.GRAY);
r.EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(texture); // Texture unloading
r.CloseWindow(); // Close window and OpenGL context
r.InitWindow(screenWidth, screenHeight, 'raylib [shapes] example - basic shapes drawing')
r.SetTargetFPS(60)
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) {
// Detect window close button or ESC key
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing()
r.ClearBackground(r.RAYWHITE)
console.log('hello')
r.GetKeyPressed()
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 = {
r.SetTargetFPS(60)
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) {
// Detect window close button or ESC key
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing()
r.ClearBackground(r.RAYWHITE)
console.log('hello')
r.GetKeyPressed()
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.UnloadImage(image); // Once image has been converted to texture and uploaded to VRAM, it can be unloaded from RAM
//---------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) // Detect window close button or ESC key
{
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
console.log('5')
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, r.WHITE);
r.DrawText("this IS a texture loaded from an image!", 300, 370, 10, r.GRAY);
r.EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(texture); // Texture unloading
r.CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
console.log('5')
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing();
r.ClearBackground(r.RAYWHITE);
r.DrawTexture(texture, screenWidth/2 - texture.width/2, screenHeight/2 - texture.height/2, r.WHITE);
r.DrawText("this IS a texture loaded from an image!", 300, 370, 10, r.GRAY);
r.EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(texture); // Texture unloading
r.CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
********************************************************************************************/
const r = require('raylib')
// Initialization
//--------------------------------------------------------------------------------------
const screenWidth = 800
const screenHeight = 450
r.InitWindow(screenWidth, screenHeight, 'raylib [shapes] example - basic shapes drawing')
r.SetTargetFPS(60)
//--------------------------------------------------------------------------------------
// Main game loop
while (!r.WindowShouldClose()) {
// Detect window close button or ESC key
// Update
//----------------------------------------------------------------------------------
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing()
r.ClearBackground(r.RAYWHITE)
console.log('hello')
r.GetKeyPressed()
console.log(r.IsKeyDown(r.KEY_ONE))
// TODO: Update your variables here
//----------------------------------------------------------------------------------
// Draw
//----------------------------------------------------------------------------------
r.BeginDrawing()
r.ClearBackground(r.RAYWHITE)
console.log('hello')
r.GetKeyPressed()
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,
r.GetKeyPressed()
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);
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},