Skip to content

Commit

Permalink
Merge pull request #4 from gopxl/dev
Browse files Browse the repository at this point in the history
v1.0.0 Release PR
  • Loading branch information
duysqubix authored Oct 6, 2023
2 parents 6f938d0 + 741f848 commit 4e0794d
Show file tree
Hide file tree
Showing 222 changed files with 10,500 additions and 123 deletions.
7 changes: 6 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [Unreleased]
- Multiple Window Management Framework
- Adding Bezier Curve Support for Interpolation (See original [PR](https://github.com/faiface/pixel/pull/266))

## [v0.12.0] 2023-10-02
- Add AnchorPos struct and functions #252
- Add Clipboard Support
- Fix SIGSEGV on text.NewAtlas if glyph absent
Expand Down Expand Up @@ -55,7 +59,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
Changelog for this and older versions can be found on the corresponding [GitHub
releases](https://github.com/faiface/pixel/releases).

[Unreleased]: https://github.com/faiface/pixel/compare/v0.10.0...HEAD
[Unreleased]: https://github.com/gopxl/pixel/compare/v0.12.0...HEAD
[v0.12.0]: https://github.com/gopxl/pixel/compare/v0.12.0...dev
[v0.10.0]: https://github.com/faiface/pixel/compare/v0.10.0-beta...v0.10.0
[v0.10.0-beta]: https://github.com/faiface/pixel/compare/v0.10.0-alpha...v0.10.0-beta
[v0.10.0-alpha]: https://github.com/faiface/pixel/compare/v0.9.0...v0.10.0-alpha
Expand Down
8 changes: 4 additions & 4 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
# Contributing to Pixel

:tada: Hi! I'm really glad you're considering contributing to Pixel! :tada:
:tada: Hi! I'm really glad you're considering contributing to Pixel2! :tada:

## Here are a few ways you can contribute

1. **Make a community example** and place it inside the `community` folder of the [examples repository][examples].
2. **Add tests**. There only few tests in Pixel at the moment. Take a look at them and make some similar.
3. **Add a small feature or an improvement**. Feel like some small feature is missing? Just make a PR. Be ready that I might reject it, though, if I don't find it particularly appealing.
3. **Add a small feature or an improvement**. Feel like some small feature is missing? Make a PR and let's discuss it!
4. **Join the big development** by joining the discussion on our [Discord Server](https://discord.gg/q2DK4MP), where we can discuss bigger changes and implement them after that.

## How to make a pull request

Go gives you a nice surprise when attempting to make a PR on Github. The thing is, that when user _xyz_ forks Pixel on Github, it ends up in _github.com/xyz/pixel_, which fucks up your import paths. Here's how you deal with that: https://www.reddit.com/r/golang/comments/2jdcw1/how_do_you_deal_with_github_forking/.
Go gives you a nice surprise when attempting to make a PR on Github. The thing is, that when user _xyz_ forks Pixel on Github, it ends up in _github.com/xyz/pixel_, which conflicts with your import paths. Here's how you deal with that: https://www.reddit.com/r/golang/comments/2jdcw1/how_do_you_deal_with_github_forking/.

[examples]: https://github.com/faiface/pixel-examples/tree/master/community
[examples]: https://github.com/gopxl/pixel/tree/master/examples/community
90 changes: 49 additions & 41 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
<p align="center"><img src="logo/LOGOTYPE-HORIZONTAL-BLUE2.png"></p>
# __**Important Notice **__
Revived fork of the original [Pixel](https://github.com/faiface/pixel) library by [faiface](https://github.com/faiface). This fork is intended to be a community-driven effort to continue the development of the library. We were unable to get a hold of the original author, to take ownership of the original repository to carry on the legacy of the wonderful work. If you are interested in contributing, please join us in the [Discord Chat!](https://discord.gg/n2Y8uVneK6)


# **Important Notice **
Revived fork of the original long-dead [Pixel](https://github.com/faiface/pixel) library by [faiface](https://github.com/faiface). This fork is intended to be a community-driven effort to continue the development of the library. We were unable to get a hold of the original author, to take ownership of the original repository to carry on the legacy of the wonderful work. If you are interested in contributing, please join us in the [Discord Chat!](https://discord.gg/D6mQ8Pnm)
<p align="center"><img src="logo/LOGOTYPE-HORIZONTAL-BLUE2.png"></p>


# Pixel 2 [![Build Status](https://travis-ci.org/faiface/pixel.svg?branch=master)](https://travis-ci.org/faiface/pixel) [![GoDoc](https://godoc.org/github.com/faiface/pixel?status.svg)](https://godoc.org/github.com/faiface/pixel) [![Go Report Card](https://goreportcard.com/badge/github.com/faiface/pixel)](https://goreportcard.com/report/github.com/faiface/pixel) [![Join the chat at https://gitter.im/pixellib/Lobby](https://badges.gitter.im/pixellib/Lobby.svg)](https://gitter.im/pixellib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Discord Chat](https://img.shields.io/discord/699679031603494954)](https://discord.gg/q2DK4MP)
# Pixel 2 [![Build Status](https://travis-ci.org/faiface/pixel.svg?branch=master)](https://travis-ci.org/faiface/pixel) [![GoDoc](https://godoc.org/github.com/gopxl/pixel?status.svg)](https://godoc.org/github.com/gopxl/pixel) [![Go Report Card](https://goreportcard.com/badge/github.com/gopxl/pixel)](https://goreportcard.com/report/github.com/gopxl/pixel) [![Join the chat at https://gitter.im/pixellib/Lobby](https://badges.gitter.im/pixellib/Lobby.svg)](https://gitter.im/pixellib/Lobby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Discord Chat](https://img.shields.io/discord/699679031603494954)](https://discord.gg/q2DK4MP)

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

```
go get github.com/faiface/pixel
go get github.com/gopxl/pixel
```

If you are using Modules (Go 1.11 or higher) and want a mutable copy of the source code:

```
git clone https://github.com/faiface/pixel # clone outside of $GOPATH
cd pixel
git clone https://github.com/gopxl/pixel # clone outside of $GOPATH
cd pixel2
go install ./...
```

See [requirements](#requirements) for the list of libraries necessary for compilation.

All significant changes are documented in [CHANGELOG.md](CHANGELOG.md).
Take a look at [CHANGELOG.md](CHANGELOG.md) for upcoming releases and history.

## Tutorial

The [Wiki of this repo](https://github.com/faiface/pixel/wiki) contains an extensive tutorial
The [Wiki of this repo](https://github.com/gopxl/pixel/wiki) contains an extensive tutorial
covering several topics of Pixel. Here's the content of the tutorial parts so far:

- [Creating a Window](https://github.com/faiface/pixel/wiki/Creating-a-Window)
- [Drawing a Sprite](https://github.com/faiface/pixel/wiki/Drawing-a-Sprite)
- [Moving, scaling and rotating with Matrix](https://github.com/faiface/pixel/wiki/Moving,-scaling-and-rotating-with-Matrix)
- [Pressing keys and clicking mouse](https://github.com/faiface/pixel/wiki/Pressing-keys-and-clicking-mouse)
- [Drawing efficiently with Batch](https://github.com/faiface/pixel/wiki/Drawing-efficiently-with-Batch)
- [Drawing shapes with IMDraw](https://github.com/faiface/pixel/wiki/Drawing-shapes-with-IMDraw)
- [Typing text on the screen](https://github.com/faiface/pixel/wiki/Typing-text-on-the-screen)
- [Using a custom fragment shader](https://github.com/faiface/pixel/wiki/Using-a-custom-fragment-shader)
- [Creating a Window](https://github.com/gopxl/pixel/wiki/Creating-a-Window)
- [Drawing a Sprite](https://github.com/gopxl/pixel/wiki/Drawing-a-Sprite)
- [Moving, scaling and rotating with Matrix](https://github.com/gopxl/pixel/wiki/Moving,-scaling-and-rotating-with-Matrix)
- [Pressing keys and clicking mouse](https://github.com/gopxl/pixel/wiki/Pressing-keys-and-clicking-mouse)
- [Drawing efficiently with Batch](https://github.com/gopxl/pixel/wiki/Drawing-efficiently-with-Batch)
- [Drawing shapes with IMDraw](https://github.com/gopxl/pixel/wiki/Drawing-shapes-with-IMDraw)
- [Typing text on the screen](https://github.com/gopxl/pixel/wiki/Typing-text-on-the-screen)
- [Using a custom fragment shader](https://github.com/gopxl/pixel/wiki/Using-a-custom-fragment-shader)

## [Examples](https://github.com/faiface/pixel-examples)

Expand Down Expand Up @@ -66,6 +66,9 @@ Here are some screenshots from the examples!
| --- | --- |
| ![Raycaster](https://github.com/faiface/pixel-examples/blob/master/community/raycaster/screenshot.png) | ![Gizmo](https://github.com/Lallassu/gizmo/blob/master/preview.png) |

## Release Schedule
We aim to release a new version the 1st of every month. Checkout [CHANGELOG.md](CHANGELOG.md) for upcoming features.

## Features

Here's the list of the main features in Pixel. Although Pixel is still under heavy development,
Expand All @@ -74,15 +77,15 @@ Here's the list of the main features in Pixel. Although Pixel is still under hea
- Fast 2D graphics
- Sprites
- Primitive shapes with immediate mode style
[IMDraw](https://github.com/faiface/pixel/wiki/Drawing-shapes-with-IMDraw) (circles, rectangles,
[IMDraw](https://github.com/gopxl/pixel/wiki/Drawing-shapes-with-IMDraw) (circles, rectangles,
lines, ...)
- Optimized drawing with [Batch](https://github.com/faiface/pixel/wiki/Drawing-efficiently-with-Batch)
- Text drawing with [text](https://godoc.org/github.com/faiface/pixel/text) package
- Optimized drawing with [Batch](https://github.com/gopxl/pixel/wiki/Drawing-efficiently-with-Batch)
- Text drawing with [text](https://godoc.org/github.com/gopxl/pixel/text) package
- Audio through a separate [Beep](https://github.com/faiface/beep) library.
- Simple and convenient API
- Drawing a sprite to a window is as simple as `sprite.Draw(window, matrix)`
- Wanna know where the center of a window is? `window.Bounds().Center()`
- [...](https://godoc.org/github.com/faiface/pixel)
- [...](https://godoc.org/github.com/gopxl/pixel)
- Full documentation and tutorial
- Works on Linux, macOS and Windows
- Window creation and manipulation (resizing, fullscreen, multiple windows, ...)
Expand All @@ -94,7 +97,7 @@ Here's the list of the main features in Pixel. Although Pixel is still under hea
multiplication and a few more features
- Pixel uses `float64` throughout the library, compatible with `"math"` package
- Geometry transformations with
[Matrix](https://github.com/faiface/pixel/wiki/Moving,-scaling-and-rotating-with-Matrix)
[Matrix](https://github.com/gopxl/pixel/wiki/Moving,-scaling-and-rotating-with-Matrix)
- Moving, scaling, rotating
- Easy camera implementation
- Off-screen drawing to Canvas or any other target (Batch, IMDraw, ...)
Expand All @@ -104,7 +107,7 @@ Here's the list of the main features in Pixel. Although Pixel is still under hea
- 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](https://godoc.org/github.com/faiface/pixel)
- Platform and backend independent [core](https://godoc.org/github.com/gopxl/pixel)
- 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](https://github.com/faiface/glhf)
Expand Down Expand Up @@ -138,10 +141,10 @@ possible!
## Requirements

If you're using Windows and having trouble building Pixel, please check [this
guide](https://github.com/faiface/pixel/wiki/Building-Pixel-on-Windows) on the
[wiki](https://github.com/faiface/pixel/wiki).
guide](https://github.com/gopxl/pixel/wiki/Building-Pixel-on-Windows) on the
[wiki](https://github.com/gopxl/pixel/wiki).

[PixelGL](https://godoc.org/github.com/faiface/pixel/pixelgl) backend uses OpenGL to render
[PixelGL](https://godoc.org/github.com/gopxl/pixel/pixelgl) backend uses OpenGL to render
graphics. Because of that, OpenGL development libraries are needed for compilation. The dependencies
are same as for [GLFW](https://github.com/go-gl/glfw).

Expand All @@ -155,30 +158,35 @@ The OpenGL version used is **OpenGL 3.3**.
- See [here](http://www.glfw.org/docs/latest/compile.html#compile_deps) for full details.

**The combination of Go 1.8, macOS and latest XCode seems to be problematic** as mentioned in issue
[#7](https://github.com/faiface/pixel/issues/7). This issue is probably not related to Pixel.
[#7](https://github.com/gopxl/pixel/issues/7). This issue is probably not related to Pixel.
**Upgrading to Go 1.8.1 fixes the issue.**

## Contributing

Join us in the [Discord Chat!](https://discord.gg/D6mQ8Pnm)
Join us in the [Discord Chat!](https://discord.gg/n2Y8uVneK6)

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**.
Pixel is currently in a developmental phase, with many of its key features already in place, while others are still in the works.
We genuinely appreciate and value contributions, as they can significantly expedite the development process. I invite everyone to
contribute in any way they can, even if it's just sharing an idea. We especially value the submission of 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.
That said, it's **important to remember that Pixel is being developed with a great deal of thought and attention to detail**. Each component
has gone through numerous design iterations to ensure quality. We place a high premium on code and API quality, with an emphasis on simplicity and expressiveness.
When contributing, please bear these goals in mind. This doesn't mean that only flawless pull requests will be accepted. Rather, it
means that there may be times when a proposal might not align with our vision, or when a pull request might require some revisions.
This is completely normal and should not discourage you. After all, our shared goal is to achieve the best end result possible.

Take a look at [CONTRIBUTING.md](CONTRIBUTING.md) for further information.

## License

[MIT](LICENSE)

## Special Contributions

- A significant shoutout to the original author [faiface](https://github.com/faiface) for starting and growing the Pixel community. We would not be here if not for him.
- The active/inactive maintainers of the original Pixel repo:
- [dusk125](https://github.com/dusk125)
- [cebarks](https://github.com/cebarks)
- [Benjyclay](https://github.com/Benjyclay)
- [delp](https://github.com/delp)
- [roipoussiere](https://github.com/roipoussiere)
2 changes: 1 addition & 1 deletion circle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"reflect"
"testing"

"github.com/duysqubix/pixel2"
"github.com/gopxl/pixel"
)

func TestC(t *testing.T) {
Expand Down
2 changes: 1 addition & 1 deletion color_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import (
"image/color"
"testing"

"github.com/duysqubix/pixel2"
"github.com/gopxl/pixel"
)

func BenchmarkColorToRGBA(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion data_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package pixel_test
import (
"testing"

"github.com/duysqubix/pixel2"
"github.com/gopxl/pixel"
)

func BenchmarkMakeTrianglesData(b *testing.B) {
Expand Down
2 changes: 1 addition & 1 deletion drawer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import (
"image"
"testing"

"github.com/duysqubix/pixel2"
"github.com/gopxl/pixel"
)

func BenchmarkSpriteDrawBatch(b *testing.B) {
Expand Down
21 changes: 21 additions & 0 deletions examples/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 Michal Štrba

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
24 changes: 24 additions & 0 deletions examples/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
## Pixel 2 Examples

This repository contains a few examples demonstrating [Pixel2](https://github.com/gopxl/pixel)'s functionality.

**To run an example**, navigate to its directory, then `go run` the `main.go` file. For example:

```
$ cd platformer
$ go run main.go
```

Here are some screenshots from the examples!

| [Lights](lights) | [Platformer](platformer) |
| --- | --- |
| ![Lights](lights/screenshot.png) | ![Platformer](platformer/screenshot.png) |

| [Smoke](smoke) | [Typewriter](typewriter) |
| --- | --- |
| ![Smoke](smoke/screenshot.png) | ![Typewriter](typewriter/screenshot.png) |

| [Raycaster](community/raycaster) | [Starfield](community/starfield) |
| --- | --- |
| ![Raycaster](community/raycaster/screenshot.png) | ![Starfield](community/starfield/screenshot.png) |
21 changes: 21 additions & 0 deletions examples/community/amidakuji/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
45 changes: 45 additions & 0 deletions examples/community/amidakuji/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
OUT := amidakuji
ASSET_TARGET := glossary/asset.go
ASSET_SOURCE_DIR := assets
VERSION := $(shell git describe --always --long)
PKG_LIST := $(shell go list ./... | grep -v /vendor/)
GO_FILES := $(shell find . -name '*.go' | grep -v /vendor/)

all: build build_windows

${ASSET_TARGET}:
go-bindata -o "${ASSET_TARGET}" -pkg "glossary" -prefix "${ASSET_SOURCE_DIR}" ${ASSET_SOURCE_DIR}/emoji ${ASSET_SOURCE_DIR}/karaoke ${ASSET_SOURCE_DIR}/NanumBarunGothic.ttf

build: ${ASSET_TARGET}
go build -i -v -o ${OUT} -ldflags "-w -s -X main.version=${VERSION}"

build_windows: ${ASSET_TARGET}
go build -i -v -o ${OUT}.exe -ldflags "-w -s -X main.version=${VERSION} -H windowsgui"

run: build
./${OUT}

test:
@go test -short ${PKG_LIST}

vet:
@go vet -copylocks=false ${PKG_LIST}

vet_annoying:
@go vet ${PKG_LIST}

lint:
@for file in ${GO_FILES} ; do \
golint $$file ; \
done

#static: vet lint
# go build -i -v -o ${OUT}-${VERSION} -ldflags "-extldflags \"-static\" -w -s -X main.version=${VERSION}"

#static_windows: vet lint
# go build -i -v -o ${OUT}-${VERSION}.exe -ldflags "-extldflags \"-static\" -w -s -X main.version=${VERSION} -H windowsgui"

clean:
-@rm ${ASSET_TARGET} ${OUT} ${OUT}.exe #${OUT}-*

.PHONY: build build_windows run vet vet_annoying lint clean
Loading

0 comments on commit 4e0794d

Please sign in to comment.