imgui-bindings 0.1.16 → 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -5,17 +5,40 @@ require_relative 'imgui'
5
5
 
6
6
  module ImGui
7
7
 
8
+ CAMERA_MOVE_SPEED = 5.4
9
+ CAMERA_ROTATION_SPEED = 0.03
10
+ CAMERA_PAN_SPEED = 2.0
11
+ CAMERA_MOUSE_MOVE_SENSITIVITY = 0.003
12
+ CAMERA_ORBITAL_SPEED = 0.5
13
+
8
14
  @@g_BackendPlatformName = FFI::MemoryPointer.from_string("imgui_impl_raylib")
15
+ @@g_BackendRendererName = FFI::MemoryPointer.from_string("imgui_impl_raylib")
9
16
 
10
17
  # ImGui::GetCurrentContext().address => ImGui_ImplRaylib_Data
11
18
  @@g_BackendData = Hash.new
12
19
 
13
20
  # [INTERNAL]
14
21
  class ImGui_ImplRaylib_Data
15
- attr_accessor :time
22
+ attr_accessor :time, :textures, :warned_viewports_unsupported
16
23
 
17
24
  def initialize
18
25
  @time = 0.0
26
+ @textures = {}
27
+ @warned_viewports_unsupported = false
28
+ end
29
+ end
30
+
31
+ # [INTERNAL]
32
+ def self.ImplRaylib_DisableUnsupportedViewports(io = nil)
33
+ io = ImGuiIO.new(ImGui::GetIO()) if io == nil
34
+ return if (io[:ConfigFlags] & ImGuiConfigFlags_ViewportsEnable) == 0
35
+
36
+ io[:ConfigFlags] &= ~ImGuiConfigFlags_ViewportsEnable
37
+ bd = ImGui_ImplRaylib_GetBackendData()
38
+ if bd != nil && !bd.warned_viewports_unsupported
39
+ # raylib backend currently supports docking in a single OS window only.
40
+ $stderr.puts('[imgui_impl_raylib] ImGuiConfigFlags_ViewportsEnable is not supported and was disabled.')
41
+ bd.warned_viewports_unsupported = true
19
42
  end
20
43
  end
21
44
 
@@ -28,6 +51,95 @@ module ImGui
28
51
  end
29
52
  end
30
53
 
54
+ # [INTERNAL]
55
+ def self.ImplRaylib_UpdateTexture(tex_raw)
56
+ bd = ImGui_ImplRaylib_GetBackendData()
57
+ return if bd == nil
58
+
59
+ tex = tex_raw.kind_of?(ImTextureData) ? tex_raw : ImTextureData.new(tex_raw)
60
+
61
+ case tex[:Status]
62
+ when ImTextureStatus_WantCreate
63
+ return if tex[:Format] != ImTextureFormat_RGBA32
64
+
65
+ image = Raylib::Image.new
66
+ image[:data] = tex.GetPixels()
67
+ image[:width] = tex[:Width]
68
+ image[:height] = tex[:Height]
69
+ image[:mipmaps] = 1
70
+ image[:format] = Raylib::PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
71
+
72
+ texture = Raylib.LoadTextureFromImage(image)
73
+ raise 'Backend failed to create Raylib texture!' if texture[:id] == 0
74
+
75
+ Raylib.SetTextureFilter(texture, Raylib::TEXTURE_FILTER_BILINEAR)
76
+ Raylib.SetTextureWrap(texture, Raylib::TEXTURE_WRAP_CLAMP)
77
+
78
+ bd.textures[texture[:id]] = texture
79
+
80
+ tex.SetTexID(texture[:id])
81
+ tex.SetStatus(ImTextureStatus_OK)
82
+
83
+ when ImTextureStatus_WantUpdates
84
+ tex_id = tex.GetTexID()
85
+ return if tex_id == 0
86
+
87
+ texture = bd.textures[tex_id]
88
+ if texture == nil
89
+ texture = Raylib::Texture.new
90
+ texture[:id] = tex_id
91
+ texture[:width] = tex[:Width]
92
+ texture[:height] = tex[:Height]
93
+ texture[:mipmaps] = 1
94
+ texture[:format] = Raylib::PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
95
+ end
96
+
97
+ updates = tex[:Updates]
98
+ updates[:Size].times do |i|
99
+ r = ImTextureRect.new(updates[:Data] + ImTextureRect.size * i)
100
+ rec = Raylib::Rectangle.new
101
+ rec[:x] = r[:x].to_f
102
+ rec[:y] = r[:y].to_f
103
+ rec[:width] = r[:w].to_f
104
+ rec[:height] = r[:h].to_f
105
+ Raylib.UpdateTextureRec(texture, rec, tex.GetPixelsAt(r[:x], r[:y]))
106
+ end
107
+ tex.SetStatus(ImTextureStatus_OK)
108
+
109
+ when ImTextureStatus_WantDestroy
110
+ tex_id = tex.GetTexID()
111
+ if tex_id != 0 && tex[:UnusedFrames] > 0
112
+ texture = bd.textures.delete(tex_id)
113
+ if texture == nil
114
+ texture = Raylib::Texture.new
115
+ texture[:id] = tex_id
116
+ texture[:width] = tex[:Width]
117
+ texture[:height] = tex[:Height]
118
+ texture[:mipmaps] = 1
119
+ texture[:format] = Raylib::PIXELFORMAT_UNCOMPRESSED_R8G8B8A8
120
+ end
121
+
122
+ Raylib.UnloadTexture(texture)
123
+ tex.SetTexID(0)
124
+ tex.SetStatus(ImTextureStatus_Destroyed)
125
+ end
126
+ end
127
+ end
128
+
129
+ # [INTERNAL]
130
+ def self.ImplRaylib_ProcessTextureUpdates(draw_data)
131
+ return if draw_data[:Textures] == nil || draw_data[:Textures].address == 0
132
+
133
+ textures = ImVector_ImTextureDataPtr.new(draw_data[:Textures])
134
+ textures[:Size].times do |i|
135
+ tex_ptr = (textures[:Data] + FFI.type_size(:pointer) * i).read_pointer
136
+ next if tex_ptr == nil || tex_ptr.address == 0
137
+
138
+ tex = ImTextureData.new(tex_ptr)
139
+ ImplRaylib_UpdateTexture(tex) if tex[:Status] != ImTextureStatus_OK
140
+ end
141
+ end
142
+
31
143
  # [TODO] Support ClipboardText
