Skip to content

Instantly share code, notes, and snippets.

@se5a
se5a / gist:1ee40c0e6a80b1cddbf324cda857b458
Created January 16, 2019 19:58
Multithread Data read/write
public class XThreadData<T>
{
List<ConcurrentQueue<T>> _subscribers = new List<ConcurrentQueue<T>>();
public void Write(T data)
{
foreach (var sub in _subscribers)
{
sub.Enqueue(data);
}
@se5a
se5a / gist:c748bcc44a8faeb1aeb6b2e85d443de1
Last active May 12, 2019 03:22
Creating a point array for drawing a Hyperbola
internal void CreatePointArray()
{
Vector4 vel = Distance.KmToAU(_newtonMoveDB.CurrentVector_kms);
Vector4 pos = myPosDB.RelativePosition_AU;
Vector4 eccentVector = OrbitMath.EccentricityVector(_sgp, pos, vel);
double e = eccentVector.Length();
double r = pos.Length();
double v = vel.Length();
double a = 1 / (2 / r - Math.Pow(v, 2) / _sgp); //semiMajor Axis
public class BorderGroup
{
private static Vector2 _startPos;
private static Vector2 _labelSize;
private static uint _colour;
public static void BeginBorder(string label, uint colour)
{
ImGui.PushID(label);
_colour = colour;
_startPos = ImGui.GetCursorScreenPos();
@se5a
se5a / gist:b66b9d3cd86992c4cae38888c97ff9c7
Last active April 21, 2020 21:57
Nested BorderGroup
public class BorderGroup
{
private static Vector2[] _startPos = new Vector2[8];
private static Vector2[] _labelSize = new Vector2[8];
private static uint[] _colour = new uint[8];
private static byte _nestIndex = 0;
private static float _dentMulitpier = 3;
public static void BeginBorder(string label, uint colour)
{
ImGui.PushID(label);
@se5a
se5a / gist:ee2c815d295d3210493437fa4e5880b3
Created April 25, 2020 21:20
steam proton log Aurora
======================
Proton: 1586972103 proton-5.0-6
SteamGameId: 14948375713730789376
Command: ['/mnt/98448323-4372-4c8a-904a-30b587cc3685/Games/Aurora/Aurora.exe', '--wine']
Options: {'forcelgadd'}
======================
ERROR: ld.so: object '/home/se5a/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
ERROR: ld.so: object '/home/se5a/.steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/se5a/.steam/ubuntu12_64/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS64): ignored.
ERROR: ld.so: object '/home/se5a/.steam/ubuntu12_32/gameoverlayrenderer.so' from LD_PRELOAD cannot be preloaded (wrong ELF class: ELFCLASS32): ignored.
@se5a
se5a / gist:d6783dfdb0fddfc9b50a2db96b52bb34
Created April 29, 2020 02:28
BorderGroup, and BorderListOptions
public static class BorderListOptions
{
private static Vector2 _labelSize = new Vector2();
private static float _xleft;
private static float _xcentr;
private static float _xright;
private static float _ytop;
private static float _yctr1;
@se5a
se5a / gist:aa83958a981942e12121e5a36ea74fba
Created April 29, 2020 02:29
Using BorderGroup and BorderListOptions
private int _bloSelectedIndex = -1;
void BorderListOptionsWiget()
{
string[] items = new string[_listfoo.Count];
for (int i = 0; i < _listfoo.Count; i++)
{
items[i] = _listfoo[i].name;
}
BorderGroup.Begin("Border List Options: ");
BorderListOptions.Begin("blo", items, ref _bloSelectedIndex, 64);
@se5a
se5a / gist:6cb1383b10cf2b4c4cf9abdffd642337
Last active August 5, 2020 09:52
Dear Imgui GetPos and GetSize demo.
public static class SizesDemo
{
enum FrameOfReference : byte
{
Screen,
Window,
}
static ImDrawListPtr _wdl = ImGui.GetForegroundDrawList();
static Vector2 _windowPos = new Vector2();
static UInt32 _lineColour = ImGui.GetColorU32(new Vector4(1, 0, 0, 1));
public static bool Switch2State(string label, ref bool state, string leftState = "Off", string rightState = "On")
{
int intState = Convert.ToInt32(state);
string strstate = leftState;
if (state == true)
strstate = rightState;
var txtWid = Math.Max(ImGui.CalcTextSize(leftState).X, ImGui.CalcTextSize(rightState).X);
ImGui.PushItemWidth(txtWid * 3);
var cpos = ImGui.GetCursorPos();
if(ImGui.SliderInt(label,ref intState, 0, 1, "" ))
unsafe
{
string rf = "Resources";
ImFontConfig* rawPtr = ImGuiNative.ImFontConfig_ImFontConfig();
ImFontConfigPtr config = new ImFontConfigPtr(rawPtr);
config.PixelSnapH = true;
config.MergeMode = true;
ImFontAtlasPtr fontAtlas = ImGui.GetIO().Fonts;