Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to raylib 4.6-dev #8

Closed
wants to merge 1 commit into from
Closed

Update to raylib 4.6-dev #8

wants to merge 1 commit into from

Conversation

RobLoach
Copy link
Owner

@RobLoach RobLoach commented Jul 3, 2023

@konsumer Does this do it?

Fixes #6

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

It's a bit hard to test, but I used the JSON in 4.6 branch here, instead of downlaoding/merging with API.

I did this:

let aliases = []
let enums = []
let callbacks = []
let functions = []
for (const a of [
  'raygui',
  'raymath',
  'reasings',
  'rlgl',
  'rmem',
  'rres',
  'raylib',
]) {
  const api = JSON.parse(await readFile(`tools/api/${a}.json`))
  defines = [...defines, ...api.defines]
  structs = [...structs, ...api.structs]
  aliases = [...structs, ...api.structs]
  enums = [...enums, ...api.enums]
  callbacks = [...callbacks, ...api.callbacks]
  functions = [...functions, ...api.functions]
}

and I still end up with missing struct fields. It might be related to like how a few of these libs have a "don't use with raylib" adapter layer where it will define the same structs, if you define something. I think I still need to maybe merge them in a more clever way (get the order right and check for dupes.)

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

This seems to work a bit better:

const data = {
  defines: [],
  structs: [],
  aliases: [],
  enums: [],
  callbacks: [],
  functions: []
}

for (const a of [
  'raylib',
  'raygui',
  'raymath',
  'reasings',
  'rlgl',
  'rmem',
  'rres'
]) {
  const api = JSON.parse(await readFile(`tools/api/${a}.json`))
  for (const field of Object.keys(data)) {
    for (const d of api[field]) {
      if (!data[field].find(o => o.name === d.name)) {
        data[field].push(d)
      }
    }
  }
}

let { defines, structs, aliases, enums, callbacks, functions } = data

I am going to try to do the full wasm-build of everything with this, and see if it improves.

@RobLoach
Copy link
Owner Author

RobLoach commented Jul 3, 2023

Sounds like conflicts across different versions of the APIs. I know there were some changes between raygui that targeted 4.5 vs 4.6

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

Sounds like conflicts across different versions of the APIs. I know there were some changes between raygui that targeted 4.5 vs 4.6

Yeh, trying to use current raylib master with this JSON, I get other things missing, like the first one I hit:

emcc: error: undefined exported symbol: "_SetTextLineSpacing" [-Wundefined] [-Werror]

which is in:

tools/api/raylib.json:      "name": "SetTextLineSpacing",

Not totally sure of a good way to merge all these.

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

maybe I should stick to a known combo of tags? like lock-in specific versions of all that are known to work together:

raylib 4.5
rlgl 4.5 (from raylib)
raymath 4.5 (from raylib)
reasings 4.5 (from raylib)
raygui 3.6

rmem ?
rres ?

Since I need the C APIs to match, maybe I could just do what you do here in Makefile, and use that instead? Also, It seems reasonable to lock this lib into "released versions" and I can just make sure to check out those tags on each repo for C building. It does seem a bit crazy of me to build off master. :) I ended up building the wasm for these myself, because the released prebuilt wasm (on raylib github) doesn't have JPEG support.

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

If I lock in raylib@4.50 and raygui@3.6 for C build, and use the current @raylib/api in npm, I still get a few undefined like GuiTextBoxMulti. I will play around with the version-combos a bit.

@konsumer
Copy link
Collaborator

konsumer commented Jul 3, 2023

Looking around the raygui repo, I see that 3.5 removed GuiTextBoxMulti, so I tried 3.2 (last existing tag before 3.5) and it's missing GuiDisableTooltip, I think I might just generate the JSON like you do in Makefile, just to make sure it all matches.

@konsumer
Copy link
Collaborator

we should drop this pr in favor of #9

@konsumer konsumer closed this Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Definitions Mismatch
2 participants