Skip to content

Commit

Permalink
A bunch of minor markdown fixes
Browse files Browse the repository at this point in the history
ZakaHaceCosas committed Jan 26, 2025
1 parent 288cc36 commit 63be986
Showing 15 changed files with 180 additions and 157 deletions.
6 changes: 4 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
<!-- markdownlint-disable md024 -->
# Vuelto Changelog

## Vuelto 1.1.2 (25/01/2025)

### Fixes
- Fixed building on older gpu's
- Changed to compatability rather then core profile

- Fixed builds fon older GPUs
- Changed to OpenGL Compatibility profile (from OpenGL Core profile)

## Vuelto 1.1.1 (05/01/2025)

16 changes: 7 additions & 9 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
@@ -24,30 +24,28 @@ Some technologies we are using

If you want to contribute, you have to set up the work environment, so you can develop vuelto the right way.

1. Run `go mod tidy` to install all the packages
2. Fork [the repository](https://github.com/vuelto-org/vuelto).
3. Clone your forked github repository:
- Run `go mod tidy` to install all the packages.
- Fork [the repository](https://github.com/vuelto-org/vuelto).
- Clone your forked github repository:

```bash
git clone https://github.com/your_username/vuelto.git
```

4. Change the branch to the dev branch to follow rule \#1:
- Change the branch to the dev branch to follow rule \#1:

```bash
git checkout dev
```

## Pull Request

If you're ready with your changes, then you must follow a few steps before pull requesting.

1. Run `make` to format your code:
When you're ready with your changes, make sure you run `make` to format your code before pull requesting:

```bash
make format
```

Then make sure your pull request code works without erroring and you followed the [contribution rules](#contributing-rules)
Then make sure your code works without erroring and you're following the [contribution rules](#contributing-rules).

After all of this, you can create a pull request and one of our main organization members will look at it.
After all of this, you can create a pull request and one of our main members will look at it (and hopefully merge it!).
9 changes: 4 additions & 5 deletions LICENSE.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ This software is licensed under the terms of the [GNU General Public License ver

_The source code_” refers to any piece of source code, including but not limited to scripts, computer code, and compiled binaries, that is directly associated with The software.


"_The main repository_" refers to the repository where most of The software's development occurs, and/or where The source code of The software itself (or at least it’s primary / most important parts) is hosted, _not_ implying that other code repositories that are directly linked to the project are to be excluded by the terms of the Vuelto License.

## **1. Primary License**
@@ -24,6 +23,7 @@ The software is, by default, licensed under the terms of the main license unless
## **2. Condition for License Change**

The software shall be deemed "unmaintained" if any of the following conditions are met:

- The project repository has been archived or set to read-only.
- The project has been officially pronounced as "dead", "unmaintained", or something else with the same meaning by The maintainer(s).
- No substantial code contributions (beyond minor maintenance tasks or dependency updates) have been made to The main repository for a continuous period of 1.5 years (18 months).
@@ -60,13 +60,13 @@ The decision on whether The software is unmaintained will be made by the origina

## **5. Communication of License change**

If The software is declared unmaintained by The maintainer(s), the change shall be communicated by an update to The sroject's "_README_ file", website, or any other mean of communication that makes this change clear.
If The software is declared unmaintained by The maintainer(s), the change shall be communicated by an update to The project's "_README_ file", website, or any other mean of communication that makes this change clear.

## **6. Extensibility of the License**

It is possible for The maintainer(s) to extend the Vuelto License with additional terms. These must be made clear by The maintainer(s) by specifying them when using the License's identifier.

All possible extensions are shipped in the License's text, but they shall apply only if specified by The maintainer(s). Extensions are not part of the License's numerical order (Section 1, Section 2, and so); instead they are found at the end, preceeded by a heading with their specific identifier, and then using "A, B, C..." notation rather than "1, 2, 3..." notation for each section.
All possible extensions are shipped in the License's text, but they shall apply only if specified by The maintainer(s). Extensions are not part of the License's numerical order (Section 1, Section 2, and so); instead they are found at the end, preceded by a heading with their specific identifier, and then using "A, B, C..." notation rather than "1, 2, 3..." notation for each section.

### **6.1. License identification**

@@ -85,8 +85,7 @@ The following extensions, with their content available at the end of this Licens

Any artwork associated with The software, including but not limited to logos, icons, and other visual assets, is copyrighted and licensed under the terms of the Primary License (GNU GPLv3 or later). However, if The software license changes to the MIT License under the conditions outlined in **Section 3**, this copyright on artwork no longer applies, and the artwork is included under the MIT License.


### **B. Copyright on Code**

The source code is copyrighted and licensed under the terms of the Primary License (GNU GPLv3 or later). However, if The software license changes to the MIT License under the conditions outlined in **Section 3**, this copyright on The source code no longer applies, and The source code is included under the MIT License.
<!-- END VL-C 1.1 ONLY -->
<!-- END VL-C 1.1 ONLY -->
24 changes: 12 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
<p align="center">
<div align="center">
<img width="1400" alt="banner" src="https://github.com/vuelto-org/vuelto/raw/latest/logo/banner-dark.png#gh-dark-mode-only">
<img width="1400" alt="banner" src="https://github.com/vuelto-org/vuelto/raw/latest/logo/banner-light.png#gh-light-mode-only">
<a href="https://github.com/vuelto-org/vuelto"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://github.com/vuelto-org/license"><img alt="License" src="https://img.shields.io/badge/license-VL--Cv1.1-blue?style=for-the-badge"></a>
<a href="https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml">
<img alt="CI Check" src="https://img.shields.io/github/actions/workflow/status/vuelto-org/vuelto/ci_check.yml?style=for-the-badge">
</a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://goreportcard.com/report/github.com/vuelto-org/vuelto"><img alt="Report card" src="https://goreportcard.com/badge/github.com/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://www.opengl.org/Documentation/Specs.html"><img alt="Powered By" src="https://img.shields.io/badge/powered_by-GL_3.3-blue?style=for-the-badge"></a>
<a href="https://beua.today"><img alt="Powered By" src="https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7&style=for-the-badge"></a>
</p>

[![GitHub last commit](https://img.shields.io/github/last-commit/vuelto-org/vuelto?style=for-the-badge)](https://github.com/vuelto-org/vuelto)
[![License](https://img.shields.io/badge/license-VL--Cv1.1-blue?style=for-the-badge)](https://github.com/vuelto-org/license)
[![CI Check](https://img.shields.io/github/actions/workflow/status/vuelto-org/vuelto/ci_check.yml?style=for-the-badge)](https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml)
[![Lines of code](https://www.aschey.tech/tokei/github/vuelto-org/vuelto?style=for-the-badge)](https://github.com/vuelto-org/vuelto)
[![Report card](https://goreportcard.com/badge/github.com/vuelto-org/vuelto?style=for-the-badge)](https://goreportcard.com/report/github.com/vuelto-org/vuelto)
[![Powered By](https://img.shields.io/badge/powered_by-GL_3.3-blue?style=for-the-badge)](https://www.opengl.org/Documentation/Specs.html)
[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7&style=for-the-badge)](https://beua.today)

</div>

Vuelto is an open-source, fast, and lightweight game engine, based on Golang, CGo, and OpenGL. It's easy to use yet very powerful, and it's also cross platform, meaning it can be deployed on almost all major platforms.

@@ -131,7 +131,7 @@ A special thanks to:
- **Dimkauzh** for the initial idea and development.
- **ZakaHaceCosas** for the great improvements on top of vuelto.

Also a big shoutout to our homies and partners at [**Sokora**](https://sokora.org), [**Atom**](https://atomlabs.ie) and [**Epic-Bot**](https://bamb.cl/epic-bot/)
Also a big shout-out to our homies and partners at [**Sokora**](https://sokora.org), [**Atom**](https://atomlabs.ie) and [**Epic-Bot**](https://bamb.cl/epic-bot/)

Without the help of these people, Vuelto wouldn't be where it is today. Your support has helped make Vuelto even better! 🤝 🙌

25 changes: 8 additions & 17 deletions website/about/contributing.md
Original file line number Diff line number Diff line change
@@ -24,37 +24,28 @@ Some technologies we are using

If you want to contribute, you have to set up the work environment, so you can develop vuelto the right way.

1. Install the packages
- Run `go mod tidy` to install all the packages.
- Fork [the repository](https://github.com/vuelto-org/vuelto).
- Clone your forked github repository:

```bash
go mod tidy
git clone https://github.com/your_username/vuelto.git
```

2. Fork [the repository](https://vuelto.pp.ua/repo).

3. Clone your forked github repository:

```bash
git clone https://github.com/your_username_/vuelto.git
cd vuelto
```

4. Change the branch to the dev branch to follow rule \#1:
- Change the branch to the dev branch to follow rule \#1:

```bash
git checkout dev
```

## Pull Request

If you're ready with your changes, then you must follow a few steps before pull requesting.

1. Run `make` to format your code:
When you're ready with your changes, make sure you run `make` to format your code before pull requesting:

```bash
make format
```

Then make sure your pull request code works without erroring and you followed the [contribution rules](#contributing-rules)
Then make sure your code works without erroring and you're following the [contribution rules](#contributing-rules).

After all of this, you can create a pull request and one of our main organization members will look at it.
After all of this, you can create a pull request and one of our main members will look at it (and hopefully merge it!).
9 changes: 4 additions & 5 deletions website/about/license.md
Original file line number Diff line number Diff line change
@@ -14,7 +14,6 @@ This software is licensed under the terms of the [GNU General Public License ver

_The source code_” refers to any piece of source code, including but not limited to scripts, computer code, and compiled binaries, that is directly associated with The software.


"_The main repository_" refers to the repository where most of The software's development occurs, and/or where The source code of The software itself (or at least it’s primary / most important parts) is hosted, _not_ implying that other code repositories that are directly linked to the project are to be excluded by the terms of the Vuelto License.

## **1. Primary License**
@@ -24,6 +23,7 @@ The software is, by default, licensed under the terms of the main license unless
## **2. Condition for License Change**

The software shall be deemed "unmaintained" if any of the following conditions are met:

- The project repository has been archived or set to read-only.
- The project has been officially pronounced as "dead", "unmaintained", or something else with the same meaning by The maintainer(s).
- No substantial code contributions (beyond minor maintenance tasks or dependency updates) have been made to The main repository for a continuous period of 1.5 years (18 months).
@@ -60,13 +60,13 @@ The decision on whether The software is unmaintained will be made by the origina

## **5. Communication of License change**

If The software is declared unmaintained by The maintainer(s), the change shall be communicated by an update to The sroject's "_README_ file", website, or any other mean of communication that makes this change clear.
If The software is declared unmaintained by The maintainer(s), the change shall be communicated by an update to The project's "_README_ file", website, or any other mean of communication that makes this change clear.

## **6. Extensibility of the License**

It is possible for The maintainer(s) to extend the Vuelto License with additional terms. These must be made clear by The maintainer(s) by specifying them when using the License's identifier.

All possible extensions are shipped in the License's text, but they shall apply only if specified by The maintainer(s). Extensions are not part of the License's numerical order (Section 1, Section 2, and so); instead they are found at the end, preceeded by a heading with their specific identifier, and then using "A, B, C..." notation rather than "1, 2, 3..." notation for each section.
All possible extensions are shipped in the License's text, but they shall apply only if specified by The maintainer(s). Extensions are not part of the License's numerical order (Section 1, Section 2, and so); instead they are found at the end, preceded by a heading with their specific identifier, and then using "A, B, C..." notation rather than "1, 2, 3..." notation for each section.

### **6.1. License identification**

@@ -85,8 +85,7 @@ The following extensions, with their content available at the end of this Licens

Any artwork associated with The software, including but not limited to logos, icons, and other visual assets, is copyrighted and licensed under the terms of the Primary License (GNU GPLv3 or later). However, if The software license changes to the MIT License under the conditions outlined in **Section 3**, this copyright on artwork no longer applies, and the artwork is included under the MIT License.


### **B. Copyright on Code**

The source code is copyrighted and licensed under the terms of the Primary License (GNU GPLv3 or later). However, if The software license changes to the MIT License under the conditions outlined in **Section 3**, this copyright on The source code no longer applies, and The source code is included under the MIT License.
<!-- END VL-C 1.1 ONLY -->
<!-- END VL-C 1.1 ONLY -->
4 changes: 3 additions & 1 deletion website/demo/index.md
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
# 🔍 Demos

Hey and welcome to the demo section! Here you can find a list of demos that demonstrate how to use Vuelto in different scenarios. All of these work in the web!

!!! warning
These demo's might take a while to load, depending on the hardware. Please be patient.

!!! note
The demo's will be streched to fit the screen. This is done so mobile users can see the demos better. This behavior can be ofcourse changed by changing the last argument of `vuelto.NewWindow`.
The demo's will be stretched to fit the screen. This is done so mobile users can see the demos better. This behavior can be of course changed by changing the last argument of `vuelto.NewWindow`.

## 🧩 All examples

- [Shapes example](1/index.html)
- [Images example](2/index.html)
- [Rendering example](3/index.html)
1 change: 1 addition & 0 deletions website/docs/latest/events.md
Original file line number Diff line number Diff line change
@@ -11,6 +11,7 @@ type Vector2D struct {
Y float32
}
```

!!! note
Every event should be checked in the game loop, else it won't work.

5 changes: 3 additions & 2 deletions website/docs/latest/window-render.md
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@ This module allows you to manage the main window and rendering operations, essen
## 🏠 Window

To create a window, initialize a new instance and store it in a variable. Pass the following arguments:

- **Title**: The title of your window.
- **Width**: The width of the window in pixels.
- **Height**: The height of the window in pixels.
@@ -52,11 +53,11 @@ for !window.Close() {

```go
for !window.Close() {
image.Draw()
image.Draw()

// ...

window.Refresh()
window.Refresh()
}
```

20 changes: 10 additions & 10 deletions website/index.md
Original file line number Diff line number Diff line change
@@ -10,17 +10,17 @@ hide:
}
</style>

<p align="center">
<div align="center">
<img width="1400" alt="banner" src="https://github.com/vuelto-org/vuelto/raw/latest/logo/banner-nobg.png">
<a href="https://github.com/vuelto-org/vuelto"><img alt="GitHub last commit" src="https://img.shields.io/github/last-commit/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://github.com/vuelto-org/license"><img alt="License" src="https://img.shields.io/badge/license-VL--Cv1.1-blue?style=for-the-badge"></a>
<a href="https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml">
<img alt="CI Check" src="https://img.shields.io/github/actions/workflow/status/vuelto-org/vuelto/ci_check.yml?style=for-the-badge">
</a>
<a href="https://github.com/vuelto-org/vuelto"><img alt="Lines of code" src="https://www.aschey.tech/tokei/github/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://goreportcard.com/report/github.com/vuelto-org/vuelto"><img alt="Report card" src="https://goreportcard.com/badge/github.com/vuelto-org/vuelto?style=for-the-badge"></a>
<a href="https://www.opengl.org/Documentation/Specs.html"><img alt="Powered By" src="https://img.shields.io/badge/powered_by-GL_3.3-blue?style=for-the-badge"></a>
<a href="https://beua.today"><img alt="Powered By" src="https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7&style=for-the-badge"></a>

[![GitHub last commit](https://img.shields.io/github/last-commit/vuelto-org/vuelto?style=for-the-badge)](https://github.com/vuelto-org/vuelto)
[![License](https://img.shields.io/badge/license-VL--Cv1.1-blue?style=for-the-badge)](https://github.com/vuelto-org/license)
[![CI Check](https://img.shields.io/github/actions/workflow/status/vuelto-org/vuelto/ci_check.yml?style=for-the-badge)](https://github.com/vuelto-org/vuelto/actions/workflows/ci_check.yml)
[![Lines of code](https://www.aschey.tech/tokei/github/vuelto-org/vuelto?style=for-the-badge)](https://github.com/vuelto-org/vuelto)
[![Report card](https://goreportcard.com/badge/github.com/vuelto-org/vuelto?style=for-the-badge)](https://goreportcard.com/report/github.com/vuelto-org/vuelto)
[![Powered By](https://img.shields.io/badge/powered_by-GL_3.3-blue?style=for-the-badge)](https://www.opengl.org/Documentation/Specs.html)
[![Made in Ukraine](https://img.shields.io/badge/made_in-ukraine-ffd700.svg?labelColor=0057b7&style=for-the-badge)](https://beua.today)

</p>

Welcome to the Vuelto website! Here you will find things like documentation, blogs, tutorials and everything about Vuelto!
2 changes: 1 addition & 1 deletion website/install.md
Original file line number Diff line number Diff line change
@@ -12,7 +12,7 @@ go get vuelto.pp.ua@latest

You have to have X11-dev-packages and C compiler installed.

#### 🖥️ X11
### 🖥️ X11

On Debian and derivate distributions like Ubuntu and Linux Mint the xorg-dev meta-package pulls in the development packages for all of X11.

89 changes: 24 additions & 65 deletions website/roadmap/index.md
Original file line number Diff line number Diff line change
@@ -1,73 +1,32 @@
<!-- markdownlint-disable md007 -->
# 📅 Upcoming release
## V1.1

- [x] Framerates
- [x] Set framerate
- [x] Get framerate
- [x] Deltatime
## V1.2

- [x] Events
- [x] Keyboard
- [x] Mouse
- [ ] Renderer
- [ ] SetPixel
- [ ] LoadText and .Draw()

- [x] Renderer
- [x] Move the main API to the Rendering driver
- [x] Web
- [x] Web-windowing
- [x] Support for web using wasm
- [x] Web-rendering
- [x] Support for building graphics driver
- [x] WebGL
- [x] Desktop
- [x] Move to OpenGL v3.3
- [ ] Image
- [ ] Manipulate images

- [x] Windowing
- [x] Platforms
- [x] Windowing for web
- [x] Windowing for desktop
- [x] Framerates
- [x] Set framerate
- [x] Get framerate
- [x] Deltatime
- [ ] Spritesheets
- [ ] Using images
- [ ] returning images
- [ ] Usable with animations

- [x] Imaging
- [x] Load images
- [x] Process images (to string)
- [ ] Node system
- [ ] Movable nodes
- [ ] Custom physics option
- [ ] Static nodes
- [ ] Unmovable
- [ ] Just a basic image/shape

- [x] 2 Ring Rendering Driver
- [x] Ring 1
- [x] Wrapper around OpenGL C api
- [x] Wrapper around WebGL JS api
- [x] Ring 2
- [x] API around OpenGL and WebGL
- [ ] Animations
- [ ] Using images
- [ ] Using spritesheets

- [x] 2 Ring Window Driver
- [x] Ring 1
- [x] Wrapper around GLFW
- [x] Wrapper around JS runtime
- [x] Ring 2
- [x] API around GLFW and JS windowing

- [x] 2 Ring Input Driver
- [x] Ring 1 (No ring 1 needed)
- [x] Ring 2
- [x] API around GLFW and JS events

- [x] 2 Ring Image Driver
- [x] Ring 1 (No ring 1 needed)
- [x] Ring 2
- [x] API around Go image library

- [ ] Website
- [ ] Docs
- [ ] Vuelto Docs
- [ ] Vuelto API
- [ ] How to use vuelto
- [ ] Vuelto's functionality
- [x] Developer Docs
- [x] Vuelto's 3 ring structure
- [x] CONTRIBUTING.md
- [x] Code of Conduct
- [ ] Tutorials
- [ ] Examples
- [ ] Tutorials to build small games
- [ ] Custom color system
- [ ] Color struct
- [ ] NewColor function
- [ ] Predefined Color constants
97 changes: 69 additions & 28 deletions website/roadmap/v1.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- markdownlint-disable md007 -->
# 🛣️ Roadmap for V1

## V1
@@ -38,33 +39,73 @@

## V1.1

Moved to the upcoming releases page. See [here](https://vuelto.pp.ua/roadmap).
- [x] Framerates
- [x] Set framerate
- [x] Get framerate
- [x] Deltatime

- [x] Events
- [x] Keyboard
- [x] Mouse

- [x] Renderer
- [x] Move the main API to the Rendering driver
- [x] Web
- [x] Web-windowing
- [x] Support for web using wasm
- [x] Web-rendering
- [x] Support for building graphics driver
- [x] WebGL
- [x] Desktop
- [x] Move to OpenGL v3.3

- [x] Windowing
- [x] Platforms
- [x] Windowing for web
- [x] Windowing for desktop

- [x] Imaging
- [x] Load images
- [x] Process images (to string)

- [x] 2 Ring Rendering Driver
- [x] Ring 1
- [x] Wrapper around OpenGL C api
- [x] Wrapper around WebGL JS api
- [x] Ring 2
- [x] API around OpenGL and WebGL

- [x] 2 Ring Window Driver
- [x] Ring 1
- [x] Wrapper around GLFW
- [x] Wrapper around JS runtime
- [x] Ring 2
- [x] API around GLFW and JS windowing

- [x] 2 Ring Input Driver
- [x] Ring 1 (No ring 1 needed)
- [x] Ring 2
- [x] API around GLFW and JS events

- [x] 2 Ring Image Driver
- [x] Ring 1 (No ring 1 needed)
- [x] Ring 2
- [x] API around Go image library

- [x] Website
- [x] Docs
- [x] Vuelto Docs
- [x] Vuelto API
- [x] How to use vuelto
- [x] Vuelto's functionality
- [x] Developer Docs
- [x] Vuelto's 3 ring structure
- [x] CONTRIBUTING.md
- [x] Code of Conduct
- [x] Tutorials
- [x] Examples
- [x] Tutorials to build small games

## V1.2
- [ ] Renderer
- [ ] SetPixel
- [ ] LoadText and .Draw()

- [ ] Image
- [ ] Manipulate images

- [ ] Spritesheets
- [ ] Using images
- [ ] returning images
- [ ] Usable with animations

- [ ] Node system
- [ ] Movable nodes
- [ ] Custom physics option
- [ ] Static nodes
- [ ] Unmovable
- [ ] Just a basic image/shape

- [ ] Animations
- [ ] Using images
- [ ] Using spritesheets

- [ ] Custom color system
- [ ] Color struct
- [ ] NewColor function
- [ ] Predefined Color constants

Moved to the upcoming releases page. See [here](https://vuelto.pp.ua/roadmap).
1 change: 1 addition & 0 deletions website/roadmap/v2.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
<!-- markdownlint-disable md007 -->
# 🛣️ Roadmap for V2

## V2
29 changes: 29 additions & 0 deletions website/tutorials/beginner/rendering.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,23 @@
<!-- markdownlint-disable md010 -->
# 📂 Basic Rendering with vuelto

Hello and welcome to the second tutorial in the beginner series! In this tutorial, we will learn how to render a window with Vuelto. We expect you to at least have the basics from the [first tutorial](new-project.md) setup and ready to go. Let's get started!

!!! note
This tutorial is designed for the desktop platforms (Windows, macOS, and Linux). The changes for the web platform will be covered in the last paragrap of the tutorial.

## 🖌️ Settings up the renderer

So before the tutorial starts, we need to make sure we have a working renderer. The renderer is a struct that is responsible for rendering everything on the screen. We will use the `vuelto.NewRenderer` function to create a new renderer. Here is how you can do it:

```go
ren := w.NewRenderer2D()
```

And thats it for the renderer! Now we can move on to rendering different things!.

## 🚀 Rendering different shapes onto the window

So lets get started with some graphics. A colored background will be our start for now. So lets run the `ClearColor()` function from the `vuelto` package. This function takes in 4 arguments, the red, green, blue, and alpha values. The values follow RGBA color model, where each value is between 0 and 255. Here is an example of how to set the background color to a gray-ish color. Make sure to run this code inside of the game loop.

```go
@@ -24,19 +29,23 @@ for !w.Close() {
}
// ...
```

And now if you run the code, you should see a gray window. You can change the values to get different colors.

Next up, we can get some geometry on the screen. Lets start off with a basic line. For this we first will need to initialize a new line outside of the game loop (`vuelto.NewLine`), and after that draw it inside of the game loop (`line.Draw`). The line arguments work as follows:

- `x1` and `y1` are the starting point of the line.
- `x2` and `y2` are the ending point of the line.
- `color` is the color of the line, following the RGBA color model (just like in `ClearColor`).

```go
// ...
line := ren.NewLine(0.5, 0.5, -0.5, -0.5, [4]int{10, 145, 245, 255})
// ...
```

And now we can render the line inside of the game loop.

```go
// ...
for !w.Close() {
@@ -46,18 +55,23 @@ for !w.Close() {
}
// ...
```

And now you should see a line on the screen. You can change the values to get different lines!

Now that we got basic lines, lets move on to rectangles. It works really similar to lines. The rectangle arguments work as follows:

- `x` and `y` are the top left corner of the rectangle.
- `width` and `height` are the width and height of the rectangle.
- `color` is the color of the rectangle, following the RGBA color model.

First initialize a new rectangle outside of the game loop (`vuelto.NewRect`).

```go
rect := ren.NewRect(0, 0, 1, 1, [4]int{245, 145, 10, 255})
```

And now we can render the rectangle inside of the game loop.

```go
// ...
for !w.Close() {
@@ -67,18 +81,24 @@ for !w.Close() {
}
// ...
```

And now you should see a rectangle on the screen. You can change the values to get different rectangles!

## 🎨 Rendering images

Now that we got some basic shapes on the screen, lets move on to images. The will be a little more complex, but still pretty simple. First we will need to load an image. For this we will use the `ren.LoadImage` function. This function takes in the path to the image and returns a new image. Here is an example of how to load an image:

```go
img := ren.LoadImage("path/to/image.png", 0.5, 0.5, -0.5, 0.5)
```

The arguments work as follows:

- The first argument is the path to the image.
- The next 4 arguments are the x and y coordinates of the top left corner of the image, and the width and height of the image.

And now we can render the image inside of the game loop.

```go
// ...
for !w.Close() {
@@ -90,14 +110,18 @@ for !w.Close() {
```

## 🌐 Rendering for the web

If you want to render your game for the web, you will need to make a few changes.

- You will need to adapt your image paths to the web. This means that you will need to change the path to the image to an embedded image.
Thats it!

### 🔄 Adapting the image paths

To adapt the image paths to the web, you will need to embed the images into the binary. This can be done with the `go:embed` directive. Here is an example of how to embed an image:

First import the `embed` package.

```go
// ...
import (
@@ -107,7 +131,9 @@ import (
)
// ...
```

Then, create an embed filesystem with your image/images.

```go
// ...
//go:embed tree.png /path/to/image.png
@@ -116,6 +142,7 @@ var embeddedFiles embed.FS
```

And now create a new `ImageEmbed` object with the path to the image and the filesystem

```go
imageEmbed := vuelto.ImageEmbed{
Filesystem: embeddedFiles,
@@ -124,7 +151,9 @@ imageEmbed := vuelto.ImageEmbed{
```

And now you can use the `LoadImage` function with the `imageEmbed` object.

```go
image := ren.LoadImage(imageEmbed, 0.5, 0.5, -0.5, 0.5)
```

And now you should be able to render the image on the web!

0 comments on commit 63be986

Please sign in to comment.