made core_scissor_test.py stand for the Python API conventions
This commit is contained in:
parent
0939ca3a06
commit
b506ebb34d
1 changed files with 9 additions and 15 deletions
|
@ -7,12 +7,6 @@ raylib [core] example - Scissor Test
|
|||
# Import
|
||||
# ------------------------------------------------------------------------------------
|
||||
from pyray import *
|
||||
from raylib.colors import (
|
||||
RAYWHITE,
|
||||
LIGHTGRAY,
|
||||
RED,
|
||||
BLACK
|
||||
)
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
||||
# ------------------------------------------------------------------------------------
|
||||
|
@ -26,8 +20,8 @@ def main():
|
|||
|
||||
init_window(SCREEN_WIDTH, SCREEN_HEIGHT, "raylib [core] example - scissor test")
|
||||
|
||||
scissorArea = Rectangle(0, 0, 300, 300)
|
||||
scissorMode = True
|
||||
scissor_area = Rectangle(0, 0, 300, 300)
|
||||
scissor_mode = True
|
||||
|
||||
set_target_fps(60) # Set our game to run at 60 frames-per-second
|
||||
# --------------------------------------------------------------------------------------
|
||||
|
@ -37,11 +31,11 @@ def main():
|
|||
# Update
|
||||
# ----------------------------------------------------------------------------------
|
||||
if is_key_pressed(KeyboardKey.KEY_S):
|
||||
scissorMode = not scissorMode
|
||||
scissor_mode = not scissor_mode
|
||||
|
||||
# Centre the scissor area around the mouse position
|
||||
scissorArea.x = get_mouse_x() - scissorArea.width/2
|
||||
scissorArea.y = get_mouse_y() - scissorArea.height/2
|
||||
scissor_area.x = get_mouse_x() - scissor_area.width/2
|
||||
scissor_area.y = get_mouse_y() - scissor_area.height/2
|
||||
# ----------------------------------------------------------------------------------
|
||||
|
||||
# Draw
|
||||
|
@ -50,18 +44,18 @@ def main():
|
|||
|
||||
clear_background(RAYWHITE)
|
||||
|
||||
if scissorMode:
|
||||
begin_scissor_mode(int(scissorArea.x), int(scissorArea.y), int(scissorArea.width), int(scissorArea.height))
|
||||
if scissor_mode:
|
||||
begin_scissor_mode(int(scissor_area.x), int(scissor_area.y), int(scissor_area.width), int(scissor_area.height))
|
||||
|
||||
# Draw full screen rectangle and some text
|
||||
# NOTE: Only part defined by scissor area will be rendered
|
||||
draw_rectangle(0, 0, get_screen_width(), get_screen_height(), RED)
|
||||
draw_text("Move the mouse around to reveal this text!", 190, 200, 20, LIGHTGRAY)
|
||||
|
||||
if scissorMode:
|
||||
if scissor_mode:
|
||||
end_scissor_mode()
|
||||
|
||||
draw_rectangle_lines_ex(scissorArea, 1, BLACK)
|
||||
draw_rectangle_lines_ex(scissor_area, 1, BLACK)
|
||||
draw_text("Press S to toggle scissor test", 10, 10, 20, BLACK)
|
||||
|
||||
end_drawing()
|
||||
|
|
Reference in a new issue