Skip to content

Instantly share code, notes, and snippets.

@victorholt
victorholt / array1d_array_2d_example.cpp
Created March 14, 2021 23:00
Simple Array 1D to Array 2D and back
#include <iostream>
#include <string>
#include <vector>
static std::vector<int> map;
static int mapSize = 3;
int initMap()
{
for (int i = 0; i < (mapSize * mapSize); i++) {
@victorholt
victorholt / docker_notes.sh
Created February 12, 2019 16:38
Docker Notes
# Run image and keep it going.
docker run --name alpine_os -it -d alpine tail -f /dev/null
@victorholt
victorholt / alloc_test.cpp
Created May 26, 2018 18:39
C++ Memory Pool Allocation
// Example program
#include <iostream>
#include <string>
#include <unordered_map>
#include <vector>
#include <cstring>
#include <assert.h>
using namespace std;
template<typename T>
@victorholt
victorholt / installer.go
Created March 7, 2018 18:44
Docker Installer
package main
import (
"fmt"
"io/ioutil"
"os"
"os/exec"
"reflect"
"regexp"
"strings"
@victorholt
victorholt / CustomMesh.cpp
Last active November 27, 2017 00:25
CustomMesh Source
//
// Created by Victor Holt on 3/18/2017.
//
#include <GameSencha/Game/Graphics/CustomMesh.h>
#include <GameSencha/Core/SenchaLogger.h>
gs_namespaces
//! Constructor.
//! \param context
//! \param isDynamic
@victorholt
victorholt / CustomMesh.h
Last active November 27, 2017 00:24
CustomMesh Header
//
// Created by Victor Holt on 3/18/2017.
// Reference: (rbnpontes) http://discourse.urho3d.io/t/a-mesh-generator/2361
//
#pragma once
#include <GameSencha/Common/GameSenchaBasePCH.h>
gs_nsstart
#define CM_MAX_FACES_PER_GEOM_SM 500
#define CM_MAX_FACES_PER_GEOM_LG 25000
@victorholt
victorholt / urho3d_image_lodenode.cpp
Last active June 19, 2017 14:46
LodeNode Image Loading for Terrain
// Storage for our 16bit pixel.
union uimage_data
{
uint16_t s;
uint8_t b[2];
};
Image* LoadHeightmap(const String& heightmapFilePath)
{
std::vector<unsigned char> pngData;
@victorholt
victorholt / FoliageComponent.cpp
Created May 2, 2017 14:23
FoliageComponent Source
//
// Created by Victor Holt on 5/1/2017.
//
#include <cor-game/components/FoliageComponent.h>
#include <cor-game/GameEngine.h>
#include <cor-game/terrain/Grid.h>
#include <cor-game/terrain/GridCell.h>
#include <gs-common/helpers/NumberHelper.hpp>
#include <gs-common/helpers/MathHelper.h>
#include <gs-common/core/SenchaThreadManager.h>
@victorholt
victorholt / FoliageComponent.h
Created May 2, 2017 14:22
FoliageComponent Header
//
// Created by Victor Holt on 5/1/2017.
//
#pragma once
#include <gs-common/PreCompiledHeadersUrho.h>
#include <gs-common/helpers/SimplePerlin.h>
#include <gs-common/helpers/Array2D.h>
#include <gs-graphics/CustomMesh.h>
using namespace Urho3D;
gs_nsstart
@victorholt
victorholt / CustomMesh.cpp
Last active June 27, 2017 03:50
CustomMesh Src Refactored
//
// Created by Victor Holt on 3/18/2017.
//
#include <gs-graphics/CustomMesh.h>
using namespace Urho3D;
using namespace Sencha;
//! Constructor.
//! \param context
//! \param isDynamic