Skip to content

Instantly share code, notes, and snippets.

View thennequin's full-sized avatar

Thibault Hennequin thennequin

  • Kylotonn
  • Paris, France
View GitHub Profile
@thennequin
thennequin / DisplayInImGui.cpp
Last active November 16, 2022 16:00
Ini Config Reader/Writer
Ini::IniConfig& m_oIniConfig;
Ini::CategoryValueMap& mCategories = m_oIniConfig.GetCategories();
if (ImGui::Button("Reload"))
{
m_oIniConfig.Load("Config.ini", true, false);
}
ImGui::SameLine();
if (ImGui::Button("Save"))
@thennequin
thennequin / ColorPicker.cpp
Created December 22, 2015 11:25
Color picker
bool ColorSelector(const char* pLabel, ImVec4& oRGBA)
{
const ImU32 c_oColorGrey = ImGui::ColorConvertFloat4ToU32(ImVec4(0.75f,0.75f,0.75f,1.f));
const ImU32 c_oColorBlack = ImGui::ColorConvertFloat4ToU32(ImVec4(0.f,0.f,0.f,1.f));
const ImU32 c_oColorBlackTransparent = ImGui::ColorConvertFloat4ToU32(ImVec4(0.f,0.f,0.f,0.f));
const ImU32 c_oColorWhite = ImGui::ColorConvertFloat4ToU32(ImVec4(1.f,1.f,1.f,1.f));
ImGui::PushID(pLabel);
bool bRet = false;
ImGuiID iID = ImGui::GetID(pLabel);
@thennequin
thennequin / SimpleErrorHandler.php
Created February 7, 2016 00:09
ErrorHandler for PHP
<?php
class SimpleErrorHandler
{
static function Exception($msg, $level = 0)
{
//trigger_error("Member not exist"/*, E_USER_ERROR*/);
$traces = debug_backtrace();
self::PrintError($msg,$traces[$level]["file"], $traces[$level]["line"]);
@thennequin
thennequin / StackWatcher.cpp
Last active May 2, 2018 13:38
StackWatcher for Windows
#include <windows.h>
#include <tchar.h>
#include <stdio.h>
#include <dbghelp.h>
#include <stdlib.h>
#pragma comment(lib, "dbghelp.lib") // for "VerQueryValue"
#pragma comment(lib, "version.lib") // for "VerQueryValue"
#pragma warning(disable:4826)
#pragma warning(disable:4127)
@thennequin
thennequin / NumericSlider.h
Last active October 24, 2022 09:38
Template numeric slider for ImGui
/*
Exemple:
float fValue = 1.f;
DragNumeric("Float", &fValue, 1.0, 0.f, 0.f, "%f");
double fDoubleValue = 1.f;
DragNumeric("Double", &fDoubleValue, 1.0, 0.0, 0.0, "%lf");
*/
@thennequin
thennequin / JsonStthm.cpp
Last active October 10, 2016 22:39
JsonStthm: Easy to use Json parser/writer
#include "JsonStthm.h"
namespace JsonStthm
{
JsonValue::JsonMember::JsonMember(const ImwChar* pName, JsonValue* pValue)
{
m_pName = NULL;
SetName(pName);
m_pValue = pValue;
}
int BeginCombo(const char* pLabel, const char* pValue)
{
ImGuiWindow* pWindow = ImGui::GetCurrentWindow();
ImGuiState& oState = *GImGui;
const ImGuiStyle& oStyle = oState.Style;
const ImGuiID oId = pWindow->GetID(pLabel);
const float fWidth = ImGui::CalcItemWidth();
const ImVec2 oLabelSize = ImGui::CalcTextSize(pLabel, NULL, true);
@thennequin
thennequin / keybase.md
Created November 9, 2017 23:20
keybase.md

Keybase proof

I hereby claim:

  • I am thennequin on github.
  • I am thennequin (https://keybase.io/thennequin) on keybase.
  • I have a public key ASCFW6n8BxTAmHR_GJh7Cbnm22clQwsORXYPCrcSvc1Skwo

To claim this, I am signing this object:

@thennequin
thennequin / PieMenu.cpp
Last active May 26, 2024 18:12
PieMenuAdv
struct PieMenuContext
{
static const int c_iMaxPieMenuStack = 8;
static const int c_iMaxPieItemCount = 12;
static const int c_iRadiusEmpty = 30;
static const int c_iRadiusMin = 30;
static const int c_iMinItemCount = 3;
static const int c_iMinItemCountPerLevel = 3;
struct PieMenu
@thennequin
thennequin / vulkan_util.h
Created March 29, 2018 22:21
vulkan_util.h
/*
Need implementation, use:
#define VULKAN_UTILS_IMPLEMENT
*/
#include <vulkan/vulkan.h>
VkResult vkFindBestPhysicalDevice(VkInstance vkInstance, VkSurfaceKHR vkSurface, VkPhysicalDevice* pOutVkPhysicalDevice, int* pOutVkPhysicalDeviceScore);
//////////////////////////////////