EventList and Spline do not seem to be defined (api)
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 3/5
- Thời gian dự kiến
- 1-2 ngày
- Mức phù hợp với người mới
- 45/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Đình trệ
- Công nghệ
- c, javascript
- Lĩnh vực
- api, build-system
Hướng nghiên cứu
Bắt đầu với tools/gen_api.js và các mục trong blocklist dành cho EventList và Spline, sau đó kiểm tra build/_deps/raylib-src/parser/output/raylib_api.json và tools/api.json được tạo. So sánh các khai báo được tạo với phiên bản raylib được DLL FFI wrapper sử dụng. Hoàn tất khi các mục API bị ảnh hưởng khớp với các symbol raylib hiện có và không còn tạo ra lỗi hàm không xác định.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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))
- Ngôn ngữ chính
- C
- Star
- 0
- Fork
- 1
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của konsumer/raylib-pointers
-
Potential memory leakĐang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
konsumer/raylib-pointers#12 · 2 bình luận · 1 reaction ·
-
Nested structs & arraysĐang mởenhancement parent
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 25/100
-
nested-structs/arrays (C)Đang mởC enhancement todo
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 28/100
-
defines (bun)Đang mởbunjs enhancement todo
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 48/100
-
nested structs (bun)Đang mởbunjs enhancement todo
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Tất cả issue của konsumer/raylib-pointers
Issue tương tự
-
Implement looks_size reporterĐang mởenhancement good first issue help wanted
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
-
bug multiplayer status: planned
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 67/100
ChupathingyCE/chupathingyce#851 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 73/100
HigherOrderCO/Bend#2104 ·
-
Research radar digest 2026-W46Đang mởresearch-radar
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Maintainer thường phản hồi trong vòng 1 ngày
-
good first issue help wanted program
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
hffgzktbcc-blip/ounce-core#297 ·
Maintainer thường phản hồi trong vòng 1 ngày