GithubHelp home page GithubHelp logo

Comments (11)

gen2brain avatar gen2brain commented on June 24, 2024 1

Some reproducible example would be nice, you mention Panel, and then you link to ScrollPanel. I am guessing based on the checks you sent that some function should pass nil if the string is empty but that is just a guess.

from raylib-go.

JupiterRider avatar JupiterRider commented on June 24, 2024 1

@gen2brain I don't know every place, where a NULL string affects the appearance, but C-raygui has NULL-checks, so we can safely pass them instead of an empty string.

from raylib-go.

gen2brain avatar gen2brain commented on June 24, 2024

Why do you think that the expected result is a panel with no status bar? Does that behavior differ from C behavior? The function just says bounds and text, with no mention of the status bar.

from raylib-go.

michaeldelgado1 avatar michaeldelgado1 commented on June 24, 2024

Yes it's in the C implementation.
https://github.com/raysan5/raygui/blob/12804826d01bfb636e36f816bda19eaa23b4ace7/src/raygui.h#L1793

I've used it pretty recently. I'm not familiar with cgo, but if you do a length check in the string, I assume you can pass null instead of a blank string.

from raylib-go.

michaeldelgado1 avatar michaeldelgado1 commented on June 24, 2024

Here's a better link:
https://github.com/raysan5/raygui/blob/12804826d01bfb636e36f816bda19eaa23b4ace7/src/raygui.h#L1891

from raylib-go.

michaeldelgado1 avatar michaeldelgado1 commented on June 24, 2024

The implementation is the same for both panel and scroll panel...
https://github.com/raysan5/raygui/blob/12804826d01bfb636e36f816bda19eaa23b4ace7/src/raygui.h#L1693

As far as an example goes, I don't have much time to provide one at the moment. Both your project and the original C implement have Scroll panel examples. It's possible to check those

from raylib-go.

JupiterRider avatar JupiterRider commented on June 24, 2024

Some reproducible example would be nice, you mention Panel, and then you link to ScrollPanel. I am guessing based on the checks you sent that some function should pass nil if the string is empty but that is just a guess.

@gen2brain I think you are right.

Here is the current state (I ran the example gui/scroll_panel/scroll_panel.go):
Screenshot_20240516_190912

And here with a nil passed (JupiterRider@c212c33):
Screenshot_20240516_190942

from raylib-go.

michaeldelgado1 avatar michaeldelgado1 commented on June 24, 2024

Nice implementation @JupiterRider my only gripe would be to do a nil check in the free so we don't attempt to free a nil pointer

from raylib-go.

JupiterRider avatar JupiterRider commented on June 24, 2024

@michaeldelgado1
The free is inside the if statement:

var ctext *C.char
if len(text) > 0 {
	ctext = C.CString(text)
	defer C.free(unsafe.Pointer(ctext))
}

from raylib-go.

michaeldelgado1 avatar michaeldelgado1 commented on June 24, 2024

I totally missed that. Thanks for pointing it out. I was reading on mobile 🤦

from raylib-go.

gen2brain avatar gen2brain commented on June 24, 2024

@JupiterRider Nice, can you send the PR? Is that the only function/place where it needs nil?

from raylib-go.

Related Issues (20)

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.