Skip to content

Instantly share code, notes, and snippets.

View ricanteja's full-sized avatar

Ricardo Antonio Tejada ricanteja

  • Atlanta, Georgia
View GitHub Profile
@Kojirion
Kojirion / shapes.cpp
Last active August 29, 2015 13:57
The separating axis algorithm for arbitrary sf::Shapes
#include <SFML/Graphics.hpp>
#include <cmath>
#include <vector>
#include <memory>
//Vector math functions
float dotProduct(const sf::Vector2f& lhs, const sf::Vector2f& rhs)
{
return lhs.x * rhs.x + lhs.y * rhs.y;
@DanielSWolf
DanielSWolf / Program.cs
Last active July 16, 2024 20:29
Console progress bar. Code is under the MIT License: http://opensource.org/licenses/MIT
using System;
using System.Threading;
static class Program {
static void Main() {
Console.Write("Performing some task... ");
using (var progress = new ProgressBar()) {
for (int i = 0; i <= 100; i++) {
progress.Report((double) i / 100);
@d7samurai
d7samurai / .readme.md
Last active June 9, 2024 01:22
Minimal D3D11 bonus material: pixel art antialiasing

Minimal D3D11 bonus material: pixel art antialiasing

A minimal Direct3D 11 implementation of "antialiased point sampling", useful for smooth fractional movement and non-integer scaling of pixel art AKA "fat pixel" aesthetics.

Also view below side-by-side point sampling comparison on YouTube (video is zoomed in to counter implicit downsampling & compression artifacts and make aa effect more apparent) or check out the Shadertoy.

skull

The actual sampler is set to bilinear filtering (the default D3D11 sampler state) in order to utilize single texture-read hardware interpolation, then emulating point sampling in the shader and applying AA at the fat pixel boundaries. Use with premultiplied alpha textures* and keep a one pixel transparent border around each sprite/tile.