Name
DblBuffer2d -- A double buffered space.
Description
DblBuffer2d augments Discrete2d to provide a form of double buffered space. Two lattices are maintained: lattice (the current state), and newLattice (the future state). All reads take place from lattice, all writes take place to newLattice. newLattice is copied to lattice when updateLattice is called. DblBuffer2d can be used to implement one model of concurrent action, like in Ca2ds. NOTE: be very careful if you're using low-level macro access to the world, in particular be sure that you preserve the write semantics on the newLattice.
Methods
Phase: Creating
+
create: (id <Zone>)
aZone setSizeX: (unsigned)
x Y: (unsigned)
y Convenience constructor for DblBuffer lattice
-
createEnd Rewrites the method from Discrete2d. Allocate two lattices, makes the offsets.
Phase: Using
- (id *)
getNewLattice Return a pointer to the newLattice buffer.
-
updateLattice Copy newLattice to lattice, in effect updating the lattice.
-
putObject: anObject atX: (unsigned)
x Y: (unsigned)
y Overridden so writes happen to newLattice.
-
putValue: (long)
v atX: (unsigned)
x Y: (unsigned)
y Overridden so writes happen to newLattice.