32
144
  # g_ClipboardTextData
33
145
  # ImplRaylib_GetClipboardText
@@ -203,7 +315,7 @@ module ImGui
203
315
  when Raylib::KEY_RIGHT_SHIFT then ImGuiKey_RightShift
204
316
  when Raylib::KEY_RIGHT_ALT then ImGuiKey_RightAlt
205
317
  when Raylib::KEY_RIGHT_SUPER then ImGuiKey_RightSuper
206
- when Raylib::KEY_MENU then ImGuiKey_Menu
318
+ when Raylib::KEY_KB_MENU then ImGuiKey_Menu
207
319
  when Raylib::KEY_ZERO then ImGuiKey_0
208
320
  when Raylib::KEY_ONE then ImGuiKey_1
209
321
  when Raylib::KEY_TWO then ImGuiKey_2
@@ -289,7 +401,6 @@ module ImGui
289
401
 
290
402
  # [INTERNAL]
291
403
  def self.ImplRaylib_UpdateMouseData()
292
- bd = ImGui_ImplRaylib_GetBackendData()
293
404
  io = ImGuiIO.new(ImGui::GetIO())
294
405
 
295
406
  # Set OS mouse position if requested (rarely used, only when ImGuiConfigFlags_NavEnableSetMousePos is enabled by user)
@@ -335,17 +446,178 @@ module ImGui
335
446
  # [TODO] Support ImplRaylib_UpdateGamepads
336
447
  #
337
448
 
