Giter VIP home page Giter VIP logo

gopixelsnake's Introduction

Go Pixel Snake

Go Pixel Snake is a weekend project to create a Snake game in Go, using the Pixel game library.

Go Pixel Snake

Install

Build from source

The Pixel game engine uses an Opengl back-end which requires platform specific dependencies for compilation. You will have to install these dependencies on your system first.

Go Pixel Snake uses the go dep tool to manage its own dependencies.

go get github.com/golang/dep
go get github.com/benjmarshall/gopixelsnake
cd $GOPATH/src/github.com/benjmarshall/gopixelsnake
dep ensure
go install

Pre-built

Alternatively download one of the pre-built binaries from the releases page.

Bugs

There are probably many bugs in here. If you spot something major please submit an issue.

gopixelsnake's People

Contributors

benjmarshall avatar sempr avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

sempr

gopixelsnake's Issues

tickerMultiplex causes 100% CPU usage

Hi! Cool game and thanks for using my lib ;)

However, your game consumer much more CPU than required and the reason is the tickerMultiplex function:

func tickerMultiplex(out chan<- time.Time, tickerIn <-chan time.Time, startIn <-chan time.Time) {
	for true {
		select {
		case t := <-tickerIn:
			out <- t
		case t, ok := <-startIn:
			if !ok {
				return
			}
			out <- t
		default:
		}
	}
}

Due to the default: branch, this for loop spins furiously. Removing the default branch fixes the problem (the select will wait for either of the channels in such case, consuming no CPU).

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.