Code Monkey home page Code Monkey logo

raylib-goplus's Introduction

Raylib Go Plus is an improved Go bindings for the video game library Raylib

This library is a work in progress and still new. We are always looking for improvements and help translating the bindings. Any cross-platform testing is most welcome too.

Big thanks to the original Go Bindings by Gen2Brain as they served as a basis for my bindings and helped me solve some tricky c problems :)

Additional thanks to the SolarLune discord and Raylib discord for helping me out and their invested interest.

Installation

GoDoc

Use the go get command to fetch the latest version: go get github.com/lachee/raylib-goplus/raylib

You are required to have all the dependencies for Raylib too. Specifically (if you are on windows), Mingw-w64.

Its that simple! Once you have fetch the resource, be sure to include it and get going!

package main
import r "github.com/lachee/raylib-goplus/raylib"
func main() {
	r.InitWindow(800, 450, "Raylib Go Plus")
	for !r.WindowShouldClose() {
		r.BeginDrawing()
		r.ClearBackground(r.RayWhite)
		r.DrawText("Woo! Raylib-Go-Plus! Now with ++", 20, 20, 20, r.GopherBlue)
		r.EndDrawing()
	}
	r.CloseWindow()
}

Building / Updating Raylib / Contribution

If you wish to build and update raylib, the project comes with a useful converter. To run the converter, you need the goimports tool. It can be installed by running the command go get golang.org/x/tools/cmd/goimports. Make sure you update the source files in raylib/ and update the raylib-convert/headings.txt headings (this tells the converter what to export). Once that is done, simply run ./build.sh.

You can run the converter on Windows by using Git Bash (included with Git for Windows).

I am happy for any contributions. This is a big project with over 477 functions! Its likely I have missed something or something doesn't work right for a particular platform (I only test on Windows).

NOTE: All contributions to code within _gen.go files will be rejected! Those additions must be made within a raylib-convert/manual/ go file, with the function name as the file name.

Unloadables

There is an experimental feature in this library called "Unloadables". When possible, Raylib Go Plus will have a record to every object that is loaded via LoadXXXX pattern, and will delete their record when Unload() is called on them. This is a useful safety feature to just make sure everything is unloaded.

Because they are tracked, you can call r.UnloadAll() at the end of your application to free up all recorded Unloadables from the C memory, preventing memory leaks.

Please note that this is an experimental feature, and not all Loadables maybe added to the tracker, nor may they all be added for every Load functions (ie: some GetXXXX may require unloading too). It is recommended to always free up the object yourself using Unload()

Anything that is loaded using a LoadXXXX should be in OOP mode of the converter. The converter will add Unload methods. In cases where they are named Close instead (ie AudioStream), please make the OOP method Unload, and the functional method the original Close.

RayGUI & RayMath

Both raygui and raymath are implemented by default in the raylib package. The reasoning behind not seperating raygui was because of a technical limitation with cgo (the interface used to link the c files into go) not being able to support links outside the package directory (I would have to include the entire raylib.h again into a raygui package).

License

This project is still a work in progress, but the license will be zlib/libpng to keep it inline with Raylib license.

raylib-goplus's People

Contributors

chilicat avatar harryisgamer avatar lachee avatar rightbrace avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

raylib-goplus's Issues

LoadMusicStream Hard Crash

Issue
LoadMusicStream will hard crash if the InitAudioDevice has not yet been called.

Expected Result
LoadMusicStream should throw an error

Proposal
LoadMusicStream should return Music and Error to follow Go Paradigms, throwing if audio is not yet initialized.

How do I load the default internal shader from LoadShaderCode?

When using LoadShader, if you put a blank string in the filename, it loads the default vertex shader. But in LoadShaderCode, putting a blank string as input causes the error

INFO: ERROR: Compiled vertex shader was corrupt.

How do I load the default vertex shader using LoadShaderCode?

[BUG] Program failing to load due to Shader

Describe the bug
My game in raylib-goplus will compile successfully, the window will pop up, then immediately close. I've entered the debugger to follow the stack trace down, since all that is returned is an error code.

Process finished with exit code -1073741819 (0xC0000005)

I've been able to isolate this down to the drawing of a cube with a Shader attached. It's not a complex shader by any means, and it can be noted that it does compile just fine as per the raylib trace logs.

