le readme
This commit is contained in:
24
src/snapshots.cpp
Normal file
24
src/snapshots.cpp
Normal file
@@ -0,0 +1,24 @@
|
||||
#include "undo_stack.h"
|
||||
|
||||
void
|
||||
undo_stack_push(Snapshots* self, Anm2* anm2)
|
||||
{
|
||||
if (self->top >= UNDO_STACK_MAX)
|
||||
{
|
||||
memmove(&self->snapshots[0], &self->snapshots[1], sizeof(Anm2) * (UNDO_STACK_MAX - 1));
|
||||
self->top = UNDO_STACK_MAX - 1;
|
||||
}
|
||||
|
||||
self->snapshots[self->top++] = *anm2;
|
||||
}
|
||||
|
||||
bool
|
||||
undo_stack_pop(Snapshots* self, Anm2* anm2)
|
||||
{
|
||||
if (self->top == 0)
|
||||
return false;
|
||||
|
||||
*anm2 = self->snapshots[--self->top];
|
||||
|
||||
return true;
|
||||
}
|
Reference in New Issue
Block a user