449
+ # [INTERNAL]
450
+ def self.ImplRaylib_CameraPointer(camera)
451
+ if camera.kind_of?(FFI::Pointer)
452
+ camera
453
+ elsif camera.respond_to?(:pointer)
454
+ camera.pointer
455
+ else
456
+ raise ArgumentError, 'camera must be Raylib::Camera (FFI::Struct) or FFI::Pointer'
457
+ end
458
+ end
459
+
460
+ # ImGui-aware UpdateCamera implementation in Ruby.
461
+ # Unlike Raylib.UpdateCamera(), this checks io[:WantCaptureMouse]/io[:WantCaptureKeyboard]
462
+ # and avoids camera control while ImGui is consuming corresponding inputs.
463
+ def self.ImplRaylib_UpdateCamera(camera, mode)
464
+ camera_ptr = ImplRaylib_CameraPointer(camera)
465
+ io = ImGuiIO.new(ImGui::GetIO())
466
+
467
+ mouse_position_delta = Raylib.GetMouseDelta()
468
+
469
+ move_in_world_plane = (mode == Raylib::CAMERA_FIRST_PERSON) || (mode == Raylib::CAMERA_THIRD_PERSON)
470
+ rotate_around_target = (mode == Raylib::CAMERA_THIRD_PERSON) || (mode == Raylib::CAMERA_ORBITAL)
471
+ lock_view = (mode == Raylib::CAMERA_FREE) || (mode == Raylib::CAMERA_FIRST_PERSON) || (mode == Raylib::CAMERA_THIRD_PERSON) || (mode == Raylib::CAMERA_ORBITAL)
472
+ rotate_up = false
473
+
474
+ frame_time = Raylib.GetFrameTime()
475
+ camera_move_speed = CAMERA_MOVE_SPEED * frame_time
476
+ camera_rotation_speed = CAMERA_ROTATION_SPEED * frame_time
477
+ camera_pan_speed = CAMERA_PAN_SPEED * frame_time
478
+ camera_orbital_speed = CAMERA_ORBITAL_SPEED * frame_time
479
+
480
+ wants_mouse = io[:WantCaptureMouse]
481
+ wants_keyboard = io[:WantCaptureKeyboard]
482
+ any_imgui_window_focused = false
483
+ begin
484
+ any_imgui_window_focused = ImGui.IsWindowFocused(ImGuiFocusedFlags_AnyWindow)
485
+ rescue StandardError
486
+ # Keep backward compatibility with older bindings.
487
+ any_imgui_window_focused = false
488
+ end
489
+ block_keyboard_controls = wants_keyboard || any_imgui_window_focused
490
+
491
+ if mode == Raylib::CAMERA_CUSTOM
492
+ # no-op
493
+ elsif mode == Raylib::CAMERA_ORBITAL
494
+ if !wants_mouse
495
+ rotation = Raylib.MatrixRotate(Raylib.GetCameraUp(camera_ptr), camera_orbital_speed)
496
+ view = Raylib.Vector3Subtract(Raylib::Camera.new(camera_ptr)[:position], Raylib::Camera.new(camera_ptr)[:target])
497
+ view = Raylib.Vector3Transform(view, rotation)
498
+ camera_data = Raylib::Camera.new(camera_ptr)
499
+ camera_data[:position] = Raylib.Vector3Add(camera_data[:target], view)
500
+ end
501
+ else
502
+ if !block_keyboard_controls
503
+ if Raylib.IsKeyDown(Raylib::KEY_DOWN)
504
+ Raylib.CameraPitch(camera_ptr, -camera_rotation_speed, lock_view, rotate_around_target, rotate_up)
505
+ end
506
+ if Raylib.IsKeyDown(Raylib::KEY_UP)
507
+ Raylib.CameraPitch(camera_ptr, camera_rotation_speed, lock_view, rotate_around_target, rotate_up)
508
+ end
509
+ if Raylib.IsKeyDown(Raylib::KEY_RIGHT)
510
+ Raylib.CameraYaw(camera_ptr, -camera_rotation_speed, rotate_around_target)
511
+ end
512
+ if Raylib.IsKeyDown(Raylib::KEY_LEFT)
513
+ Raylib.CameraYaw(camera_ptr, camera_rotation_speed, rotate_around_target)
514
+ end
515
+ if Raylib.IsKeyDown(Raylib::KEY_Q)
516
+ Raylib.CameraRoll(camera_ptr, -camera_rotation_speed)
517
+ end
518
+ if Raylib.IsKeyDown(Raylib::KEY_E)
519
+ Raylib.CameraRoll(camera_ptr, camera_rotation_speed)
520
+ end
521
+ end
522
+
523
+ if !wants_mouse
524
+ if (mode == Raylib::CAMERA_FREE) && Raylib.IsMouseButtonDown(Raylib::MOUSE_BUTTON_MIDDLE)
525
+ mouse_delta = Raylib.GetMouseDelta()
526
+ if mouse_delta[:x] > 0.0
527
+ Raylib.CameraMoveRight(camera_ptr, camera_pan_speed, move_in_world_plane)
528
+ end
529
+ if mouse_delta[:x] < 0.0
530
+ Raylib.CameraMoveRight(camera_ptr, -camera_pan_speed, move_in_world_plane)
531
+ end
532
+ if mouse_delta[:y] > 0.0
533
+ Raylib.CameraMoveUp(camera_ptr, -camera_pan_speed)
534
+ end
535
+ if mouse_delta[:y] < 0.0
536
+ Raylib.CameraMoveUp(camera_ptr, camera_pan_speed)
537
+ end
538
+ else
539
+ Raylib.CameraYaw(camera_ptr, -mouse_position_delta[:x] * CAMERA_MOUSE_MOVE_SENSITIVITY, rotate_around_target)
540
+ Raylib.CameraPitch(camera_ptr, -mouse_position_delta[:y] * CAMERA_MOUSE_MOVE_SENSITIVITY, lock_view, rotate_around_target, rotate_up)
541
+ end
542
+ end
543
+
544
+ if !block_keyboard_controls
545
+ if Raylib.IsKeyDown(Raylib::KEY_W)
546
+ Raylib.CameraMoveForward(camera_ptr, camera_move_speed, move_in_world_plane)
547
+ end
548
+ if Raylib.IsKeyDown(Raylib::KEY_A)
549
+ Raylib.CameraMoveRight(camera_ptr, -camera_move_speed, move_in_world_plane)
550
+ end
551
+ if Raylib.IsKeyDown(Raylib::KEY_S)
552
+ Raylib.CameraMoveForward(camera_ptr, -camera_move_speed, move_in_world_plane)
553
+ end
554
+ if Raylib.IsKeyDown(Raylib::KEY_D)
555
+ Raylib.CameraMoveRight(camera_ptr, camera_move_speed, move_in_world_plane)
556
+ end
557
+ end
558
+
559
+ if Raylib.IsGamepadAvailable(0)
560
+ Raylib.CameraYaw(camera_ptr, -(Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_RIGHT_X) * 2.0) * CAMERA_MOUSE_MOVE_SENSITIVITY, rotate_around_target)
561
+ Raylib.CameraPitch(camera_ptr, -(Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_RIGHT_Y) * 2.0) * CAMERA_MOUSE_MOVE_SENSITIVITY, lock_view, rotate_around_target, rotate_up)
562
+
563
+ if Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_LEFT_Y) <= -0.25
564
+ Raylib.CameraMoveForward(camera_ptr, camera_move_speed, move_in_world_plane)
565
+ end
566
+ if Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_LEFT_X) <= -0.25
567
+ Raylib.CameraMoveRight(camera_ptr, -camera_move_speed, move_in_world_plane)
568
+ end
569
+ if Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_LEFT_Y) >= 0.25
570
+ Raylib.CameraMoveForward(camera_ptr, -camera_move_speed, move_in_world_plane)
571
+ end
572
+ if Raylib.GetGamepadAxisMovement(0, Raylib::GAMEPAD_AXIS_LEFT_X) >= 0.25
573
+ Raylib.CameraMoveRight(camera_ptr, camera_move_speed, move_in_world_plane)
574
+ end
575
+ end
576
+
577
+ if mode == Raylib::CAMERA_FREE && !block_keyboard_controls
578
+ if Raylib.IsKeyDown(Raylib::KEY_SPACE)
579
+ Raylib.CameraMoveUp(camera_ptr, camera_move_speed)
580
+ end
581
+ if Raylib.IsKeyDown(Raylib::KEY_LEFT_CONTROL)
582
+ Raylib.CameraMoveUp(camera_ptr, -camera_move_speed)
583
+ end
584
+ end
585
+ end
586
+
587
+ if ((mode == Raylib::CAMERA_THIRD_PERSON) || (mode == Raylib::CAMERA_ORBITAL) || (mode == Raylib::CAMERA_FREE)) && !wants_mouse
588
+ Raylib.CameraMoveToTarget(camera_ptr, -Raylib.GetMouseWheelMove())
589
+ if Raylib.IsKeyPressed(Raylib::KEY_KP_SUBTRACT)
590
+ Raylib.CameraMoveToTarget(camera_ptr, 2.0)
591
+ end
592
+ if Raylib.IsKeyPressed(Raylib::KEY_KP_ADD)
593
+ Raylib.CameraMoveToTarget(camera_ptr, -2.0)
594
+ end
595
+ end
596
+ end
597
+
338
598
  def self.ImplRaylib_Init()
