Skip to content

Instantly share code, notes, and snippets.

@Flix01
Flix01 / mini_mp3_radio_decoder.c
Last active Sep 30, 2020
Very basic single-file, plain C, openAL mp3 radio decoder
View mini_mp3_radio_decoder.c
// gist made after this issue: https://github.com/mackron/dr_libs/issues/142
/*
The license refers to this single file.
Every included or linked library comes with its own license
===============================================================================
Public Domain (www.unlicense.org)
===============================================================================
This is free and unencumbered software released into the public domain.
Anyone is free to copy, modify, publish, use, compile, sell, or distribute this
software, either in source code form or as a compiled binary, for any purpose,
@Flix01
Flix01 / imgui_input_text_multiline_for_std_vector.h.cpp
Created Dec 12, 2017
Experimental attempt to create an ImGui::InputTextMultiline(...) for std::strings
View imgui_input_text_multiline_for_std_vector.h.cpp
// EXPERIMENTAL (ALMOST UNTESTED) InputTextMultiline(...) for std::strings.
// USE IT AT YOUR OWN RISK!
// Example usage:
/*
static std::string text = "Dear ImGui lacks InputTextMultiline(...) for std::string.";
static bool isTextBoxActive = false; // A better implementation should remove this
ImGui::InputTextMultiline("###ADummyLabelForMe",text,isTextBoxActive);
*/
View imguinodegrapheditor_demo2.cpp
// On Ubuntu, I can compile it with the following command line (provided that imgui.h is two folders up, and that I want to use glfw):
// gcc -o basicExample mainBasic.cpp -I"../../" ../../imgui.cpp ../../imgui_draw.cpp -D"IMGUI_INCLUDE_IMGUI_USER_H" -D"IMGUI_INCLUDE_IMGUI_USER_INL" -I"/usr/include/GLFW" -D"IMGUI_USE_GLFW_BINDING" -L"/usr/lib/x86_64-linux-gnu" -lglfw -lX11 -lm -lGL -lstdc++ -s
// This file is intended to test/answer to https://github.com/Flix01/imgui/issues/15
// RESULT:
// Dynamic enum works!
// And if you can use dynamic_cast<>() making new Node types that use it is easier (non-intrusive)
// Otherwise you must modify the code of CustomEnumEditorNode::render(...) for every new user class you add.
//
// Added also some code to serialize/deserialize the enum names ("TestEnumNames") together
@Flix01
Flix01 / edtaa3func.h
Last active Aug 16, 2020
A Signed Distance Font Builder for Dear ImGui
View edtaa3func.h
/*
* edtaa3()
*
* Sweep-and-update Euclidean distance transform of an
* image. Positive pixels are treated as object pixels,
* zero or negative pixels are treated as background.
* An attempt is made to treat antialiased edges correctly.
* The input image must have pixels in the range [0,1],
* and the antialiased image should be a box-filter
* sampling of the ideal, crisp edge.
@Flix01
Flix01 / imguiverticaltext.h
Created Jun 23, 2016
ImDrawList methods to display vertical text in ImGui
View imguiverticaltext.h
#pragma once
#include <imgui.h>
#include <imgui_internal.h>
// ImDrawList methods to display vertical text
/*
// TEST: inside a window:
ImGuiWindow* window = ImGui::GetCurrentWindow();
ImDrawList* dl = window->DrawList;
@Flix01
Flix01 / imguitabwindow.cpp
Last active Apr 12, 2020
ImGui::TabWindow: a self-partitioning ImGui::Window with TabLabels that can be dragged around.
View imguitabwindow.cpp
#include "imguitabwindow.h"
#include <imgui_internal.h>
#include <imgui.h> // intellisense
// TODO: Clean this code, it's a mess!
namespace ImGui {
@Flix01
Flix01 / imguitablabel.h
Last active Mar 27, 2019
A ImGui::TabLabels(...) that supports line wrapping, tab reordering through drag'n'drop and tab closing through MMB press.
View imguitablabel.h
#pragma once
#include <imgui.h>
// USAGE EXAMPLE
/*
ImGui::Text("Tabs (based on the code by krys-spectralpixel):");
static const char* tabNames[] = {"Render","Layers","Scene","World","Object","Constraints","Modifiers","Data","Material","Texture","Particle","Physics"};
static const int numTabs = sizeof(tabNames)/sizeof(tabNames[0]);
static const char* tabTooltips[numTabs] = {"Render Tab Tooltip","","","","Object Type Tooltip","","","","","Tired to add tooltips...",""};
static int tabItemOrdering[numTabs] = {0,1,2,3,4,5,6,7,8,9,10,11};
@Flix01
Flix01 / imguilistview.h
Last active Aug 29, 2015
Minimal ListView implementation for ImGui version v1.31
View imguilistview.h
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
@Flix01
Flix01 / imguifontloader.cpp
Last active Aug 29, 2015
imguifontloader: imgui extension that loads txt-based .fnt and .ttf files
View imguifontloader.cpp
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.
@Flix01
Flix01 / imguistyleserializer.cpp
Last active Jan 29, 2018
imguistyleserializer
View imguistyleserializer.cpp
// This software is provided 'as-is', without any express or implied
// warranty. In no event will the authors be held liable for any damages
// arising from the use of this software.
// Permission is granted to anyone to use this software for any purpose,
// including commercial applications, and to alter it and redistribute it
// freely, subject to the following restrictions:
// 1. The origin of this software must not be misrepresented; you must not
// claim that you wrote the original software. If you use this software
// in a product, an acknowledgment in the product documentation would be
// appreciated but is not required.