diff third_party/raylib/custom.c @ 116:7bd795bac997

[Postdog] Added scrollable area to inputs and history files, buttons to delete and view.
author June Park <parkjune1995@gmail.com>
date Wed, 07 Jan 2026 04:52:17 -0800
parents
children 87d8d3eb3491
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/third_party/raylib/custom.c	Wed Jan 07 04:52:17 2026 -0800
@@ -0,0 +1,86 @@
+#include "third_party/raylib/include/raylib.h"
+#define RAYGUI_IMPLEMENTATION
+#include "third_party/raylib/include/raygui.h"
+
+// -- forward declarations --//
+
+// --- Default Behaviour that should be part of all raylib gui ---/
+void DefaultBehaviours();
+// --- Increase Font Sizes on key press --- //
+void IncreaseFontSize();
+// --- Decrease Font Sizes on key press --- //
+void DecreaseFontSize();
+
+
+void DefaultBehaviours()
+{
+  // Font sizes 
+  IncreaseFontSize();
+  DecreaseFontSize();
+}
+
+void IncreaseFontSize()
+{
+  if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyDown(KEY_EQUAL))
+    GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetStyle(DEFAULT, TEXT_SIZE) + 1);
+}
+
+void DecreaseFontSize()
+{
+  if ((IsKeyDown(KEY_LEFT_SUPER) || IsKeyDown(KEY_LEFT_CONTROL)) && IsKeyDown(KEY_MINUS))
+    GuiSetStyle(DEFAULT, TEXT_SIZE, GuiGetStyle(DEFAULT, TEXT_SIZE) - 1);
+}
+
+
+// --- Layout helper --- //
+Rectangle RightOf(Rectangle ref, float padding)
+{
+  return (Rectangle){
+    .x = ref.x + ref.width + padding,
+    .y = ref.y,
+    .width = 0,
+    .height = ref.height
+  };
+}
+
+Rectangle Below(Rectangle ref, float padding)
+{
+  return (Rectangle){
+    .x = ref.x,
+    .y = ref.y + ref.height + padding,
+    .width = ref.width,
+    .height = 0
+  };
+}
+
+Rectangle LeftColumn(Rectangle container, float ratio, float padding)
+{
+  return (Rectangle){
+    .x = container.x + padding,
+    .y = container.y + padding,
+    .width = (container.width * ratio) - padding,
+    .height = container.height - (2 * padding)
+  };
+}
+
+Rectangle RightColumn(Rectangle container, Rectangle leftCol, float padding)
+{
+  return (Rectangle){
+    .x = leftCol.x + leftCol.width + padding,
+    .y = container.y + padding,
+    .width = container.width - leftCol.width - (3 * padding),
+    .height = container.height - (2 * padding)
+  };
+}
+
+Rectangle HorizontalSplit(Rectangle container, float ratio)
+{
+  return (Rectangle){
+    .x = container.x,
+    .y = container.y,
+    .width = container.width * ratio,
+    .height = container.height
+  };
+}
+
+