339
599
  # Setup backend capabilities flags
340
600
  bd = ImGui_ImplRaylib_Data.new
341
601
  @@g_BackendData[ImGui::GetCurrentContext().address] = bd
342
602
 
343
603
  io = ImGuiIO.new(ImGui::GetIO())
604
+ platform_io = ImGuiPlatformIO.new(ImGui::GetPlatformIO())
344
605
 
345
606
  io[:BackendPlatformUserData] = nil
346
607
  io[:BackendPlatformName] = @@g_BackendPlatformName
608
+ io[:BackendRendererUserData] = nil
609
+ io[:BackendRendererName] = @@g_BackendRendererName
347
610
  io[:BackendFlags] |= ImGuiBackendFlags_HasMouseCursors # We can honor GetMouseCursor() values (optional)
348
611
  io[:BackendFlags] |= ImGuiBackendFlags_HasSetMousePos # We can honor io.WantSetMousePos requests (optional, rarely used)
612
+ io[:BackendFlags] |= ImGuiBackendFlags_RendererHasVtxOffset
613
+ io[:BackendFlags] |= ImGuiBackendFlags_RendererHasTextures
614
+ io[:BackendFlags] &= ~(ImGuiBackendFlags_PlatformHasViewports | ImGuiBackendFlags_RendererHasViewports)
615
+
616
+ ImplRaylib_DisableUnsupportedViewports(io)
617
+
618
+ # Conservative limit suitable for most GL backends used by raylib.
619
+ platform_io[:Renderer_TextureMaxWidth] = 8192
620
+ platform_io[:Renderer_TextureMaxHeight] = 8192
349
621
 
