Skip to content

Instantly share code, notes, and snippets.

View wallstop's full-sized avatar
🎯
Focusing

Eli Pinkerton wallstop

🎯
Focusing
View GitHub Profile
void doTheThing(const SomeEnum& enum)
{
const int bindedVariable =
[&]()
{
switch(enum)
{
case SOME_ENUM_VAL_1:
return 200;
case SOME_ENUM_VAL_2;
@wallstop
wallstop / Temp.cpp
Last active August 29, 2015 14:07
Temp.cpp
class BaseClass
{
public:
BaseClass();
virtual ~BaseClass();
virtual void whoAmI()
{
std::cout << "I'm BaseClass!" << std::endl;
}
#include <stdio.h>
#include <iostream>
#include <sstream>
#include <vector>
#include <string.h>
#include <time.h>
#include <algorithm>
#include <bitset>
@wallstop
wallstop / Create.h
Last active August 29, 2015 14:07
Simple Create Pattern
#pragma once
#include <utility>
template <typename T, typename ... Args>
T create(Args... args)
{
return std::move(T(args...));
}
Animation considerations:
* Each drawable game object (component) has the potential to have animations. Some might not. Do we make a distinction? Do we need to?
- We don't *have* to. If we solve the generic case (all drawable game components have animations), then we can simply say the static content is an animation of frame size 1. While this does require extra math for non-animated components, it should be minimal (currentFrame = (currentFrame + 1) % maxFrames), so it should be fine. If this bites us later, we can break the abstraction. Easier to have it in the first place.
* Each object that does have animation can have multiple animations: idle, walking, attacking, etc. So, they need to know about the sprites for those animations and also know
what animations they correspond to. What is the best way to generically store those sprites/sprite sheets such that they correspond to the correct animations? Do we just
store them one by one on creation in the object's generator class? This means they would
template <class T>
T& operator+=(T& lhs, const T& rhs)
{
for (typename T::size_type i = 0; i < lhs.size(); ++i)
lhs[i] += rhs[i];
return lhs;
}
struct LoopResponse
{
package AIs;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Random;
import Game.AI;
using System;
using System.Collections.Generic;
using System.Diagnostics;
using System.Text;
namespace SimpleSortingTest
{
public class SimpleSortTest
{
private static readonly string POSSIBLE_CHARACTERS = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
final boolean validMove = Arrays.asList(actions).contains(action);
if(!validMove) {
throw new IllegalStateException(String.format("%s did not enter a valid move, (other player) wins!", p));
}
namespace DXGame.Core
{
public interface IIdentifiable
{
UniqueId Id { get; }
}
}