Starter: Update starter code
This commit is contained in:
parent
aa1091c4d3
commit
74b52cb8c2
39
starter.py
39
starter.py
@ -1,5 +1,5 @@
|
||||
import pyray as RL
|
||||
from pyray import (Rectangle as Rect)
|
||||
from pyray import (Rectangle as Rect, Vector2 as Vec2, Vector3 as Vec3, Camera3D)
|
||||
import math
|
||||
import pdb
|
||||
import random
|
||||
@ -11,29 +11,44 @@ screen_height = 1024
|
||||
|
||||
@dataclass
|
||||
class World:
|
||||
cam: Camera3D
|
||||
frame_count: int = 0
|
||||
|
||||
def init() -> World:
|
||||
pass
|
||||
|
||||
def init():
|
||||
def player_input(w: World):
|
||||
pass
|
||||
|
||||
def player_input():
|
||||
def update(w: World):
|
||||
pass
|
||||
|
||||
def update():
|
||||
def draw_3d(w: World):
|
||||
pass
|
||||
|
||||
def draw():
|
||||
RL.begin_drawing()
|
||||
RL.clear_background(RL.WHITE)
|
||||
|
||||
RL.end_drawing()
|
||||
def draw_2d(w: World):
|
||||
pass
|
||||
|
||||
RL.init_window(screen_width, screen_height, "Starter");
|
||||
RL.set_target_fps(60)
|
||||
|
||||
init()
|
||||
cam = Camera3D(Vec3(0, 0, 10), RL.vector3_zero(), Vec3(0, 1, 0), 60, 1)
|
||||
w = World(cam)
|
||||
while not RL.window_should_close():
|
||||
player_input()
|
||||
update()
|
||||
draw()
|
||||
player_input(w)
|
||||
update(w)
|
||||
|
||||
# Drawing
|
||||
RL.begin_drawing()
|
||||
RL.clear_background(RL.WHITE)
|
||||
|
||||
RL.begin_mode_3d(w.cam)
|
||||
draw_3d(w)
|
||||
RL.end_mode_3d()
|
||||
|
||||
draw_2d(w)
|
||||
|
||||
RL.end_drawing()
|
||||
w.frame_count += 1
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user