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 / 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;
}
@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 / 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 / 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 / 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 / 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"))