le readme

This commit is contained in:
2025-06-29 00:49:58 -04:00
parent 0e8d1ae6b4
commit 9083a25a2b
8 changed files with 87 additions and 8 deletions

24
src/snapshots.cpp Normal file
View 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;
}