Skip to content

Instantly share code, notes, and snippets.

View Journeyman1337's full-sized avatar

Daniel Aimé Valcour Journeyman1337

View GitHub Profile
#pragma once
#include <vector>
#include <algorithm>
#include <optional>
#include <stdexcept>
#include <utility>
template <typename T>
class Arena;
#pragma once
#include <variant>
namespace prpg::window_event
{
struct PositionChanged
{
const int xpos;
const int ypos;
@Journeyman1337
Journeyman1337 / concurrentqueue.cpp
Last active September 30, 2021 20:39
concept of a concurrent queue in cpp
#pragma once
#include <mutex>
#include <queue>
#include <optional>
namespace prpg
{
template <class T>
class ConcurrentQueue
{
@Journeyman1337
Journeyman1337 / publisher_pattern.cpp
Created September 29, 2021 20:27
read the comment
/*
Copyright (c) 2021 Daniel Valcour
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 above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
Journeyman's circle iteration algorithm - Public Domain
Does not use division or square roots!
Given:
Circle struct:
```c
typedef struct Circle
{
/*!
* \brief The x position of the center of the circle.
TUI_ERROR_UNKNOWN
TUI_ERROR_ALREADY_INITIALIZED
TUI_ERROR_BACKEND_SPECIFIC
TUI_ERROR_DAMAGED_INSTANCE
TUI_ERROR_DANGLING_CURSOR
TUI_ERROR_DANGLING_GLYPH_ATLAS
TUI_ERROR_DANGLING_INSTANCE
TUI_ERROR_DANGLING_PALETTE
TUI_ERROR_DANGLING_PANEL
TUI_ERROR_DANGLING_TEXTURE
TUIC TASKS
new error TUI_ERROR_INSTANCE_DAMAGED
new error TUI_ERROR_INVALID_COLOR_COUNT
new error TUI_ERROR_NULL_COLORS
new error TUI_ERROR_INVALID_IMAGE_CHANNEL_COUNT
document all places where TUI_ERROR_BACKEND_SPECIFIC can be thrown
release 1.2
for 1.3:
@Journeyman1337
Journeyman1337 / BinaryReader.h
Last active April 12, 2021 12:51
Template class that can read binary data from an array and from a file.
/*
Copyright (c) 2021 Daniel Valcour
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 above copyright notice and this permission notice shall be included in all
@Journeyman1337
Journeyman1337 / quadradic_solver.cpp
Last active March 25, 2021 19:08
Messing around with math...
#include <cmath>
#include <iostream>
int main()
{
double a, b, c;
std::cout << "Quadratic formula solver.\nGive A:" << std::endl;
std::cin >> a;
std::cout << "Give B:" << std::endl;
std::cin >> b;
@Journeyman1337
Journeyman1337 / Chunk.cs
Last active August 3, 2022 03:34
This is a unity chunking system that supports 32km^2 of untextured terrain with lods. To avoid floating point errors, I also implemented a floating origin system which sets the origin as set intervals no to mess up worldspace coords in case they are used for UVs if this was ever textured. youtube video links in vids.txt
using System.Collections;
using System.Collections.Generic;
using System.Runtime.CompilerServices;
using UnityEngine;
[RequireComponent(typeof(MeshFilter))]
[RequireComponent(typeof(MeshRenderer))]
public class Chunk : MonoBehaviour
{
public MeshFilter meshFilter {get; private set;} = null;