EventList and Spline do not seem to be defined (api)
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 3/5
- Geschätzter Aufwand
- 1-2 Tage
- Anfängerfreundlichkeit
- 45/100
- Issue-Typ
- Bug
- Klarheit
- Größtenteils klar
- Aktivitätsstatus
- Veraltet
- Tech-Stack
- c, javascript
- Bereich
- api, build-system
Rechercherichtung
Beginne mit tools/gen_api.js und den Blocklist-Einträgen für EventList und Spline. Untersuche anschließend build/_deps/raylib-src/parser/output/raylib_api.json und die generierte tools/api.json. Vergleiche die generierten Deklarationen mit der von der DLL FFI wrapper verwendeten raylib-Version. Die Aufgabe ist erledigt, wenn die betroffenen API-Einträge mit den verfügbaren raylib-Symbolen übereinstimmen und keine Fehler wegen undefinierter Funktionen mehr erzeugen.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Essentially, all the functions with EventList or Spline are not defined (but are output by raylib api-gen) and throw an error if DLL is ffi-wrapped.
I think this is related to versioning mismatch with raylib (which may be a sign I need to adjust build to use raylib better.)
https://github.com/konsumer/raylib-pointers/blob/f365325/tools/gen_api.js#L27
// this will generate API info about all the new wrapped stuff & utils
// it's basically the same as the stuff parser generates in raylib
// but I add my wrappers and and struct-utils
import { writeFile, readFile } from 'fs/promises'
// check if the function will be wrapped
const isWrapped = (f) => {
const returnPointer = /^[A-Z]/.test(f.returnType)
// do any params need to be converted to pointers?
let paramPointer = false
for (const p of f.params || []) {
if (/[A-Z]/.test(p.type)) {
paramPointer = true
break
}
}
return returnPointer || paramPointer
}
export const blocklist = [
// this is blocked because I add wrapped_WindowShouldClose manually
'WindowShouldClose',
// TODO: I think these are not available in the current version, but for some reason are referenced
'LoadAutomationEventList',
'UnloadAutomationEventList',
'ExportAutomationEventList',
'SetAutomationEventList',
'PlayAutomationEventList',
'PlayAutomationEvent',
'DrawLineBezier',
'DrawCircleLinesV',
'DrawSplineLinear',
'DrawSplineBasis',
'DrawSplineCatmullRom',
'DrawSplineBezierQuadratic',
'DrawSplineBezierCubic',
'DrawSplineSegmentLinear',
'DrawSplineSegmentBasis',
'DrawSplineSegmentCatmullRom',
'DrawSplineSegmentBezierQuadratic',
'DrawSplineSegmentBezierCubic',
'GetSplinePointLinear',
'GetSplinePointBasis',
'GetSplinePointCatmullRom',
'GetSplinePointBezierQuad',
'GetSplinePointBezierCubic'
]
const blocklistStructs = []
const { defines, structs, aliases, enums, callbacks, functions } = JSON.parse(await readFile('build/_deps/raylib-src/parser/output/raylib_api.json'))
const wrapped = []
const unwrapped = []
const struct_utils = []
for (const { name, description, fields } of structs) {
if (blocklistStructs.includes(name)) {
continue
}
struct_utils.push({
name: `${name}_size`,
description: `Get byte-size of ${name} struct`,
returnType: 'unsigned int',
params: []
})
for (const field of fields) {
struct_utils.push({
name: `${name}_get_${field.name}`,
description: `Getter for ${name}->${field.name}`,
returnType: field.type,
params: [{ name: 'obj', type: `${field.name}*` }]
})
struct_utils.push({
name: `${name}_set_${field.name}`,
description: `Setter for ${name}->${field.name}`,
returnType: 'void',
params: [
{ name: 'obj', type: `${field.name}*` },
{ name: 'v', type: field.type }
]
})
}
}
for (const f of functions) {
if (blocklist.includes(f.name)) {
continue
}
if (isWrapped(f)) {
wrapped.push({
name: `wrapped_${f.name}`,
description: f.description,
original: f.name,
returnType: /[A-Z]/.test(f.returnType) ? `${f.returnType}*` : f.returnType,
params: (f.params || []).map((p) => {
return {
...p,
type: /[A-Z]/.test(p.type) ? `${p.type}*` : p.type
}
})
})
} else {
f.params ||= []
unwrapped.push(f)
}
}
// these are my additions (per-frame alloc/free)
wrapped.push({
name: 'wrapped_alloc',
original: 'alloc',
description: 'Allocate memory, cleared on every WindowShouldClose call (your frame update-loop)',
returnType: 'void*',
params: [
{
name: 'size',
type: 'unsigned int',
description: 'The size (in bytes) to allocate'
}
]
})
wrapped.push({
name: 'wrapped_free',
original: 'free',
description: 'Clear allocated memory. If it was not allocated (or has already been freed) this will error.',
returnType: 'void',
params: [
{
name: 'pointer',
type: 'void*',
description: 'The pointer to free'
}
]
})
wrapped.push({
name: 'wrapped_WindowShouldClose',
original: 'WindowShouldClose',
description: 'Check if application should close (KEY_ESCAPE pressed or windows close icon clicked.) This also clears memory that was allocated since last call.',
returnType: 'bool',
params: []
})
await writeFile('tools/api.json', JSON.stringify({ unwrapped, wrapped, struct_utils, defines, structs, aliases, enums, callbacks, functions }, null, 2))
- Vorherrschende Sprache
- C
- Sterne
- 0
- Forks
- 1
- PR-Merge-Kennzahlen
- Keine gemergten PRs in 30 T.
Entwicklungsumgebung
Dieses Projekt bietet weder Dev-Container noch Dockerfile noch Beitragsleitfaden – die Einrichtung liegt bei Ihnen. Beginnen Sie mit der README; die allgemeinen Schritte stehen in unserem Leitfaden für den ersten Beitrag.
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus konsumer/raylib-pointers
-
Potential memory leakOffen
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
konsumer/raylib-pointers#12 · 2 Kommentare · 1 Reaktion ·
-
Nested structs & arraysOffenenhancement parent
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 25/100
-
C enhancement todo
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 28/100
-
defines (bun)Offenbunjs enhancement todo
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 48/100
-
nested structs (bun)Offenbunjs enhancement todo
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 35/100
Alle Issues in konsumer/raylib-pointers
Ähnliche Issues
-
enhancement good first issue help wanted
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
-
bug multiplayer status: planned
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 67/100
ChupathingyCE/chupathingyce#851 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 73/100
HigherOrderCO/Bend#2104 ·
-
research-radar
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
good first issue help wanted program
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainer antworten meist innerhalb von 1 Tag