Skip to content

Instantly share code, notes, and snippets.

View copyrat90's full-sized avatar

copyrat90

View GitHub Profile
@copyrat90
copyrat90 / error_code_example.cpp
Created November 9, 2024 08:54
`std::error_code` usage example
#include <cassert>
#include <iostream>
#include <string>
#include <system_error>
#include <type_traits>
// 온라인 쇼핑몰에서 상품을 구매할 때 발생할 수 있는 오류
enum PurchaseErrc {
/* 정상 처리 (오류 아님) */
PE_OK = 0,
@copyrat90
copyrat90 / gba audio registers.md
Last active November 3, 2023 10:58
GBA Audio Registers
@copyrat90
copyrat90 / butano-vscode-cpptools.md
Last active July 6, 2026 10:06
Setup intellisense for Butano project with VSCode C/C++ extension

Setup intellisense for Butano project with VSCode C/C++ extension

  1. Install C/C++ extension for VSCode
  2. Copy the snippet below, and paste it as <yourProjectRoot>/.vscode/c_cpp_properties.json
  3. Change "<yourPathToButano>/butano/include", to your location of Butano
    • For example, if you installed Butano to the C:/butano, it should be "C:/butano/butano/include",

Note

@copyrat90
copyrat90 / tomee-gba-link-cable-pin.md
Last active May 6, 2023 14:38
Wire colors for `Tomee 2 Player GBA Link Cable`
@copyrat90
copyrat90 / enum_as_flags.hpp
Last active January 10, 2023 00:59
enum_as_flags.hpp
#ifndef COPYRAT90_ENUM_AS_FLAGS_HPP
#define COPYRAT90_ENUM_AS_FLAGS_HPP
#include <type_traits>
#define ENUM_AS_FLAGS(Enum) \
static_assert(std::is_enum<Enum>::value, "Template argument for Enum is not an enum."); \
\
constexpr bool operator!(Enum a) { \
using Int = typename std::underlying_type<Enum>::type; \
@copyrat90
copyrat90 / problem.cpp
Last active February 20, 2021 08:43
std::function callback example (video game)
#include <iostream>
class Character
{
public:
Character(int maxHP) : m_maxHP(maxHP), m_currentHP(maxHP) {};
void Update()
{
if (m_isPoisoned)