Karl Zylinski преди 7 месеца
родител
ревизия
78a1dcdf26
променени са 3 файла, в които са добавени 8 реда и са изтрити 4 реда
  1. 1 3
      examples/raylib_ports/2d_camera/2d_camera.odin
  2. 6 0
      karlib.odin
  3. 1 1
      karlib_raylib.odin

+ 1 - 3
examples/raylib_ports/2d_camera/2d_camera.odin

@@ -70,9 +70,7 @@ main :: proc() {
         }
 
         kl.clear({ 245, 245, 245, 255 })
-
         kl.set_camera(camera)
-
         kl.draw_rect({-6000, 320, 13000, 8000}, kl.DARKGRAY)
 
         for i in 0..<MAX_BUILDINGS {
@@ -82,8 +80,8 @@ main :: proc() {
         kl.draw_rect(player, kl.RED)
         kl.draw_line({camera.target.x, -SCREEN_HEIGHT * 10}, {camera.target.x, SCREEN_HEIGHT * 10 }, 1, kl.GREEN)
         kl.draw_line({-SCREEN_WIDTH*10, camera.target.y}, {SCREEN_WIDTH*10, camera.target.y}, 1, kl.GREEN)
-        kl.set_camera(nil)
 
+        kl.set_camera(nil)
         kl.draw_text("SCREEN AREA", {640, 10}, 20, kl.RED)
 
         kl.draw_rect({0, 0, SCREEN_WIDTH, 5}, kl.RED)

+ 6 - 0
karlib.odin

@@ -20,6 +20,12 @@ process_events: proc() : _process_events
 // Present the backbuffer. Call at end of frame to make everything you've drawn appear on the screen.
 present: proc(do_flush := true) : _present
 
+// Flushes the current batch. This sends off everything to the GPU that has been queued in the
+// current batch. Done automatically by `present` (possible to disable). Also done by `set_camera`
+// and `set_scissor_rect` since the batch depends on those options.
+flush: proc() : _flush
+
+// Returns true if the user has tried to close the window.
 window_should_close : proc() -> bool : _window_should_close
 
 // Can be used to restore the internal state using the pointer returned by `init`. Useful after

+ 1 - 1
karlib_raylib.odin

@@ -247,7 +247,7 @@ _process_events :: proc() {
 	rl.PollInputEvents()
 }
 
-_flush_batch :: proc() {
+_flush :: proc() {
 	rlgl.DrawRenderBatchActive()
 }