This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <memory> | |
template <typename T> | |
class ValueGetter { | |
public: | |
constexpr explicit ValueGetter(const T& value) noexcept : m_value{value} { | |
} | |
constexpr const T& get() const { | |
return m_value; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use crate::chip8::{Chip8, Frame}; | |
use std::fs::File; | |
use std::io::Read; | |
use std::path::Path; | |
use std::sync::atomic::Ordering; | |
const INITIAL_SCALE: u32 = 8; | |
const WIDTH: usize = 64; | |
const HEIGHT: usize = 32; | |
const TEXTURE_SIZE: usize = WIDTH * HEIGHT * 4; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cstdint> | |
#include <iostream> | |
#include <map> | |
#include <optional> | |
#include <tuple> | |
#include <vector> | |
using s64 = std::int64_t; | |
using Element = std::pair<s64, std::size_t>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cstdint> | |
#include <iostream> | |
#include <optional> | |
#include <tuple> | |
#include <vector> | |
#include <thread> | |
#include <map> | |
#include <iterator> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
#ifdef _MSC_VER | |
#include <intrin.h> | |
#define clz(x) __lzcnt64(x) | |
#else | |
#define clz(x) __builtin_clzll(x) | |
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <array> | |
#include <cmath> | |
#include <iostream> | |
#include <string> | |
#include <tuple> | |
constexpr double PI = 3.14159265358979323846; | |
int main() { | |
std::array<std::pair<double, double>, 'Z' - 'A' + 1> char_coords{}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <cmath> | |
#include <cstdint> | |
#include <iostream> | |
// I like rust's primitives better | |
using u8 = std::uint_fast8_t; | |
using u16 = std::uint_fast16_t; | |
using u32 = std::uint_fast32_t; | |
using u64 = std::uint_fast64_t; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
public class InputManager : MonoBehaviour | |
{ | |
static readonly Vector2 x1 = new Vector2(1f, 0f); | |
public abstract class InputBase | |
{ | |
public abstract Vector2 Get(); | |
static public implicit operator Vector2(InputBase inputTypeBase){ | |
return inputTypeBase.Get(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <algorithm> | |
#include <array> | |
#include <iostream> | |
#include <string> | |
#include <type_traits> | |
constexpr std::array<char, 27> ALPHABET = []() constexpr { | |
std::remove_const<decltype(ALPHABET)>::type data{}; | |
data[0] = ' '; | |
for (auto i = 0; i < data.size() - 1; ++i) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdint> | |
#include <iostream> | |
#include <vector> | |
#include <set> | |
#include <iterator> | |
using u32 = std::uint32_t; | |
void run(std::istream& stream); |
OlderNewer