fixes to examples

This commit is contained in:
richard 2022-02-04 10:42:07 +00:00
parent 7ca36d1285
commit ef91af804b
4 changed files with 9 additions and 9 deletions

View file

@ -31,17 +31,14 @@ pyray.set_target_fps(60) # Set our game to run at 60 frames-per-second
# Main game loop # Main game loop
while not pyray.window_should_close(): # Detect window close button or ESC key while not pyray.window_should_close(): # Detect window close button or ESC key
# Update # Update
box_position_y -= (pyray.get_mouse_wheel_move() * scroll_speed) box_position_y -= int(pyray.get_mouse_wheel_move() * scroll_speed)
# Draw # Draw
pyray.begin_drawing() pyray.begin_drawing()
pyray.clear_background(RAYWHITE) pyray.clear_background(RAYWHITE)
# TODO pyray.draw_rectangle(SCREEN_WIDTH // 2 - 40, box_position_y, 80, 80, MAROON)
# FIXME
pyray.draw_rectangle(
SCREEN_WIDTH // 2 - 40, box_position_y, 80, 80, MAROON)
pyray.draw_text('User mouse wheel to move the cube up and down!', pyray.draw_text('User mouse wheel to move the cube up and down!',
10, 10, 20, GRAY) 10, 10, 20, GRAY)

View file

@ -123,7 +123,7 @@ def camera_test():
rl.BeginMode3D(cam[0]) rl.BeginMode3D(cam[0])
# NOTE(pebaz): For whatever reason, this can solve a percentage of artifacts # NOTE(pebaz): For whatever reason, this can solve a percentage of artifacts
rl.DrawGizmo([100000000, 100000000, 100000000]) #rl.DrawGizmo([100000000, 100000000, 100000000])
rl.DrawGrid(32, 1) rl.DrawGrid(32, 1)

View file

@ -8,7 +8,7 @@ python3 flow-field
""" """
import sys, math, time, random import sys, math, time, random
import glm import glm # Note package is PyGLM, not glm.
from raylib import rl, ffi from raylib import rl, ffi
from raylib.colors import * from raylib.colors import *
@ -28,7 +28,7 @@ rl.SetTargetFPS(60)
#rl.DisableCursor() #rl.DisableCursor()
canvas = rl.LoadRenderTexture(rl.GetScreenWidth(), rl.GetScreenHeight()) canvas = rl.LoadRenderTexture(rl.GetScreenWidth(), rl.GetScreenHeight())
rl.SetTextureWrap(canvas.texture, rl.WRAP_MIRROR_REPEAT) rl.SetTextureWrap(canvas.texture, rl.TEXTURE_WRAP_MIRROR_REPEAT)
def random_point_in_circle(center, radius): def random_point_in_circle(center, radius):
a = random.random() * 2 * math.pi a = random.random() * 2 * math.pi

View file

@ -1,8 +1,11 @@
""" """
FIXME this example is broken with Raylib 4.0
Requirements: Requirements:
- raylib - raylib
- pytweening - pytweening
- pyglm - pyglm
- screeninfo
Windows-Only Requirements: Windows-Only Requirements:
- win32gui - win32gui
@ -18,7 +21,7 @@ import sys, time
import glm import glm
import pytweening as tween import pytweening as tween
import screeninfo import screeninfo
from raylib.dynamic import raylib as rl, ffi from raylib import rl, ffi
from raylib.colors import * from raylib.colors import *