How to use the raylib.EndDrawing function in raylib

To help you get started, we’ve selected a few raylib examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github RobLoach / node-raylib / examples / textures / textures_image_loading.js View on Github external
// 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
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / core / core_random_values.js View on Github external
randValue = r.GetRandomValue(-8, 5)
        framesCounter = 0
    }
    //----------------------------------------------------------------------------------

    // Draw
    //----------------------------------------------------------------------------------
    r.BeginDrawing()

        r.ClearBackground(r.RAYWHITE)

        r.DrawText("Every 2 seconds a new random value is generated:", 130, 100, 20, r.MAROON)

        r.DrawText(r.FormatText("%i", randValue), 360, 180, 80, r.LIGHTGRAY)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.CloseWindow()        // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / core / core_input_mouse.js View on Github external
else if (r.IsMouseButtonPressed(r.MOUSE_RIGHT_BUTTON)) {
        ballColor = r.DARKBLUE
    }
    //----------------------------------------------------------------------------------

    // Draw
    //----------------------------------------------------------------------------------
    r.BeginDrawing()

        r.ClearBackground(r.RAYWHITE)

        r.DrawCircleV(ballPosition, 40, ballColor)

        r.DrawText("move ball with mouse and click mouse button to change color", 10, 10, 20, r.DARKGRAY)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.CloseWindow()        // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / templates / simple_game / simple_game.js View on Github external
r.DrawRectangle(0, 0, screenWidth, screenHeight, r.PURPLE)
                r.DrawText("GAMEPLAY SCREEN", 20, 20, 40, r.MAROON)
                r.DrawText("PRESS ENTER or TAP to JUMP to ENDING SCREEN", 130, 220, 20, r.MAROON)

            } break
            case 'ENDING':
            {
                // TODO: Draw ENDING screen here!
                r.DrawRectangle(0, 0, screenWidth, screenHeight, r.BLUE);
                r.DrawText("ENDING SCREEN", 20, 20, 40, r.DARKBLUE);
                r.DrawText("PRESS ENTER or TAP to RETURN to TITLE SCREEN", 120, 220, 20, r.DARKBLUE);

            } break
        }

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------

// TODO: Unload all loaded data (textures, fonts, audio) here!

r.CloseWindow()        // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / audio / audio_sound_loading.js View on Github external
// Update
    //----------------------------------------------------------------------------------
    if (r.IsKeyPressed(r.KEY_SPACE)) r.PlaySound(fxWav)      // Play WAV sound
    if (r.IsKeyPressed(r.KEY_ENTER)) r.PlaySound(fxOgg)      // Play OGG sound
    //----------------------------------------------------------------------------------

    // Draw
    //----------------------------------------------------------------------------------
    r.BeginDrawing()

        r.ClearBackground(r.RAYWHITE)

        r.DrawText("Press SPACE to PLAY the WAV sound!", 200, 180, 20, r.LIGHTGRAY)
        r.DrawText("Press ENTER to PLAY the OGG sound!", 200, 220, 20, r.LIGHTGRAY)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadSound(fxWav)     // Unload sound data
r.UnloadSound(fxOgg)     // Unload sound data

r.CloseAudioDevice()     // Close audio device

r.CloseWindow()          // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / core / core_basic_window.js View on Github external
while (!r.WindowShouldClose())    // Detect window close button or ESC key
{
    // Update
    //----------------------------------------------------------------------------------
    // TODO: Update your variables here
    //----------------------------------------------------------------------------------

    // Draw
    //----------------------------------------------------------------------------------
    r.BeginDrawing()

        r.ClearBackground(r.RAYWHITE)

        r.DrawText("Congrats! You created your first window!", 190, 200, 20, r.LIGHTGRAY)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.CloseWindow()        // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / textures / textures_logo_raylib.js View on Github external
// Update
    //----------------------------------------------------------------------------------
    // TODO: Update your variables here
    //----------------------------------------------------------------------------------

    // 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!", 360, 370, 10, r.GRAY)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(texture)       // Texture unloading

r.CloseWindow()                // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github RobLoach / node-raylib / examples / models / models_billboard.js View on Github external
//----------------------------------------------------------------------------------
    r.BeginDrawing()

        r.ClearBackground(r.RAYWHITE)

        r.BeginMode3D(camera)

            r.DrawGrid(10, 1.0)        // Draw a grid

            r.DrawBillboard(camera, bill, billPosition, 2.0, r.WHITE)

        r.EndMode3D()

        r.DrawFPS(10, 10)

    r.EndDrawing()
    //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.UnloadTexture(bill)        // Unload texture

r.CloseWindow()              // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github taniarascia / chip8 / example.js View on Github external
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);
        DrawPoly((Vector2){screenWidth/4*3, 320}, 6, 80, 0, BROWN);
        DrawCircleGradient(screenWidth/4, 220, 60, GREEN, SKYBLUE);
        // NOTE: We draw all LINES based shapes together to optimize internal drawing,
        // this way, all LINES are rendered in a single draw pass
        DrawLine(18, 42, screenWidth - 18, 42, BLACK);
        DrawCircleLines(screenWidth/4, 340, 80, DARKBLUE);
        DrawTriangleLines((Vector2){screenWidth/4*3, 160},
                          (Vector2){screenWidth/4*3 - 20, 230},
                          (Vector2){screenWidth/4*3 + 20, 230}, DARKBLUE);
        */
  r.EndDrawing()
  //----------------------------------------------------------------------------------
}

// De-Initialization
//--------------------------------------------------------------------------------------
r.CloseWindow() // Close window and OpenGL context
//--------------------------------------------------------------------------------------
github taniarascia / chip8 / scripts / native.js View on Github external
)
      } else {
        r.DrawRectangleRec(
          {
            x: j * multiplier,
            y: i * multiplier,
            width: multiplier,
            height: multiplier,
          },
          r.BLACK
        )
      }
    })
  })

  r.EndDrawing()
}

r.CloseWindow()