350
622
  bd.time = 0.0
351
623
 
@@ -353,10 +625,32 @@ module ImGui
353
625
  end
354
626
 
355
627
  def self.ImplRaylib_Shutdown()
628
+ bd = ImGui_ImplRaylib_GetBackendData()
356
629
  io = ImGuiIO.new(ImGui::GetIO())
630
+ platform_io = ImGuiPlatformIO.new(ImGui::GetPlatformIO())
631
+
632
+ if bd != nil
633
+ bd.textures.each_value do |texture|
634
+ Raylib.UnloadTexture(texture) if texture != nil && texture[:id] != 0
635
+ end
636
+ bd.textures.clear
637
+ end
638
+
357
639
  io[:BackendPlatformName] = nil
358
640
  io[:BackendPlatformUserData] = nil
359
- @@g_BackendData[ImGui::GetCurrentContext()] = nil
641
+ io[:BackendRendererName] = nil
642
+ io[:BackendRendererUserData] = nil
643
+ io[:BackendFlags] &= ~(ImGuiBackendFlags_HasMouseCursors | ImGuiBackendFlags_HasSetMousePos | ImGuiBackendFlags_RendererHasVtxOffset | ImGuiBackendFlags_RendererHasTextures | ImGuiBackendFlags_PlatformHasViewports | ImGuiBackendFlags_RendererHasViewports)
644
+
645
+ begin
646
+ platform_io.ClearRendererHandlers()
647
+ rescue StandardError
648
+ # Older generated bindings may not expose this helper.
649
+ end
650
+
651
+ if ImGui::GetCurrentContext() != nil
652
+ @@g_BackendData.delete(ImGui::GetCurrentContext().address)
653
+ end
360
654
  end
361
655
 
362
656
  def self.ImplRaylib_NewFrame()
@@ -373,6 +667,8 @@ module ImGui
373
667
  io[:DeltaTime] = bd.time > 0 ? (current_time - bd.time).to_f : 1.0 / 60.0
374
668
  bd.time = current_time
375
669
 
670
+ ImplRaylib_DisableUnsupportedViewports(io)
671
+
376
672
  ImplRaylib_ProcessKeyboard()
377
673
  ImplRaylib_UpdateMouseData()
378
674
  ImplRaylib_UpdateMouseCursor()
@@ -389,9 +685,17 @@ module ImGui
389
685
 
390
686
  def self.ImplRaylib_RenderDrawData(draw_data_raw)
391
687
  draw_data = ImDrawData.new(draw_data_raw)
688
+
689
+ fb_width = (draw_data[:DisplaySize][:x] * draw_data[:FramebufferScale][:x]).to_i
690
+ fb_height = (draw_data[:DisplaySize][:y] * draw_data[:FramebufferScale][:y]).to_i
691
+ return if fb_width <= 0 || fb_height <= 0
692
+
693
+ ImplRaylib_ProcessTextureUpdates(draw_data)
694
+
392
695
  Raylib.rlDisableBackfaceCulling()
393
696
 
