Giter VIP home page Giter VIP logo

pixel's Introduction

Pixel GoDoc Go Report Card Join the chat at https://gitter.im/pixellib/Lobby

A hand-crafted 2D game library in Go. Take a look into the features to see what it can do.

go get github.com/faiface/pixel

See requirements for the list of libraries necessary for compilation.

Tutorial

The Wiki of this repo contains an extensive tutorial covering several topics of Pixel. Here's the content of the tutorial parts so far:

Examples

The examples directory contains a few examples demonstrating Pixel's functionality.

To run an example, navigate to it's directory, then go run the main.go file. For example:

$ cd examples/platformer
$ go run main.go

Here are some screenshots from the examples!

Lights Platformer
Lights Platformer
Smoke Xor
Smoke Xor

Features

Here's the list of the main features in Pixel. Although Pixel is still under heavy development, there should be no major breakage in the API. This is not a 100% guarantee, though.

  • Fast 2D graphics
    • Sprites
    • Primitive shapes with immediate mode style IMDraw (circles, rectangles, lines, ...)
    • Optimized drawing with Batch
  • Simple and convenient API
    • Drawing a sprite to a window is as simple as sprite.Draw(window)
    • Adding and subtracting vectors with + and - operators... how?
    • Wanna know where the center of a window is? window.Bounds().Center()
    • ...
  • Full documentation and tutorial
  • Works on Linux, macOS and Windows
  • Window creation and manipulation (resizing, fullscreen, multiple windows, ...)
  • Keyboard and mouse input without events
  • Well integrated with the Go standard library
    • Use "image" package for loading pictures
    • Use "time" package for measuring delta time and FPS
    • Use "image/color" for colors, or use Pixel's own color.Color format, which supports easy multiplication and a few more features
    • Pixel uses float64 throughout the library, compatible with "math" package
  • Geometry transformations with Matrix
    • Moving, scaling, rotating
    • Easy camera implementation
  • Off-screen drawing to Canvas or any other target (Batch, IMDraw, ...)
  • Fully garbage collected, no Close or Dispose methods
  • Full Porter-Duff composition, which enables
    • 2D lighting
    • Cutting holes into objects
    • Much more...
  • Pixel let's you draw stuff and do your job, it doesn't impose any particular style or paradigm
  • Platform and backend independent core
  • Core Target/Triangles/Picture pattern makes it easy to create new drawing targets that do arbitrarily crazy stuff (e.g. graphical effects)
  • Small codebase, ~5K lines of code, including the backend glhf package

Missing features

Pixel is in development and still missing few critical features. Here're the most critical ones.

  • Audio
  • Drawing text
  • Antialiasing (filtering is supported, though)
  • Advanced window manipulation (cursor hiding, window icon, ...)
  • Better support for Hi-DPI displays
  • Mobile (and perhaps HTML5?) backend
  • More advanced graphical effects (e.g. blur)
  • Tests and benchmarks

Implementing these features will get us to the 1.0 release. Contribute, so that it's as soon as possible!

Requirements

PixelGL backend uses OpenGL to render graphics. Because of that, OpenGL development libraries are needed for compilation. The dependencies are same as for GLFW.

  • On macOS, you need Xcode or Command Line Tools for Xcode (xcode-select --install) for required headers and libraries.
  • On Ubuntu/Debian-like Linux distributions, you need libgl1-mesa-dev and xorg-dev packages.
  • On CentOS/Fedora-like Linux distributions, you need libX11-devel libXcursor-devel libXrandr-devel libXinerama-devel mesa-libGL-devel libXi-devel packages.
  • See here for full details.

Contributing

Pixel is in, let's say, mid-stage of development. Many of the important features are here, some are missing. That's why contributions are very important and welcome! All alone, I will be able to finish the library, but it'll take a lot of time. With your help, it'll take much less. I encourage everyone to contribute, even with just an idea. Especially welcome are issues and pull requests.

However, I won't accept everything. Pixel is being developed with thought and care. Each component was designed and re-designed multiple times. Code and API quality is very important here. API is focused on simplicity and expressiveness.

When contributing, keep these goals in mind. It doesn't mean that I'll only accept perfect pull requests. It just means that I might not like your idea. Or that your pull requests could need some rewriting. That's perfectly fine, don't let it put you off. In the end, we'll just end up with a better result.

Don't start working on a pull request before submiting an issue or commenting on one. Proposals also take the form of issues.

For any kind of discussion, feel free to use our Gitter community.

License

MIT

pixel's People

Contributors

faiface avatar gitter-badger avatar

Watchers

 avatar  avatar  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.