Upon further inspection, it's possibly related to the way in which goplus has it's Model structured. *[]Meshes Is a field that may cause runtime panics as the reference could be nil. Possible solution to this, would be to follow the style gen2brains uses by using a standard []Meshes slice. Even with a simple generated cube from raylib's own r.GenMeshCube(1.0,1.0,1.0) shows the *[]Meshes slice to have a length and capacity of:

To Reproduce
Steps to reproduce the behavior:
Example Shader VS
Example Shader FS

Generate a cube mesh, load a model from that, add these shaders. An example in C can be found here

Expected behavior
Upon opening the program, it shouldn't fail, and the skybox shader should be rendered on screen. (Sorry not sure what else to put here ^^)

Screenshots
The ever expanding mesh slice example

go env Response

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Gamerfiend\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Gamerfiend\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Gamerfiend\AppData\Local\Temp\go-build346618970=/tmp/go-build -gno-record-gcc-switches

Additional context
Add any other context about the problem here.

[BUG] build.sh script doesn't work under windows (using git bash)

Describe the bug
Running the build.sh script on windows (using git bash) causes errors.

To Reproduce

  1. Git clone the repository (on windows)
  2. Run the build.sh file (using git bash)
  3. Get errors.

Expected behavior
The build.sh script should successfully generate bindings.

Screenshots
N/A

go env Response

set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Harry\AppData\Local\go-build
set GOENV=C:\Users\Harry\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\Harry\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\Harry\AppData\Local\Temp\go-build395543846=/tmp/go-build -gno-record-gcc-switches

Additional context
The log output of running build.sh:

======= Converting Header Files
Processing Command
Failed:  RLAPI void TraceLog(int logType, const char *text, ...);          // Show trace log messages (LOG_DEBUG, LOG_INFO, LOG_WARNING, LOG_ERROR)
Processing Command
Processing Command
Processing Command
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Processing Command
Processing Command
Processing Command
Processing Command
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
OOP:  UpdateCamera
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Processing Command
Processing Command
OOP:  ExportImage
OOP:  ExportImageAsCode
OOP:  UnloadImage
OOP:  UnloadTexture
OOP:  UnloadRenderTexture
OOP:  GetImageAlphaBorder
OOP:  GetTextureData
OOP:  ImageCopy
OOP:  ImageToPOT
OOP:  ImageAlphaMask
OOP:  ImageAlphaClear
OOP:  ImageAlphaCrop
OOP:  ImageAlphaPremultiply
OOP:  ImageCrop
OOP:  ImageResize
OOP:  ImageResizeNN
OOP:  ImageResizeCanvas
OOP:  ImageDither
Processing Command
Processing Command
OOP:  ImageDraw
OOP:  ImageDrawRectangle
OOP:  ImageDrawRectangleLines
OOP:  ImageDrawText
OOP:  ImageDrawTextEx
OOP:  ImageFlipVertical
OOP:  ImageFlipHorizontal
OOP:  ImageRotateCW
OOP:  ImageRotateCCW
OOP:  ImageColorTint
OOP:  ImageColorInvert
OOP:  ImageColorGrayscale
OOP:  ImageColorContrast
OOP:  ImageColorBrightness
OOP:  ImageColorReplace
OOP:  GenTextureMipmaps
OOP:  SetTextureFilter
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
OOP:  GenImageFontAtlas
Failed:  RLAPI Image GenImageFontAtlas(const CharInfo *chars, Rectangle **recs, int charsCount, int fontSize, int padding, int packMethod);  // Generate image font atlas using chars info
OOP:  UnloadFont
Processing Command
Processing Command
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Processing Command
OOP:  UnloadModel
Failed:  RLAPI Mesh *LoadMeshes(const char *fileName, int *meshCount);                                           // Load meshes from model file
OOP:  ExportMesh
OOP:  UnloadMesh
Failed:  RLAPI Material *LoadMaterials(const char *fileName, int *materialCount);                                // Load materials from model file
OOP:  UnloadMaterial
OOP:  SetModelMeshMaterial
OOP:  UpdateModelAnimation
OOP:  UnloadModelAnimation
OOP:  IsModelAnimationValid
OOP:  GenMeshHeightmap
OOP:  GenMeshCubicmap
OOP:  MeshBoundingBox
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Processing Command
Processing Command
OOP:  UnloadShader
OOP:  GetShaderLocation
OOP:  SetShaderValueMatrix
OOP:  SetShaderValueTexture
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
OOP:  UpdateSound
OOP:  UnloadWave
OOP:  UnloadSound
OOP:  ExportWave
OOP:  ExportWaveAsCode
OOP:  PlaySound
OOP:  StopSound
OOP:  PauseSound
OOP:  ResumeSound
OOP:  PlaySoundMulti
OOP:  IsSoundPlaying
OOP:  SetSoundVolume
OOP:  SetSoundPitch
OOP:  WaveFormat
OOP:  WaveCopy
OOP:  WaveCrop
OOP:  PlayMusicStream
OOP:  UpdateMusicStream
OOP:  StopMusicStream
OOP:  PauseMusicStream
OOP:  ResumeMusicStream
OOP:  IsMusicPlaying
OOP:  SetMusicVolume
OOP:  SetMusicPitch
OOP:  SetMusicLoopCount
OOP:  GetMusicTimeLength
OOP:  GetMusicTimePlayed
OOP:  IsAudioStreamProcessed
OOP:  PlayAudioStream
OOP:  PauseAudioStream
OOP:  ResumeAudioStream
OOP:  IsAudioStreamPlaying
OOP:  StopAudioStream
OOP:  SetAudioStreamVolume
OOP:  SetAudioStreamPitch
Processing Command
Processing Command
Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Processing Command
Header: //Generated 2020-01-19T09:25:05-08:00
#include "raylib.h"
#include <stdlib.h>
#include "go.h"
#define RAYGUI_IMPLEMENTATION

