Skip to content

Instantly share code, notes, and snippets.

@Folling
Folling / imgui_slider.cpp
Last active November 16, 2025 12:07
an incomplete ImGui::Slider wrapper with support for scrolling to change the underlying value, includes support for glm::vec's and can be easily extended
template<typename F, typename T>
concept ImGuiSliderFunc = requires(
F f, std::string_view label, T * v, value_or_ref_t<T> v_min, value_or_ref_t<T> v_max, char const * format, ImGuiSliderFlags flags
) {
{ f(label.data(), v, v_min, v_max, format, flags) } -> std::convertible_to<bool>;
};
template<typename T>
struct delayed_false : std::false_type {};

New Features

  • Sorting anything lexicographically is implemented
  • A new text-editor, currently supporting:
    • bold, italic, underlined, and strikethrough text
    • coloured text
    • different fonts
    • different font-sizes
    • headers 1, 3, and 6
    • bulleted and numbered lists
  • A very basic menu-bar allowing you to save projects in different locations, and return to the project-picker
@Folling
Folling / card
Created February 11, 2018 21:29
using System.Collections;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace Assets.Scripts.Cards {
[RequireComponent(typeof(RectTransform), typeof(Image))]
public class Card : MonoBehaviour,
IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler,
IBeginDragHandler, IDragHandler, IEndDragHandler {
private bool InventoryContains(Item i){
return inventory.FindIndex(item => item.id == i.id) >= 0;
}
#pragma once
#include <algorithm>
#include <functional>
#include <set>
template<typename T>
using rw = std::reference_wrapper<T>;
template<typename T>
using crw = const std::reference_wrapper<T>;
#include "Button.h"
Button::Button() {
}
Button::~Button() {
}
#pragma once
#include <string>
#include <iostream>
#include <bitset>
#include <SDL/SDL.h>
#include "Position.h"
#include "Debug.h"
static void clearPiece( const int sq, position* pos ) {
ASSERT(sqOnBoard(sq));
int piece = pos->pieces[sq];
ASSERT(pieceValid(piece));
int colour = pieceColours[piece];
HASH_PIECE(piece, sq);
int t_pieceNum = -1;
void generateAllMoves(const position* pos, moveList* list) {
ASSERT(pos->checkBoard());
list->count = 0;
int side = pos->side;
bool isWhite = side == WHITE;
// loop for all pawns
if (side == WHITE) {
for (int i = 0; i < pos->pieceNum[P]; i++) {
int sq = pos->pList[P][i];
void generateAllMoves(const position* pos, moveList* list)
{
// TODO reduce pawn move generation to not use the "if" and maybe reduce it to one addPawnMove function
ASSERT(pos->checkBoard());
list->count = 0;
int side = pos->side;