From 80f3a498ad28dd13167733a84e9dd20ae2e82650 Mon Sep 17 00:00:00 2001 From: dimkauzh Date: Mon, 22 Jul 2024 23:59:37 +0200 Subject: [PATCH] Git broke --- .github/workflows/format.yml | 36 ++++++++ internal/gl/legacy/legacy.go | 104 ++++++++++++++++++++++++ website/docs/developers/contribution.md | 27 ++++++ website/docs/developers/index.md | 5 ++ website/docs/latest/audio.md | 0 website/docs/latest/math.md | 0 website/docs/latest/renderer.md | 0 website/docs/latest/windowing.md | 0 8 files changed, 172 insertions(+) create mode 100644 .github/workflows/format.yml create mode 100644 internal/gl/legacy/legacy.go create mode 100644 website/docs/developers/contribution.md create mode 100644 website/docs/developers/index.md create mode 100644 website/docs/latest/audio.md create mode 100644 website/docs/latest/math.md create mode 100644 website/docs/latest/renderer.md create mode 100644 website/docs/latest/windowing.md diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml new file mode 100644 index 0000000..2d61f78 --- /dev/null +++ b/.github/workflows/format.yml @@ -0,0 +1,36 @@ +name: Go Format Check + +on: + push: + branches: + - latest + - stable + + pull_request: + branches: + - latest + - stable +jobs: + go-fmt-check: + runs-on: ubuntu-latest + + steps: + - name: Checkout code + uses: actions/checkout@v2 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: '1.22' + + - name: Check Go format + run: | + files=$(gofmt -l .) + if [ -n "$files" ]; then + echo "Following files arent formatted:" + echo "$files" + exit 1 + else + echo "Everything is formatted." + fi + diff --git a/internal/gl/legacy/legacy.go b/internal/gl/legacy/legacy.go new file mode 100644 index 0000000..631309e --- /dev/null +++ b/internal/gl/legacy/legacy.go @@ -0,0 +1,104 @@ +package gl + +/* +#cgo linux LDFLAGS: -lGL +#cgo darwin LDFLAGS: -framework OpenGL +#cgo windows LDFLAGS: -lopengl32 +#include "../opengl/gl.h" +*/ +import "C" +import "unsafe" + +const ( + TEXTURE_2D = uint32(C.GL_TEXTURE_2D) + TEXTURE_WRAP_S = uint32(C.GL_TEXTURE_WRAP_S) + TEXTURE_WRAP_T = uint32(C.GL_TEXTURE_WRAP_T) + TEXTURE_MIN_FILTER = uint32(C.GL_TEXTURE_MIN_FILTER) + TEXTURE_MAG_FILTER = uint32(C.GL_TEXTURE_MAG_FILTER) + CLAMP_TO_EDGE = uint32(C.GL_CLAMP_TO_EDGE) + LINEAR = uint32(C.GL_LINEAR) + + LINES = uint32(C.GL_LINES) + QUADS = uint32(C.GL_QUADS) + + RGBA = uint32(C.GL_RGBA) + UNSIGNED_BYTE = uint32(C.GL_UNSIGNED_BYTE) + + SRC_ALPHA = uint32(C.GL_SRC_ALPHA) + ONE_MINUS_SRC_ALPHA = uint32(C.GL_ONE_MINUS_SRC_ALPHA) + BLEND = uint32(C.GL_BLEND) + DEPTH_BUFFER_BIT = uint32(C.GL_DEPTH_BUFFER_BIT) + COLOR_BUFFER_BIT = uint32(C.GL_COLOR_BUFFER_BIT) +) + +func Begin(state uint32) { + C.glBegin(C.uint(state)) +} + +func End() { + C.glEnd() +} + +func Color3f(r, g, b float32) { + C.glColor3f(C.float(r), C.float(g), C.float(b)) +} + +func Color4f(r, g, b, a float32) { + C.glColor4f(C.float(r), C.float(g), C.float(b), C.float(a)) +} + +func Vertex2f(x, y float32) { + C.glVertex2f(C.float(x), C.float(y)) +} + +func ClearColor(r, g, b, a float32) { + C.glClearColor(C.float(r), C.float(g), C.float(b), C.float(a)) +} + +func GenTextures(n int32, textures *uint32) { + C.glGenTextures(C.int(n), (*C.uint)(unsafe.Pointer(textures))) +} + +func DeleteTextures(n int, textures *uint32) { + C.glDeleteTextures(C.int(n), (*C.uint)(unsafe.Pointer(textures))) +} + +func BindTexture(target, texture uint32) { + C.glBindTexture(C.uint(target), C.uint(texture)) +} + +func TexParameteri(target, pname, param uint32) { + C.glTexParameteri(C.uint(target), C.uint(pname), C.int(param)) +} + +func TexCoord2f(s, t float32) { + C.glTexCoord2f(C.float(s), C.float(t)) +} + +func TexImage2D(target, level, internalFormat uint32, width, height int, border, format, typ uint32, pixels []byte) { + C.glTexImage2D(C.uint(target), C.int(level), C.int(internalFormat), C.int(width), C.int(height), C.int(border), C.uint(format), C.uint(typ), C.CBytes(pixels)) +} + +func Clear(mask uint32) { + C.glClear(C.uint(mask)) +} + +func Enable(cap uint32) { + C.glEnable(C.uint(cap)) +} + +func BlendFunc(sfactor, dfactor uint32) { + C.glBlendFunc(C.uint(sfactor), C.uint(dfactor)) +} + +func Ortho(left, right, bottom, top, near, far float64) { + C.glOrtho(C.double(left), C.double(right), C.double(bottom), C.double(top), C.double(near), C.double(far)) +} + +func Viewport(x, y, width, height int) { + C.glViewport(C.int(x), C.int(y), C.int(width), C.int(height)) +} + +func LineWidth(width float32) { + C.glLineWidth(C.float(width)) +} diff --git a/website/docs/developers/contribution.md b/website/docs/developers/contribution.md new file mode 100644 index 0000000..f53cf6b --- /dev/null +++ b/website/docs/developers/contribution.md @@ -0,0 +1,27 @@ +# 📋 Contribution guidelines + +## 📜 Rules +We are happy and welcome if you want to contribute to Vuelto. But please consider a few details before continuing: +1. Fork: Please before working, make sure you forked the repo and are working inside the fork +2. Branch: Please before working in your own fork, make sure you are in the `latest` branch. +3. Explain: Please explain why this should be considered and merged. That can increase he chance for us to merge and will safe the maintainers time. +4. Test: Please test your code before even opening a new pull request. Make sure the CI doesnt fail. +5. Documentation: Please, if your adding something new, like a feature, please document everything. +6. Format: Please, run `make format` for formatting of the code. Without this we won't merge your code +7. CI: We cannot merge if the CI fails. Incase that it fails, please fix your code or fix the CI (only incase of breaking changes or improvements). + +## ⚠️ Not following these rules +If we see a pull request that doesn't follow these rules, we will tell you that, and close the pull request. +We allow you to re-open a new pull request, but we expect you to have your code fixed. +So make sure that you followed the rules from above. + +## 🔄 Pull Request +If you're ready with your changes, then you must follow a few steps before pull requesting. +First, run our make command to format your code: +```bash +make format +``` + +Then make sure your pull request code works without erroring and you followed the contribution rules from above. + +After all of this, you can create a pull request and one of the maintainers will take a look at it. Please have patience. diff --git a/website/docs/developers/index.md b/website/docs/developers/index.md new file mode 100644 index 0000000..738caf6 --- /dev/null +++ b/website/docs/developers/index.md @@ -0,0 +1,5 @@ +# 💻 Developers Guide +Hey and welcome to the developers part of the docs! This part is focused on people who want to contribute or develop Vuelto. Here you will find couple of things that guide you through how you can help vuelto, how you could setup your development enviorment and the Vuelto codebase structure. Also here you could go through couple of contributing guidelines that you should read before contributing. Not following these, a maintainer has the right to close/not-accept the pull request. Anyways, lets get to work, shall we? + +## 📑 Table of contents +- [Contributing guidelines](contribution.md) diff --git a/website/docs/latest/audio.md b/website/docs/latest/audio.md new file mode 100644 index 0000000..e69de29 diff --git a/website/docs/latest/math.md b/website/docs/latest/math.md new file mode 100644 index 0000000..e69de29 diff --git a/website/docs/latest/renderer.md b/website/docs/latest/renderer.md new file mode 100644 index 0000000..e69de29 diff --git a/website/docs/latest/windowing.md b/website/docs/latest/windowing.md new file mode 100644 index 0000000..e69de29