C++ Code Samples

Some small samples C++ code I've written while learning the language.

2D Physics - CollisionFunctions.cpp

Manages collision detection and response for each shape-to-shape collision combination for my 2D Physics project.
This script is primarily calculating shape overlaps, collision normals, etc. In the build, you can click to place shapes, and right-click to place planes.

CollisionFunctions.cpp
Build.zip (extract; run Build.exe)

A* Pathfinding - Pathfinder.cpp

Implements the A* pathfinding algorithm to find the best path to take on a representation of the Melbourne PTV train network.
This script is primarily for performing pathfinding, and also hard-codes the rail map, which is admittedly outrageous but did the job at the time. In the build, you can click to create path start/end points, and press space bar to toggle path visibility.

Pathfinder.cpp
Build.exe

BinaryTree.h

Implements the Binary Tree pattern, and includes a very basic GUI in the build for managing and displaying nodes.
This header-only script includes a 'Draw' function to interface with the application, but was otherwise developed for a simple C++ data structures library. The build provides buttons and an input field to create a graphical Binary Tree of numbers.

BinaryTree.h
Build.exe

LinkedList.h

Implements the Linked List pattern, and demonstrates it with a basic console application to interface with it.
This header-only script includes the entire Linked List developed for a simple C++ data structures library, and the build can be interfaced with by typing the prompts shown into the console.

LinkedList.h
Build.exe

Tic Tac Toe - Board.cpp, Source.cpp

A basic console-based Tic Tac Toe game I created as an introduction to C++ development.
These scripts make up effectively the entire game, and the build can be interfaced with by typing the prompts shown into the console.

Board.cpp
Source.cpp
Build.exe

C# Code Examples

Some small samples C# code I've written while learning the language.
I'm familiar with native C#, but these scripts were made for projects in the Unity engine.

Pancake Panic! - Player.cs

The primary script for managing each player in Pancake Panic!, including managing inputs, movement and combat, triggering animations and tracking player stats. With hindsight, many aspects of this script could be improved, and it should have been made more modular, but this was the first large Unity project I developed, and was the sole programmer on.

Player.cs

Rope Simulation - VerletRope.cs

The primary script I developed as part of my Rope Simulation project.
Some aspects are still commented as WIP, but everything I wrote about when describing the project is contained within this one script.

VerletRope.cs