raylib/ports/core/core_basic_window
Licence This example has its own licence, rather than Odin's: raylib/ports/LICENSE
These are ported Raylib examples, and as such, they are subject to Raylib's license.
Copyright (c) 2013-2024 Ramon Santamaria (@raysan5)
The rest of the licence
This software is provided "as-is", without any express or implied warranty. In no event
will the authors be held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software for any purpose, including commercial
applications, and to alter it and redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you
wrote the original software. If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented
as being the original software.
3. This notice may not be removed or altered from any source distribution.
Code
core_basic_window.odin ¶70 linesSource
1/*******************************************************************************************
2*
3* raylib [core] example - basic window
4*
5* Example complexity rating: [★☆☆☆] 1/4
6*
7* Welcome to raylib!
8*
9* To test examples, just press F6 and execute 'raylib_compile_execute' script
10* Note that compiled executable is placed in the same folder as .c file
11*
12* To test the examples on Web, press F6 and execute 'raylib_compile_execute_web' script
13* Web version of the program is generated in the same folder as .c file
14*
15* You can find all basic examples on C:\raylib\raylib\examples folder or
16* raylib official webpage: www.raylib.com
17*
18* Enjoy using raylib. :)
19*
20* Example originally created with raylib 1.0, last time updated with raylib 1.0
21*
22* Example licensed under an unmodified zlib/libpng license, which is an OSI-certified,
23* BSD-like license that allows static linking with closed source software
24*
25* Copyright (c) 2013-2025 Ramon Santamaria (@raysan5)
26*
27********************************************************************************************/
28
29package raylib_examples
30
31import rl "vendor:raylib"
32
33//------------------------------------------------------------------------------------
34// Program main entry point
35//------------------------------------------------------------------------------------
36main :: proc() {
37 // Initialization
38 //--------------------------------------------------------------------------------------
39 SCREEN_WIDTH :: 800
40 SCREEN_HEIGHT :: 450
41
42 rl.InitWindow(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - basic window")
43
44 rl.SetTargetFPS(60) // Set our game to run at 60 frames-per-second
45 //--------------------------------------------------------------------------------------
46
47 // Main game loop
48 for !rl.WindowShouldClose() { // Detect window close button or ESC key
49 // Update
50 //----------------------------------------------------------------------------------
51 // TODO: Update your variables here
52 //----------------------------------------------------------------------------------
53
54 // Draw
55 //----------------------------------------------------------------------------------
56 rl.BeginDrawing()
57
58 rl.ClearBackground(rl.RAYWHITE)
59
60 rl.DrawText("Congrats! You created your first window!", 190, 200, 20, rl.LIGHTGRAY)
61
62 rl.EndDrawing()
63 //----------------------------------------------------------------------------------
64 }
65
66 // De-Initialization
67 //--------------------------------------------------------------------------------------
68 rl.CloseWindow() // Close window and OpenGL context
69 //--------------------------------------------------------------------------------------
70}