Closed mjkalyan closed 2 years ago
BTW, the design intent is for the user to load assets once and then use those assets in the creation of objects. What's confusing in this case is that "texture" is both an asset and an object. Admittedly we don't have a very clear distinction there yet.
I'd like to avoid pushing known-broken code to main
Me too, I was thinking I'd just fix up the issues before merging but it's smarter to make separate PRs. I'll work some git magic and resubmit.
sorry to send you on a wild goose chase
Don't be! I am more familiar with the code base now.
autowrap's wrapper objects are pointers (basically) [...] mind making that change?
Ah, gotcha, will do!
I had to use an absolute path to get the example to work
I had noted this mentally but forgot to switch to UIOP, will fix that too.
Oh, and should we remove the ptr
slot from game-asset
altogether?
Removed the WIP commit so this PR can be merged.
Oh, and should we remove the
ptr
slot fromgame-asset
altogether?
Double-check me here but I don't think it's being used in anything other than loading, and if not, then it can be removed.
Also, remember that we're also not setting c-struct
to (autowrap:ptr foo)
but just foo
. (autowrap:ptr)
just gets the raw pointer which AFAIK we will not need to use.
ptr
is used in some probably stale free
methods (in claylib.lisp) and the macro definition for definitializer
, which at first glance looks like it's specifying a finalizer to free the ptr
.
Judging by the docstring, autowrap:free
should work on the wrapper object (the c-struct) directly. If I'm right I should be able to replace all the freeing of ptr
mentioned above with freeing of the c-struct and safely remove the ptr
slot.
ptr
is used in some probably stalefree
methods (in claylib.lisp) and the macro definition fordefinitializer
, which at first glance looks like it's specifying a finalizer to free theptr
.Judging by the docstring,
autowrap:free
should work on the wrapper object (the c-struct) directly. If I'm right I should be able to replace all the freeing ofptr
mentioned above with freeing of the c-struct and safely remove theptr
slot.
Actually, when it comes to finalizers, we do need to use ptr
. When you first add the finalizer it creates a closure, but if the wrapper is included in that closure that means there's always a reference to it so it will never be freed. There's a section on this in the autowrap docs that is worth a read.
See the "WIP: textures example 1" commit message for more detail about my texture issues.
The other changes should be good to go.