Skip to content

Instantly share code, notes, and snippets.

@Shadowblitz16
Shadowblitz16 / ImGuiRatioButton.cpp
Last active August 17, 2022 23:00
ImGui RatioButton
bool RadioButton(const char* text, int* activeItem, int thisItem)
{
if (activeItem != nullptr && *activeItem == thisItem)
ImGui::PushStyleColor(ImGuiCol_Button, ImGui::GetStyle().Colors[ImGuiCol_ButtonActive]);
bool value = ImGui::Button(text);
if (activeItem != nullptr && *activeItem == thisItem)
ImGui::PopStyleColor();
@Shadowblitz16
Shadowblitz16 / IntPtr<T>
Created July 22, 2022 20:35
Generic IntPtr struct for C#
public readonly struct IntPtr<T> where T : unmanaged
{
private readonly IntPtr _data;
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public unsafe IntPtr(IntPtr value)
{
unsafe
{
_data = value;