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
|
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 math
|
||||||
import pdb
|
import pdb
|
||||||
import random
|
import random
|
||||||
@ -11,29 +11,44 @@ screen_height = 1024
|
|||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
class World:
|
class World:
|
||||||
|
cam: Camera3D
|
||||||
|
frame_count: int = 0
|
||||||
|
|
||||||
|
def init() -> World:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def init():
|
def player_input(w: World):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def player_input():
|
def update(w: World):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def update():
|
def draw_3d(w: World):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw():
|
def draw_2d(w: World):
|
||||||
RL.begin_drawing()
|
pass
|
||||||
RL.clear_background(RL.WHITE)
|
|
||||||
|
|
||||||
RL.end_drawing()
|
|
||||||
|
|
||||||
RL.init_window(screen_width, screen_height, "Starter");
|
RL.init_window(screen_width, screen_height, "Starter");
|
||||||
RL.set_target_fps(60)
|
RL.set_target_fps(60)
|
||||||
|
|
||||||
init()
|
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():
|
while not RL.window_should_close():
|
||||||
player_input()
|
player_input(w)
|
||||||
update()
|
update(w)
|
||||||
draw()
|
|
||||||
|
# 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