Processing Command
Header: //Generated 2020-01-19T09:25:05-08:00
#include "raylib.h"
#include <stdlib.h>
#include "go.h"
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_TEXTBOX_EXTENDED

Processing Command
Header: //Generated 2020-01-19T09:25:05-08:00
#include "raylib.h"
#include <stdlib.h>
#include "go.h"
#define RAYGUI_IMPLEMENTATION
#define RAYGUI_TEXTBOX_EXTENDED
#include "raygui.h"

Formatting...
Failed to format! exec: "goimports": executable file not found in %PATH%
Completed  433  /  436  functions ( 99.31192660550458 % Yield)
======= Copying Generated Files
Audio
cp: cannot stat 'out/audio_gen.go': No such file or directory
Camera
cp: cannot stat 'out/camera_gen.go': No such file or directory
Drawing
cp: cannot stat 'out/drawing_gen.go': No such file or directory
Gestures
cp: cannot stat 'out/gestures_gen.go': No such file or directory
Input
cp: cannot stat 'out/input_gen.go': No such file or directory
Main
cp: cannot stat 'out/main_gen.go': No such file or directory
Models
cp: cannot stat 'out/models_gen.go': No such file or directory
GUI
cp: cannot stat 'out/raygui_gen.go': No such file or directory
Shader
cp: cannot stat 'out/shader_gen.go': No such file or directory
Shapes
cp: cannot stat 'out/shapes_gen.go': No such file or directory
Text
cp: cannot stat 'out/text_gen.go': No such file or directory
Texture
cp: cannot stat 'out/texture_gen.go': No such file or directory
VR
cp: cannot stat 'out/vr_gen.go': No such file or directory
======= Building Library
 ( this might take a while, please wait )
======= Reporting Lint Issues
======= Finished Succesfully

It says it "Finished Successfully", but it didn't really.

[QoL] Loading a Shader returns a pointer

The Current Issue
When loading a new shader, it returns a pointer to the Shader rather than the Shader struct itself. While this isn't a huge inconvenience, it does require immediate de referencing.

tile.Materials[0].Shader = *r.LoadShader("resources/shaders/simpleLight.vs", "resources/shaders/simpleLight.fs")

This functionality could be changed into two possible ways.. One, we could have it return the struct instead of a pointer.. Secondly it could return both an err and the shader.

The Paradigm to Match

myShader, err := r.LoadShader("...", "...")
if err != nil {
//do stuff
}

tile.Materials[0].Shader = *myShader

OR

tile.Materials[0].Shader = r.LoadShader("resources/shaders/simpleLight.vs", "resources/shaders/simpleLight.fs")

The Proposal
The first option would follow a more go style of coding, with the error handling being checked right after loading. The second would have the error handling follow more the C style, and just keep trucking along.

[QoL] LoadXXX should return errors

The Current Issue
LoadSound will just silently fail and won't work silently when trying to use it.

