Skip to content

Instantly share code, notes, and snippets.

@lucaspoffo
lucaspoffo / imgui_impl_raylib.odin
Last active April 21, 2025 15:00
Raylib backend for Dear ImGui for the odin bindings
package imgui_impl_raylib
// Based on the raylib extras rlImGui: https://github.com/raylib-extras/rlImGui/blob/main/rlImGui.cpp
/* Usage:
import imgui_rl "imgui_impl_raylib"
import imgui "../../odin-imgui"
main :: proc() {
rl.SetConfigFlags({ rl.ConfigFlag.WINDOW_RESIZABLE })
data Symptom = None | Slight | Medium | Severe deriving (Show, Eq, Enum, Ord)
tempature :: (RealFloat a) => a -> Symptom
tempature t
| t >= 35 && t <= 37 = None
| t < 35 || (t > 37 && t < 39) = Slight
| t >= 39 = Medium
heartRate :: (RealFloat a) => a -> Symptom
heartRate bpm
@lucaspoffo
lucaspoffo / WindowActive.tsx
Created December 9, 2019 14:21
Custom Hook to detect if the window is active.
import { useState, useEffect } from 'react'
export function useWindowActive() {
const [isWindowActive, setWindowIsActive] = useState(!document.hidden && document.hasFocus())
function onBlur() {
setWindowIsActive(false)
}
function onFocus() {