Core examples (#11)
* Added core_input_keys example * Added core_basic_window example * Added core_input_mouse example * Added core_input_mouse_wheel example
This commit is contained in:
parent
8a30502288
commit
76e945e1c9
4 changed files with 199 additions and 0 deletions
41
examples/core/core_basic_window.py
Normal file
41
examples/core/core_basic_window.py
Normal file
|
@ -0,0 +1,41 @@
|
|||
"""
|
||||
|
||||
raylib [core] example - Basic window
|
||||
|
||||
"""
|
||||
from raylib.pyray import PyRay
|
||||
from raylib.colors import (
|
||||
RAYWHITE,
|
||||
LIGHTGRAY,
|
||||
)
|
||||
|
||||
|
||||
pyray = PyRay()
|
||||
|
||||
|
||||
# Initialization
|
||||
SCREEN_WIDTH = 800
|
||||
SCREEN_HEIGHT = 450
|
||||
|
||||
pyray.init_window(SCREEN_WIDTH, SCREEN_HEIGHT,
|
||||
'raylib [core] example - basic window')
|
||||
pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||
|
||||
|
||||
# Main game loop
|
||||
while not pyray.window_should_close(): # Detect window close button or ESC key
|
||||
# Update
|
||||
# TODO: Update your variables here
|
||||
|
||||
# Draw
|
||||
pyray.begin_drawing()
|
||||
|
||||
pyray.clear_background(RAYWHITE)
|
||||
pyray.draw_text(
|
||||
'Congrats! You created your first window!', 190, 200, 20, LIGHTGRAY)
|
||||
|
||||
pyray.end_drawing()
|
||||
|
||||
|
||||
# De-Initialization
|
||||
pyray.close_window() # Close window and OpenGL context
|
Reference in a new issue