Init
This commit is contained in:
53
metal/impl_metal.cpp
Normal file
53
metal/impl_metal.cpp
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
#include "imgui.h"
|
||||
#include "imgui_impl_metal.h"
|
||||
|
||||
namespace cimgui
|
||||
{
|
||||
#include "impl_metal.h"
|
||||
}
|
||||
|
||||
#ifndef IMGUI_DISABLE
|
||||
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplMetal_Init(MtlDevice* device)
|
||||
{
|
||||
return ::ImGui_ImplMetal_Init(reinterpret_cast<MTL::Device*>(device));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplMetal_Shutdown(void)
|
||||
{
|
||||
::ImGui_ImplMetal_Shutdown();
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplMetal_NewFrame(MtlRenderPassDescriptor* renderPassDescriptor)
|
||||
{
|
||||
::ImGui_ImplMetal_NewFrame(reinterpret_cast<MTL::RenderPassDescriptor*>(renderPassDescriptor));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplMetal_RenderDrawData(cimgui::ImDrawData* draw_data, MtlCommandBuffer* commandBuffer, MtlRenderCommandEncoder* commandEncoder)
|
||||
{
|
||||
::ImGui_ImplMetal_RenderDrawData(reinterpret_cast<::ImDrawData*>(draw_data), reinterpret_cast<MTL::CommandBuffer*>(commandBuffer), reinterpret_cast<MTL::RenderCommandEncoder*>(commandEncoder));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplMetal_CreateFontsTexture(MtlDevice* device)
|
||||
{
|
||||
return ::ImGui_ImplMetal_CreateFontsTexture(reinterpret_cast<MTL::Device*>(device));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplMetal_DestroyFontsTexture(void)
|
||||
{
|
||||
::ImGui_ImplMetal_DestroyFontsTexture();
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API bool cimgui::cImGui_ImplMetal_CreateDeviceObjects(MtlDevice* device)
|
||||
{
|
||||
return ::ImGui_ImplMetal_CreateDeviceObjects(reinterpret_cast<MTL::Device*>(device));
|
||||
}
|
||||
|
||||
CIMGUI_IMPL_API void cimgui::cImGui_ImplMetal_DestroyDeviceObjects(void)
|
||||
{
|
||||
::ImGui_ImplMetal_DestroyDeviceObjects();
|
||||
}
|
||||
|
||||
#endif // #ifndef IMGUI_DISABLE
|
||||
29
metal/impl_metal.h
Normal file
29
metal/impl_metal.h
Normal file
@@ -0,0 +1,29 @@
|
||||
|
||||
typedef void MtlDevice;
|
||||
typedef void MtlRenderPassDescriptor;
|
||||
typedef void MtlCommandBuffer;
|
||||
typedef void MtlRenderCommandEncoder;
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
#ifndef IMGUI_DISABLE
|
||||
#include "../dcimgui.h"
|
||||
|
||||
typedef struct ImDrawData_t ImDrawData;
|
||||
CIMGUI_IMPL_API bool cImGui_ImplMetal_Init(MtlDevice* device);
|
||||
CIMGUI_IMPL_API void cImGui_ImplMetal_Shutdown(void);
|
||||
CIMGUI_IMPL_API void cImGui_ImplMetal_NewFrame(MtlRenderPassDescriptor* renderPassDescriptor);
|
||||
CIMGUI_IMPL_API void cImGui_ImplMetal_RenderDrawData(ImDrawData* draw_data, MtlCommandBuffer* commandBuffer, MtlRenderCommandEncoder* commandEncoder);
|
||||
CIMGUI_IMPL_API bool cImGui_ImplMetal_CreateFontsTexture(MtlDevice* device);
|
||||
CIMGUI_IMPL_API void cImGui_ImplMetal_DestroyFontsTexture(void);
|
||||
CIMGUI_IMPL_API bool cImGui_ImplMetal_CreateDeviceObjects(MtlDevice* device);
|
||||
CIMGUI_IMPL_API void cImGui_ImplMetal_DestroyDeviceObjects(void);
|
||||
|
||||
#endif// #ifndef IMGUI_DISABLE
|
||||
#ifdef __cplusplus
|
||||
} // End of extern "C" block
|
||||
#endif
|
||||
19
metal/impl_metal.odin
Normal file
19
metal/impl_metal.odin
Normal file
@@ -0,0 +1,19 @@
|
||||
#+build darwin
|
||||
package impl_metal
|
||||
|
||||
import imgui "../"
|
||||
import mtl "vendor:darwin/Metal"
|
||||
|
||||
foreign import impl_metal "../lib/darwin/libdcimgui_impl_metal_arm64.a"
|
||||
|
||||
@(default_calling_convention = "cdecl", link_prefix = "cImGui_ImplMetal_")
|
||||
foreign impl_metal {
|
||||
Init :: proc(device: ^mtl.Device) -> b8 ---
|
||||
Shutdown :: proc() ---
|
||||
NewFrame :: proc( renderPassDescriptor: ^mtl.RenderPassDescriptor) ---
|
||||
RenderDrawData :: proc(drawData: ^imgui.ImDrawData, commandBuffer: ^mtl.CommandBuffer, commandEncoder: ^mtl.CommandEncoder) ---
|
||||
CreateFontsTexture :: proc(device: ^mtl.Device) -> b8 ---
|
||||
DestroyFontsTexture :: proc () ---
|
||||
CreateDeviceObjects :: proc(device: ^mtl.Device) -> b8 ---
|
||||
DestroyDeviceObjects :: proc () ---
|
||||
}
|
||||
Reference in New Issue
Block a user