394
697
  clip_offset = draw_data[:DisplayPos]
698
+ clip_scale = draw_data[:FramebufferScale]
395
699
  draw_data[:CmdListsCount].times do |n|
396
700
  cmd_list = ImDrawList.new((draw_data[:CmdLists][:Data] + FFI.type_size(:pointer) * n).read_pointer)
397
701
  vtx_buffer = cmd_list[:VtxBuffer][:Data] # const ImDrawVert*
@@ -402,15 +706,21 @@ module ImGui
402
706
  if pcmd[:UserCallback] != nil
403
707
  # [TODO] Handle user callback (Ref.: https://github.com/ffi/ffi/wiki/Callbacks )
404
708
  else
405
- rect_min_x = (pcmd[:ClipRect][:x] - clip_offset[:x])
406
- rect_min_y = (pcmd[:ClipRect][:y] - clip_offset[:y])
407
- rect_max_x = (pcmd[:ClipRect][:z] - clip_offset[:x])
408
- rect_max_y = (pcmd[:ClipRect][:w] - clip_offset[:y])
709
+ rect_min_x = (pcmd[:ClipRect][:x] - clip_offset[:x]) * clip_scale[:x]
710
+ rect_min_y = (pcmd[:ClipRect][:y] - clip_offset[:y]) * clip_scale[:y]
711
+ rect_max_x = (pcmd[:ClipRect][:z] - clip_offset[:x]) * clip_scale[:x]
712
+ rect_max_y = (pcmd[:ClipRect][:w] - clip_offset[:y]) * clip_scale[:y]
713
+
714
+ rect_min_x = 0.0 if rect_min_x < 0.0
715
+ rect_min_y = 0.0 if rect_min_y < 0.0
716
+ rect_max_x = fb_width.to_f if rect_max_x > fb_width
717
+ rect_max_y = fb_height.to_f if rect_max_y > fb_height
718
+ next if rect_max_x <= rect_min_x || rect_max_y <= rect_min_y
409
719
 
410
720
  rect_w = rect_max_x - rect_min_x
411
721
  rect_h = rect_max_y - rect_min_y
412
722
 
413
- Raylib.BeginScissorMode(rect_min_x, rect_min_y, rect_w, rect_h)
723
+ Raylib.BeginScissorMode(rect_min_x.to_i, rect_min_y.to_i, rect_w.to_i, rect_h.to_i)
414
724
 
415
725
  # Render triangles
416
726
  indices = idx_buffer + FFI.type_size(:ImDrawIdx) * pcmd[:IdxOffset]
@@ -418,8 +728,7 @@ module ImGui
418
728
  0.step(pcmd[:ElemCount] - 3, 3) do |i|
419
729
  Raylib.rlPushMatrix()
420
730
  Raylib.rlBegin(Raylib::RL_TRIANGLES)
421
- # Raylib.rlSetTexture(pcmd[:TextureId].read_uint32)
422
- Raylib.rlSetTexture(pcmd[:TextureId])
731
+ Raylib.rlSetTexture(pcmd.GetTexID())
423
732
 
424
733
  index = indices.get_array_of_uint16(i * FFI::type_size(:ImDrawIdx), 3)
425
734
 
@@ -452,4 +761,29 @@ module ImGui
452
761
  Raylib.rlEnableBackfaceCulling()
453
762
  end
454
763
 
764
+ # Docking-compatible wrapper API (single viewport only)
765
+ def self.ImplDockingRaylib_Init()
766
+ ImplRaylib_Init()
767
+ end
768
+
769
+ # Docking-compatible wrapper API (single viewport only)
770
+ def self.ImplDockingRaylib_Shutdown()
771
+ ImplRaylib_Shutdown()
772
+ end
773
+
774
+ # Docking-compatible wrapper API (single viewport only)
775
+ def self.ImplDockingRaylib_NewFrame()
776
+ ImplRaylib_NewFrame()
777
+ end
778
+
779
+ # Docking-compatible wrapper API (single viewport only)
780
+ def self.ImplDockingRaylib_RenderDrawData(draw_data_raw)
781
+ ImplRaylib_RenderDrawData(draw_data_raw)
782
+ end
783
+
784
+ # Docking-compatible wrapper API (single viewport only)
785
+ def self.ImplDockingRaylib_UpdateCamera(camera, mode)
786
+ ImplRaylib_UpdateCamera(camera, mode)
787
+ end
788
+
455
789
  end