Search found 30 matches

by hewih
Sat Jan 23, 2010 10:39 am
Forum: Common Lisp
Topic: copy values of class to other class
Replies: 8
Views: 5895

Re: copy values of class to other class

in my game i have: a "vector2d" class (instanced as "position1"). a method "vec-add" which creates a new instance of "vector2d". a mover class (mover1), which refers to position1 and should change the values (x and y) every update cycle a sprite class (sprite1), which also refers to position1 if the...
by hewih
Sat Jan 23, 2010 10:09 am
Forum: Common Lisp
Topic: copy values of class to other class
Replies: 8
Views: 5895

Re: copy values of class to other class

it doesn't have to iterate over the slots per se, but something that does shallow-copy, just without creating a new instance?
in C# f.e. there are classes (heap allocated) and structs (stack allocated). structs are treated just like ints and copied every time they are used.
by hewih
Sat Jan 23, 2010 7:16 am
Forum: Common Lisp
Topic: copy values of class to other class
Replies: 8
Views: 5895

Re: copy values of class to other class

i updated my post, sorry for the confusion. what i'm looking for i a function which automatically iterates over all slots and copies them one by one. (mysteries-copy-func position (vec+ position offset)) => (setf (x-of position) (x-of result)) (setf (y-of position) (y-of result)) thanks for the libr...
by hewih
Sat Jan 23, 2010 6:34 am
Forum: Common Lisp
Topic: copy values of class to other class
Replies: 8
Views: 5895

Re: copy values of class to other class

btw: does anybody know of a good vector implementation? i found cl-vectors and vecto which seem to be vector graphics, and GSLL which i can't get to install.
by hewih
Sat Jan 23, 2010 6:33 am
Forum: Common Lisp
Topic: copy values of class to other class
Replies: 8
Views: 5895

copy values of class to other class

i'm using a 2D vector class to represent a position. one position instance is shared by some other class instances (sprite, mover). one of the class setfs the position, which creates a new instance however and sprite and mover refer to the old instance. is their a setf or something which only copies...
by hewih
Sat Jan 23, 2010 6:24 am
Forum: Common Lisp
Topic: [resolved] signal-slot concept of Qt => Cells
Replies: 12
Views: 8749

Re: signal-slot concept of Qt for Lisp classes

Ramarren, thanks for the exhaustive examples! :)
it still took me a while to get it and i think i'll stick with the parametrized approach.
by hewih
Wed Jan 20, 2010 9:27 am
Forum: Common Lisp
Topic: [resolved] signal-slot concept of Qt => Cells
Replies: 12
Views: 8749

Re: signal-slot concept of Qt for Lisp classes

does anybody know how to apply rules in Cells on class instances? i can only find examples for class definitions.
by hewih
Wed Jan 20, 2010 6:25 am
Forum: Common Lisp
Topic: [resolved] signal-slot concept of Qt => Cells
Replies: 12
Views: 8749

Re: signal-slot concept of Qt for Lisp classes

events are not quite the thing i need. thanks for the example though. i have a spacecraft sprite which depends on a position and is followed by 2 side-kicks (also sprites) which depend on an offset position relative to the spacecraft. the spacecraft position is changed by a mystical force, but every...
by hewih
Wed Jan 20, 2010 4:29 am
Forum: Common Lisp
Topic: [resolved] signal-slot concept of Qt => Cells
Replies: 12
Views: 8749

Re: signal-slot concept of Qt for Lisp classes

you guys are great, thank you! ^^ cells is exactly what i need and it looks pretty mature. they seem to call it "instance-specific formulas". (defmethod (setf foo) :after (value (object (eql a1))) haven't thought of that, thanks. the values in my game engine may change 100 times per second, maybe i ...
by hewih
Tue Jan 19, 2010 2:26 pm
Forum: Common Lisp
Topic: [resolved] signal-slot concept of Qt => Cells
Replies: 12
Views: 8749

[resolved] signal-slot concept of Qt => Cells

Hello fellow Lispers! i'm a newbie to Common Lisp and developing a small game engine where i want to implement the signal-slot concept of Qt . basically it means that you can specify "signals" and "slots" (not Lisp slots) for classes and connect them for some instances. everytime the signal is calle...