Skip to content

Instantly share code, notes, and snippets.

View Journeyman1337's full-sized avatar

Daniel Aimé Valcour Journeyman1337

View GitHub Profile
@Journeyman1337
Journeyman1337 / atlas.json
Created February 6, 2020 17:01
atlas for cp437_12x12.png
{
"sheets":
[
{
"File":"cp437_12x12.png",
"TilesWide":"16",
"TilesTall":"16",
"TileWidth":"12",
"TileHeight":"12",
"BackColor":"0,0,0,1",
@Journeyman1337
Journeyman1337 / generational.c
Last active May 18, 2020 22:22
This is a datastructure based on the concept of generational indexing mentioned in this talk: https://www.youtube.com/watch?v=P9u8x13W7UE. This type of datastructure is very useful for use as the backbone of an Entity Component System.
/*
Copyright 2020 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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE O
@Journeyman1337
Journeyman1337 / mergeSort.h
Last active August 16, 2020 16:55
Templates for merge sorting objects that implemented operator<=
#pragma once
#include<memory>
namespace MergeSort_internal
{
template <typename T>
void merge(T* arr, int l, int m, int r)
{
int i, j, k;
int n1 = m - l + 1;
@Journeyman1337
Journeyman1337 / example.cpp
Last active December 15, 2020 17:18
roguelike renderer header only library that works but not finished (or documented). Most of the work per frame is done in the vertex shader, which is simillar to how Dwarf Fortress does it. I didn't continue working on this because I found it to be not very practical in a header only format.
#include <glad/glad.h>
#include <GLFW/glfw3.h>
#define RLH_IMPLEMENTATION
#define RLH_OPENGL_3_3
#include <roguelike.h>
#define STB_IMAGE_IMPLEMENTATION
#include <stb_image.h>
@Journeyman1337
Journeyman1337 / glDebug.h
Last active January 4, 2021 15:54
An opengl debugging header only library I made a while back.
/*
MIT License
Copyright (c) 2020 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
@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;
using System.Collections;
using System.Collections.Generic;
using UnityEditor.Build;
using UnityEngine;
using UnityEngine.Tilemaps;
/// <summary>
/// An experimental chunk made with a procedural mesh.
/// </summary>
[RequireComponent(typeof(MeshFilter), typeof(MeshRenderer))]
/*
Copyright (c) 2020 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.
@Journeyman1337
Journeyman1337 / cmd output
Last active April 1, 2021 02:59
shader preprocessor wip
layout(location = 0) in vec3 aPosition;
layout(location = 1) in vec2 aTexCoord;
out vec2 texCoord;
uniform mat4 _MODEL;
uniform mat4 _VIEW;
uniform mat4 _PROJECTION;
@Journeyman1337
Journeyman1337 / observer.cpp
Last active April 6, 2021 00:27
observer/listener pattern with template version that publishes the data in an argument to all observers (subscribers).
/*
Copyright 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.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OT