Code Monkey home page Code Monkey logo

metalpixelartshaderdemo's Introduction

2D Scaling Pixel Art Shader Demo App

What is it?

This is a demo project for a scaling 2D pixel art shader, currently written in the Metal shading language and available on the Mac OS platform.

It accompanies an article I wrote on Medium, in which I discuss the math behind the shader, why it works, and what the different parameters mean: How To Render Perfect Pixel Art With Apple's Metal Shading Language

How to build and run it

This demo project is somewhat unorthodox. It follows the handmade philosophy, meaning most of the project is built from scratch so you can get a deeper understanding how it works. I also want you to have more control when you incorporate it into your games.

That means this project doesn't use Xcode's build system. It has its own build script that lays out exactly what it does, line by line so you can follow along better.

The build script is located at the following path: code/mac_platform_layer/build.sh

To build the project, open terminal, cd into the aforementioned directory, and then run the script. The built application will appear in the build/mac_os directory.

Why is there an Xcode project?

Like Casey Muratori, I only use Xcode as a debugger. The Xcode project is a bare bones project template that simply lets you add various code files so you can step through them visually with the debugger. It serves no other purpose.

In order to debug this project, you may need to change the app target for the default build scheme to your built application in the build/mac_os directory. Aside from that, you just press the play button and the app will launch inside of the debugger. You ought to be good to go!

What's the deal with the lack of objects?

Unlike Apple's typical sample projects, this demo project doesn't use much object oriented code. I don't find object oriented programming all that helpful and therefore don't use it.

I want to show people an alternative to the mainstream, a way to build games and game engines that is less abstract, more simple, and more direct. I use a minimal form of C++, so it's more like straight C programming for most of the logic that runs on the CPU.

If you've never seen something like this before and find yourself somewhat put off by it, I encourage you to be patient with it and give it a try. You might find that you enjoy having such direct control over the way your software works. I certainly do.

If you don't like it, that's fine too. As I said, there are already plenty of examples of how to do this the object oriented way. Apple's demos are object oriented by default. I figured the world could use more examples that aren't object oriented to balance out the culture.

Where to find me

๐ŸŽฎ ITCH.IO ๐Ÿฆ TWITTER ๐Ÿ“ฑ ITUNES ๐Ÿ“„ MEDIUM ๐Ÿฆ‰ WYZANT

metalpixelartshaderdemo's People

Contributors

theobendixson avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.