Skip to content

Instantly share code, notes, and snippets.

namespace sw::net
{
std::vector<std::byte> Message::serialize() const
{
auto _out = std::vector<std::byte>(2);
// Write message type first
{
auto _outIt = _out.begin();
#include <asx/vfs.hpp>
#include <asx/fs.hpp>
#include <asx/assert.hpp>
#include <nlohmann/json.hpp>
#include <filesystem>
#include <iostream>
# Enables ADD_GIT_DEPENDENCY functionality
option(ENABLE_GIT_DEPENDENCIES "Enables automatic cloning of dependencies that do not already exit" ON)
find_package(Git QUIET)
#
@JonathanCline
JonathanCline / generated.hpp
Created July 31, 2021 14:58
Prototype C++ code generation for a game engine
#pragma once
// file : sprite.h
// generated at 2021-07-31 09:54:44.8542459 CDT
#include <utility>
#include <array>
#include <jclib/gl/shader.h>
#include <jclib/gl/program.h>
@JonathanCline
JonathanCline / ECS_CRTP_Mixins.hpp
Created July 21, 2021 05:24
Small prototype for using CRTP static mixins in combination with an ECS
#include <iostream>
#include <concepts>
template <typename T>
concept entity_extension = true;
template <typename T, typename ExT>
struct apply_extension;
template <typename T, template <typename U> typename ExT, typename U>
@JonathanCline
JonathanCline / SocketErrorCode.hpp
Created July 3, 2021 21:24
Socket error code header with try hard levels of portability. Will work with winsock codes as well.
#pragma once
#ifndef CCAP_NET_ERROR_H
#define CCAP_NET_ERROR_H
/*
Defines named error codes and provides a target independent get_error() function.
I went a little try hard with the portability stuff.
*/
// Small bit of handling to make this header file more portable
@JonathanCline
JonathanCline / PopularNumber.cpp
Last active June 26, 2021 01:09
This was the solution to an interview question that I did. The goal is to return the number that occurs the majority of the time in a sorted array if there is one. I fixed the minor issue with the binary search function and am uploading this for anyone interested. This was the first time I have implemented a binary search so I'm not too upset ab…
#include <algorithm>
#include <numeric>
#include <string>
#include <vector>
#include <optional>
#define AT_SUBMISSION false
#define AFTER_SUBMISSION true
#pragma once
#include <type_traits>
#include <concepts>
#include <utility>
#include <cassert>
#include <functional>
namespace sae
{
#pragma once
#include <SAEEngine_Components.h>
#include <glm/gtc/matrix_transform.hpp>
#include <glm/gtc/quaternion.hpp>
#include <cstdint>
#include <filesystem>
#include <unordered_map>