The Paradigm to Match
When loading sounds, an error should be returned to validate that it loaded correctly.

The Proposal
Error response will have to be a case-by-case improvement. LoadSound will have a different way to check nil than LoadFont for example.

//LoadSound : Load sound from file
func LoadSound(fileName string) (*Sound, error) {
	cfileName := C.CString(fileName)
	defer C.free(unsafe.Pointer(cfileName))
	res := C.LoadSound(cfileName)
	if res.stream.buffer == nil {
		return nil, errors.New("Failed to load sound file")
	} 

	retval := newSoundFromPointer(unsafe.Pointer(&res))
	addUnloadable(retval)
	return retval, nil
}

Keyboard (azerty, qwerty)

Hi!

I would like to point out that the Keyboard only takes into account the qwerty, on my azerty keyboard the Z key is not recognized as Z but as W

SetValueTexture not working

Describe the bug
The GLSL shader is only receiving a 1x1 black texture, instead of the proper texture. I have tried saving this texture to a PNG, rendering this texture to the screen, and it all worked. Yet, in the shader, it is only receiving a 1x1 black texture.

This texture is being used in a shader I got by doing r.LoadShaderCode. Here is a code snippet of how it is set up:

shader = r.LoadShaderCode(defaultVs, blurFs)
shader.SetValueTexture(shader.GetLocation("colMap"), colorMap)

Inside of the shader I have:

uniform sampler2D colMap;

and in the code I have:

finalColor = texture(colMap, vec2(0, 0));

I have also tried using glsl's textureSize:
Dividing the texture size by 1 gives white. (code below)

finalColor = vec4(vec3(textureSize(colMap, 0).x)/1, 1);

Dividing the texture size by 2 gives a gray-ish color (code below)

finalColor = vec4(vec3(textureSize(colMap, 0).x)/2, 1);

The dimensions of this texture are 3x1 and the dimensions of texure0 are 800x450. Can this cause a problem?

Edit:
I tried resizing the image to be the size of texture0, still didn't work.

[BUG] LoadFontEx doesn't take pointer to ints

Hello!

Describe the bug
LoadFontEx() should be able to take a pointer to an array of ints for the fontChars argument; instead it just accepts a single integer. This prevents you from specifying a range of characters to load when loading the font, I believe. See the cheatsheet.

[QoL] text functions should support Sprint

The Current Issue
DrawText currently takes a string and draws a text to the screen

The Paradigm to Match
The text argument is flat and must require a manual call to Sprint for formatting. A better solution would to incorporate this.

The Proposal
The proposal is for all text functions to have a second version created that accepts an ...interface{} like Sprint. In the provided example, DrawText will now get a sibling: DrawFormattedText.

The prefix is a WIP. Here are some suggestions:
DrawFormattedText
DrawStext
DrawTextf
DrawTextFormatted
DrawSprint
SDrawText

Feedback is welcomed

[QoL] Material level access to texture function

The Current Issue
When wanting to set a filter for a texture inside of a material, the current process looks like:

tile.Materials[0].Maps[r.MapAlbedo].Texture.SetTextureFilter(r.FilterAnisotropic16x)

The Proposal
It would be nice to have the ability to access this function (and perhaps those like it) by simply calling on the Material as you would SetTexture

tile.Materials[0].SetTextureFilter(r.MapAlbedo, r.FilterAnisotropic16x)

[BUG] Trace Logs end prematurely

Describe the bug
The output trace logs end prematurely, with information no longer being displayed.

INFO: [resources/textures/inventorybg.png] Image loaded successfully (1920x1080)
INFO: [TEX ID 9] Texture created successfully (1920x1080 - 1 mipmaps)
INFO: [TEX ID 2] Unloaded texture data from VRAM (GPU)
INFO: [TEX ID 1] Unloaded textur
Process finished with exit code -1073740940 (0xC0000374)

Before ending the program, the output log had just stopped mid line and didn't continue on. (Should display the rest of the loading? And then also display the teardown/unloadables)

When the program is exited the error above can be seen

Process finished with exit code -1073740940 (0xC0000374)

To Reproduce
Load a few textures, models, and watch the log stop logging.

Expected behavior
The log should behavior as it would in C, by continuing to log each piece of trace log.

go env Response

