Skip to content

Instantly share code, notes, and snippets.

@krypt-lynx
krypt-lynx / vartical_label.cs
Last active November 20, 2022 03:45
Unity imgui vertical label
public void VerticalLabel(Rect rect, Vector2 clipSize, string text)
{
// the issue:
// while we transforming gui, whe clip area rotates with it
// so, if we want to draw somewhere on untrasformed screen, we have invalid clip area to deal with.
// the best idea I have is to draw on (0,0) of current clip area and move label to desized position using gui matrix intead of label coordinates
// limitations:
// we need to apply clip effect to transformed label manually, we need to know clip area size for that, but I see no way to obrain it
// original clip is still applied, and width and height is now inverted. So, original clip have no space to render the label *horizontaly*, the vertical label will not be rendered correctly either.
// PBDiagnostics
// Simple tool to manipulate programmable block's Storage variable.
ParamsRouter paramsRouter;
public Program()
{
IsolatedRun(() =>
{
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using VRage.Game.ModAPI.Ingame;
namespace Script
{
#region ingame script start
using HarmonyLib;
using RimWorld;
using RWLayout.alpha2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using UnityEngine;
using Verse;
@krypt-lynx
krypt-lynx / FloatSubmenu.cs
Last active February 10, 2021 19:49
Cascading menus implementation for RimWorld game
using RimWorld.Planet;
using RWLayout.alpha2;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using UnityEngine;
using Verse;
namespace RWLayoutTests
@krypt-lynx
krypt-lynx / RecacheColumnWidths_prefix.cs
Last active October 3, 2020 00:43
column widths using Cassowary algorithm
static bool RecacheColumnWidths_prefix(PawnTable __instance)
{
ClSimplexSolver solver = new ClSimplexSolver();
solver.AutoSolve = false;
var cachedColumnWidths = (List<float>)typeof(PawnTable)
.GetField("cachedColumnWidths", BindingFlags.NonPublic | BindingFlags.Instance)
.GetValue(__instance);
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
namespace Publish
{
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Drawing;
using System.Drawing.Imaging;
using System.Linq;
using System.Runtime.InteropServices;
using System.Text;
using System.Threading.Tasks;
List<IMyProgrammableBlock> pbs = new List<IMyProgrammableBlock>();
IMyTextPanel status = null;
public Program() {
}
public void Main(string argument) {
this.GridTerminalSystem.GetBlocksOfType<IMyProgrammableBlock>(pbs);
using Harmony;
using Havok;
using Sandbox.Engine.Physics;
using Sandbox.Game.Entities.Cube;
using System;
using System.Reflection;
using VRage.Plugins;
namespace SpeedLimitFix
{