Skip to content

Instantly share code, notes, and snippets.

Phil Cooper-King PhilCK

Block or report user

Report or block PhilCK

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View stb_truetype_usage.cpp
stbtt_fontinfo ttf_info;
MemoryPtr ttf_file = read_file_to_memory(file_name);
ASSERT(ttf_file.ptr);
stbtt_InitFont(&ttf_info, ttf_file.ptr, stbtt_GetFontOffsetForIndex(ttf_file.ptr, 0));
f32 scale_factor = stbtt_ScaleForPixelHeight(&ttf_info, pixel_height);
i32 ascent, descent, line_gap;
stbtt_GetFontVMetrics(&ttf_info, &ascent, &descent, &line_gap);
View vimrc
set nocompatible " be iMproved, required
filetype off " required
set rtp+=~/.vim/bundle/Vundle.vim
call vundle#begin()
Plugin 'VundleVim/Vundle.vim'
Plugin 'tpope/vim-fugitive'
Plugin 'Valloric/YouCompleteMe'
Plugin 'gilligan/vim-lldb'
@PhilCK
PhilCK / Dumb_varient.hpp
Created Oct 26, 2015
*Barebones* Varient Template.
View Dumb_varient.hpp
// This really isn't safe.
class var
{
public:
explicit var()
{
}
template<typename T, typename... Args>
@PhilCK
PhilCK / rbez.rb
Created Oct 9, 2012
Solves Bezier Curves, and gives control points.
View rbez.rb
# Ruby 1.9
def casteljau_bez(t, control_points, i = 1)
print "b#{i} : "
nextset = []
(control_points.length - 1).times do |p|
View gist:1888308
for(unsigned int i = 0; i < verts.size(); ++i)
{
unsigned int e = i;
float fault = m_faultsize;
if(leftOrRightOfFault(ax, ay, bx, by, i % sizeOfRow, i / sizeOfRow)) {
vert[e].position.y += fault;
} else {
vert[e].position.y -= fault;
}
View gist:1672200
// Fill buffers //
getRenderer()->setShader(m_shaders[0]);
getRenderer()->setShader3f("camPos", &m_camera.getPosition());
getRenderer()->setShader4x4f("viewProj", &m_camera.getViewProjectionMatrix());
TextureID bufferRTs[] = { baseRT, normalRT };
getRenderer()->changeRenderTargets(bufferRTs, 2, depthRT);
getRenderer()->setShader4x4f("world", &m_box->getWorldMatrix());
@PhilCK
PhilCK / p_impl.hpp
Created Jan 8, 2012
Private Impl Class
View p_impl.hpp
class Foo
{
class Pimpl;
std::unique_ptr<Pimpl> p_impl;
public:
// .... //
@PhilCK
PhilCK / C++.sublime-build
Created Jan 5, 2012
Getting Sublime Text to build a C++ file.
View C++.sublime-build
{
"cmd": ["g++", "$file", "-o", "$file_base_name", "-I/usr/local/include"],
"selector": "source.c++",
"windows":
{
"cmd": ["cl", "/Fo${file_path}", "/O2", "$file"]
}
}
@PhilCK
PhilCK / README.markdown
Created Dec 29, 2011
Unit Testing Thing.
View README.markdown

Simple C++ Unit Testing

About

There are loads of C++ unit testing frameworks out there, I created this one because I was doing lots of small projects on a varity of platforms, which included 10 year old compilers. This testing facility aims to be simple to use and simple to install, only using a single header file and basic features.

Features

  • Single header.
@PhilCK
PhilCK / TargerLoader.cpp
Created Dec 29, 2011
Targa Loader, not full featured. Could do with a little clean up.
View TargerLoader.cpp
// TargaLoader.cpp
#include <TargaLoader.hpp>
#include <fstream>
namespace Foo
{
TargaTextureLoader::TargaTextureLoader() :
m_data(NULL)
You can’t perform that action at this time.