Skip to content

improve handling of 'out' parameters #60

Description

@electronstudio

Not sure if Raylib uses any of these, but RayGUI certainly does. Currently to use with pyray code looks like this:

import pyray as pr

char_array = pr.ffi.new("char[20]")
pointer = pr.ffi.addressof(char_array)

pr.init_window(800, 600, "raygui")
while not pr.window_should_close():
    pr.begin_drawing()
    pr.clear_background(pr.RAYWHITE)

    pr.gui_text_input_box(pr.Rectangle(0, 0, 800, 600), "title", "message", "buttons", pointer)
    string = pr.ffi.string(char_array).decode('utf-8')
    pr.draw_text(f"Text entered: {string}", 10, 40, 10, pr.DARKGRAY)

    pr.end_drawing()
pr.close_window()

I guess the cleanest solution might be to remove those parameters entirely and replace them with tuple return values, but not sure if that can be done in automated way and I hate to special-case anything.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions