Skip to content

Instantly share code, notes, and snippets.

View JSandusky's full-sized avatar

Jonathan Sandusky JSandusky

  • Ohio, United States
View GitHub Profile
// Vector2 into Vector2 swizzles
public static Vector2 XX(this Vector2 v) { return new Vector2(v.X, v.X); }
public static Vector2 YX(this Vector2 v) { return new Vector2(v.Y, v.X); }
public static Vector2 YY(this Vector2 v) { return new Vector2(v.Y, v.Y); }
// Vector2 into Vector3 swizzles
public static Vector3 XXX(this Vector2 v) { return new Vector3(v.X, v.X, v.X); }
public static Vector3 XXY(this Vector2 v) { return new Vector3(v.X, v.X, v.Y); }
public static Vector3 XYX(this Vector2 v) { return new Vector3(v.X, v.Y, v.X); }
public static Vector3 XYY(this Vector2 v) { return new Vector3(v.X, v.Y, v.Y); }
public static Vector3 YXX(this Vector2 v) { return new Vector3(v.Y, v.X, v.X); }
@JSandusky
JSandusky / ImGuiBindings.cpp
Last active November 19, 2019 19:45
Urho3D DearImGui
#include "../Precompiled.h"
#include "../AngelScript/Addons.h"
#include "../AngelScript/Script.h"
#include "../Math/Color.h"
#include "../Math/Vector2.h"
#include "../Math/Vector3.h"
#include "../Math/Vector4.h"
#include <AngelScript\angelscript.h>
@JSandusky
JSandusky / ParseSrc.txt
Created February 5, 2018 10:01
Graph helpers
// vmath = float, vector, matrix
// matrix = float3x3 or float4x4
// scalar = float, vector
// vector = float2, float3, float4
// any = int, float, float2, float3, float4, matrix, bool, object
//======================================================
// basic math
//======================================================
vmath radians(vmath value);
@JSandusky
JSandusky / imgui_bitfield.cpp
Created March 26, 2018 05:56
ImGui Bitfield Checkbox Matrix
bool BitField(const char* label, unsigned* bits, unsigned* hoverIndex)
{
unsigned val = *bits;
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
return false;
unsigned oldFlags = window->Flags;
ImGuiContext* g = ImGui::GetCurrentContext();
@JSandusky
JSandusky / ImSequencer.cpp
Created March 28, 2018 02:41
ImSequencer Revisions
#include "ImSequencer.h"
#include "imgui.h"
#include "imgui_internal.h"
#include <vector>
namespace ImSequencer
{
struct ScrollBarInfo
#include <Urho3D/Resource/Image.h>
#include <vector>
#include <set>
#include <windows.h>
#include <shlobj.h>
#include <Urho3D/DebugNew.h>
@JSandusky
JSandusky / Example.cs
Created April 28, 2018 19:52
ImGuiCLI Example
using ImGuiCLI;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
namespace ImGuiCLITest
{
/// <summary>
/// This is the main type for your game.
/// </summary>
@JSandusky
JSandusky / Effects\WaterGS.hlsl
Created May 13, 2018 03:31
DX11 Geometry Shader in Monogame
cbuffer ShaderData : register(b0)
{
matrix WorldViewProjection;
float3 LightDirection;
float3 LightColor;
};
struct VertexShaderOutput
{
std::vector<String> excludedExtensions = {
".exe",
".dll",
".bat",
".ini",
".layout",
".ilk",
".lib",
".pdb",
};
@JSandusky
JSandusky / imgui.cpp
Last active July 30, 2018 02:15
ImGui::InputText with caret at end
bool ImGui::InputTextEx(const char* label, char* buf, int buf_size, const ImVec2& size_arg, ImGuiInputTextFlags flags, ImGuiTextEditCallback callback, void* user_data)
{
ImGuiWindow* window = GetCurrentWindow();
if (window->SkipItems)
return false;
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackHistory) && (flags & ImGuiInputTextFlags_Multiline))); // Can't use both together (they both use up/down keys)
IM_ASSERT(!((flags & ImGuiInputTextFlags_CallbackCompletion) && (flags & ImGuiInputTextFlags_AllowTabInput))); // Can't use both together (they both use tab key)
ImGuiContext& g = *GImGui;