Skip to content

Instantly share code, notes, and snippets.

@JeffM2501
Created January 3, 2021 05:03
Show Gist options
  • Save JeffM2501/acd9c79ebac46741892ac7270d149d77 to your computer and use it in GitHub Desktop.
Save JeffM2501/acd9c79ebac46741892ac7270d149d77 to your computer and use it in GitHub Desktop.
/*******************************************************************************************
*
* raylib [core] example - Basic window
*
* Welcome to raylib!
*
* To test examples, just press F6 and execute raylib_compile_execute script
* Note that compiled executable is placed in the same folder as .c file
*
* You can find all basic examples on C:\raylib\raylib\examples folder or
* raylib official webpage: www.raylib.com
*
* Enjoy using raylib. :)
*
* This example has been created using raylib 1.0 (www.raylib.com)
* raylib is licensed under an unmodified zlib/libpng license (View raylib.h for details)
*
* Copyright (c) 2014 Ramon Santamaria (@raysan5)
*
********************************************************************************************/
#include "raylib.h"
int main(int argc, char* argv[])
{
// Initialization
//--------------------------------------------------------------------------------------
int screenWidth = 800;
int screenHeight = 800;
InitWindow(screenWidth, screenHeight, "raylib example");
SetTargetFPS(60);
Texture tx = LoadTexture("parrots.png");
// Main game loop
while (!WindowShouldClose()) // Detect window close button or ESC key
{
BeginDrawing();
ClearBackground(RAYWHITE);
DrawTexture(tx, 0, 0, WHITE);
DrawTexturePro(tx, Rectangle{ 0,0,-(float)tx.width,(float)tx.height }, Rectangle{ 0,(float)tx.height,(float)tx.width,(float)tx.height }, Vector2{ 0,0 }, 0, WHITE);
// instructions
DrawFPS(0, 0);
EndDrawing();
//----------------------------------------------------------------------------------
}
// De-Initialization
//--------------------------------------------------------------------------------------
CloseWindow(); // Close window and OpenGL context
//--------------------------------------------------------------------------------------
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment