Skip to content

Instantly share code, notes, and snippets.

View rokups's full-sized avatar
👾

Rokas Kupstys rokups

👾
View GitHub Profile
static inline float ImCross(const ImVec2& p0, const ImVec2& p1) { return p0.x * p1.y - p0.y * p1.x; }
// Returns +1 if c is on the left side and -1 if it is on the right side of line (a, b).
#define ImOrient(a, b, c) (ImCross((b) - (a), (c) - (a)) > 0 ? +1 : -1)
bool ImQuadContainsPoint(ImVec2 p1, ImVec2 p2, ImVec2 p3, ImVec2 p4, ImVec2 pt)
{
if (ImAbs(ImOrient(p1, p2, pt) + ImOrient(p2, p3, pt) + ImOrient(p3, p1, pt)) == 3) // Is inside triangle (p1, p2, p3)
return true;
if (ImAbs(ImOrient(p1, p3, pt) + ImOrient(p3, p4, pt) + ImOrient(p4, p1, pt)) == 3) // Is inside triangle (p1, p3, p4)
return true;
return false;
@rokups
rokups / CMakeLists.txt
Last active April 18, 2024 04:01
Dear ImGui CMake build script.
#
# CMake build system for Dear ImGui
# =================================
#
# Build instructions:
# 1. Install latest CMake
# * Windows: https://cmake.org/download/ (Tick checkbox to place cmake in system PATH)
# * Linux: from your favorite package manager
# * MacOS: brew install cmake
# 2. Open command prompt in directory containing "imgui" and "imgui_dev" folders
# The MIT License (MIT)
#
# Copyright (c) 2014-2020 Omar Cornut
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
## The MIT License (MIT)
##
## Copyright (c) 2016 Rokas Kupstys
## Copyright (C) 2014-2016 Quinten Lansu
## Copyright (C) 2006-2015 Andreas Rumpf and other contributors
##
## Permission is hereby granted, free of charge, to any person obtaining a copy
## of this software and associated documentation files (the "Software"), to deal
## in the Software without restriction, including without limitation the rights
## to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
include karax/prelude
import karax/localstorage
proc create_dom(data: RouterData): VNode =
result = build_html:
tdiv(class="d-flex flex-column h-100"):
header:
nav(class="navbar navbar-expand-md navbar-dark fixed-top bg-dark"):
a(class="navbar-brand", href="#"):
text "Fixed navbar"
sharklasers.com
grr.la
guerrillamail.biz
guerrillamail.com
guerrillamail.de
guerrillamail.net
guerrillamail.org
guerrillamailblock.com
spam4.me
hostguru.top
#include <functional>
template<typename T>
struct Property
{
Property(T& value)
{
_setter = [&value](T new_value) { value = new_value; }
_getter = [&value]() { return value; }
}
[
{
"type": "glob",
"comment": "Convert fbx",
"flags": ["online"],
"glob": "Models/**/*.fbx",
"output": [
{
"type": "subprocess",
"comment": "Import models",
@rokups
rokups / FSM.h
Last active November 25, 2018 09:49
Tiny finite state machine implementation powered by preprocessor abuse.
//
// Copyright (c) 2018 Rokas Kupstys
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
//
#!/usr/bin/env sh
param() {
if [[ "$1" == "" ]];
then
echo $2
else
echo $1
fi
}