set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\Snowminx\AppData\Local\go-build
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOOS=windows
set GOPATH=C:\Users\Snowminx\go
set GOPROXY=
set GORACE=
set GOROOT=C:\Go
set GOTMPDIR=
set GOTOOLDIR=C:\Go\pkg\tool\windows_amd64
set GCCGO=gccgo
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\SNOW~1\AppData\Local\Temp\go-build744808242=/tmp/go-build -gno-record-gcc-switches

Not Really a BUG but missing some features [BUG]

Just to say I use your port of Raylib for Go just about everyday and it is great. Basically however some features seem to be missing which would be good to be able to use. The 3 below are ones that I am missing though I am sure there are more. I do understand you might be busy and it might be difficult to add though if you can put on a TO DO list you may have it would be great to have implemented in future. (these are from https://www.raylib.com/cheatsheet/cheatsheet.html)

DrawTexturePoly(Texture2D texture, Vector2 center, Vector2 *points, Vector2 *texcoords, int pointsCount, Color tint); // Draw a textured polygon

DrawPolyLines(Vector2 center, int sides, float radius, float rotation, Color color); // Draw a polygon outline of n sides

GetCharPressed(void); // Get char pressed (unicode), call it multiple times for chars queued

To Reproduce
Try and use the functions DrawTexturePoly or DrawPolyLines or GetCharPressed

Expected behavior
Something however nothing is possible without the functions :(

go env Response

set GO111MODULE=auto
set GOARCH=amd64
set GOBIN=      
set GOCACHE=C:\Users\nicholasimon\AppData\Local\go-build
set GOENV=C:\Users\nicholasimon\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=C:\Users\nicholasimon\go\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\nicholasimon\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=C:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=C:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.16.3
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fmessage-length=0 -fdebug-prefix-map=C:\Users\NICHOL~1\AppData\Local\Temp\go-build2748051292=/tmp/go-build -gno-record-gcc-switches

Additional context
Add any other context about the problem here.

[BUG] GetImageData Panics

Describe the bug
When calling GetImageData or GetPixels, go will have a fatal panic with memory access violation.

To Reproduce
Steps to reproduce the behavior:

  1. Modify the Hello World to load an image
  2. Get the pixels of the image using image.GetPixels
  3. Notice crash

Expected behavior
GetPixels should return array of colors. This array ideally should be within the go managed enviroment and not link to C memory.

Desktop (please complete the following information):

  • OS: Windows 10

Issue Getting Custom Colors to Work

Not sure if this is a bug or I am not doing it correctly however apart from the predefined colors raylib also seems to offer the ability to define your own colors using RGBA values.

I am however really struggling to get this to work. If you take a look at the images or text below.

I create the color using the code

// colors green2 = rl.Color{77, 255, 77, 1}

which seems to work fine however Visual Studio Code gives me a WARNING (not error)

github.com/lachee/raylib-goplus/raylib.Color composite literal uses unkeyed fields

However it allows me to compile the code the problem is that though the program runs the color is blank and does not display, what is supposed to be green is just blank with no color at all.

If you have any help/advice as to how to create/use custom colors it would be really appreciated.

Nicholas

Annotation 2020-08-18 081729
2

[QoL] Define a .mod file for raylib-goplus

The Current Issue
Hello!

Thanks for your work on raylib-goplus; it's definitely a huge step in the right direction to automatically generate new bindings for raylib for Go.

When it comes to actually using raylib-goplus, I believe it would be more idiomatic to use Go Modules to allow projects that use this library to download and import it without having to manually run go get, and to make the status of projects that use it reproducible (because it refers to a specific version of a library that is known to work with the project).

The Paradigm to Match
Instead of running go get on a library (raylib-goplus, in this case), just importing it should have Go automatically download and include it in the project's go.mod file, due to the library having the go.mod file included.

The Proposal
To fix this, simply initialize a new module with the project's name / URL using go mod init and commit it to the root of the module. This will allow recent Go versions to automatically retrieve it from the URL specified, download it, and import it without issue.

[QoL] GetLocation should return an int32

The Current Issue
GetLocation when called on a Shader returns an int. However the Shader location array accepts only int32.

tile.Materials[0].Shader.Locs[r.LocMatrixModel] = int32(tile.Materials[0].Shader.GetLocation("matModel"))

The Proposal

tile.Materials[0].Shader.Locs[r.LocMatrixModel] = tile.Materials[0].Shader.GetLocation("matModel")

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.