refactored clips -> patterns
This commit is contained in:
parent
82ed9d84ac
commit
a52d8645e6
|
@ -109,7 +109,7 @@ StartDragTimeMarker(rect2 TimelineBounds, frame_range VisibleFrames, app_state*
|
||||||
|
|
||||||
#define CLICK_ANIMATION_BLOCK_EDGE_MAX_SCREEN_DISTANCE 10
|
#define CLICK_ANIMATION_BLOCK_EDGE_MAX_SCREEN_DISTANCE 10
|
||||||
|
|
||||||
OPERATION_STATE_DEF(drag_animation_clip_state)
|
OPERATION_STATE_DEF(drag_animation_block_state)
|
||||||
{
|
{
|
||||||
rect2 TimelineBounds;
|
rect2 TimelineBounds;
|
||||||
handle BlockHandle;
|
handle BlockHandle;
|
||||||
|
@ -129,9 +129,9 @@ AttemptToSnapPosition(u32 SnappingFrame, u32 SnapToFrame)
|
||||||
return Result;
|
return Result;
|
||||||
}
|
}
|
||||||
|
|
||||||
OPERATION_RENDER_PROC(UpdateDragAnimationClip)
|
OPERATION_RENDER_PROC(UpdateDragAnimationBlock)
|
||||||
{
|
{
|
||||||
drag_animation_clip_state* OpState = (drag_animation_clip_state*)Operation.OpStateMemory;
|
drag_animation_block_state* OpState = (drag_animation_block_state*)Operation.OpStateMemory;
|
||||||
|
|
||||||
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
||||||
|
|
||||||
|
@ -228,7 +228,7 @@ OPERATION_RENDER_PROC(UpdateDragAnimationClip)
|
||||||
AnimationBlock->Range.Max = (u32)Clamp(PlayableStartFrame, (s32)AnimationBlock->Range.Max, PlayableEndFrame);
|
AnimationBlock->Range.Max = (u32)Clamp(PlayableStartFrame, (s32)AnimationBlock->Range.Max, PlayableEndFrame);
|
||||||
}
|
}
|
||||||
|
|
||||||
input_command DragAnimationClipCommands [] = {
|
input_command DragAnimationBlockCommands [] = {
|
||||||
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, 0 },
|
{ KeyCode_MouseLeftButton, KeyCode_Invalid, Command_Ended, 0 },
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -238,11 +238,11 @@ SelectAndBeginDragAnimationBlock(animation_timeline_state* TimelineState, handle
|
||||||
TimelineState->SelectedBlockHandle = BlockHandle;
|
TimelineState->SelectedBlockHandle = BlockHandle;
|
||||||
|
|
||||||
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
animation* ActiveAnim = AnimationSystem_GetActiveAnimation(&State->AnimationSystem);
|
||||||
operation_mode* DragAnimationClipMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationClipCommands, UpdateDragAnimationClip);
|
operation_mode* DragAnimationBlockMode = ActivateOperationModeWithCommands(&State->Modes, DragAnimationBlockCommands, UpdateDragAnimationBlock);
|
||||||
|
|
||||||
drag_animation_clip_state* OpState = CreateOperationState(DragAnimationClipMode,
|
drag_animation_block_state* OpState = CreateOperationState(DragAnimationBlockMode,
|
||||||
&State->Modes,
|
&State->Modes,
|
||||||
drag_animation_clip_state);
|
drag_animation_block_state);
|
||||||
OpState->TimelineBounds = TimelineBounds;
|
OpState->TimelineBounds = TimelineBounds;
|
||||||
OpState->BlockHandle = BlockHandle;
|
OpState->BlockHandle = BlockHandle;
|
||||||
OpState->VisibleRange = VisibleRange;
|
OpState->VisibleRange = VisibleRange;
|
||||||
|
@ -580,7 +580,7 @@ PANEL_MODAL_OVERRIDE_CALLBACK(LoadAnimationFileCallback)
|
||||||
{
|
{
|
||||||
gs_file AnimFile = ReadEntireFile(Context.ThreadContext.FileHandler, FileInfo.Path);
|
gs_file AnimFile = ReadEntireFile(Context.ThreadContext.FileHandler, FileInfo.Path);
|
||||||
gs_string AnimFileString = MakeString((char*)AnimFile.Data.Memory, AnimFile.Data.Size);
|
gs_string AnimFileString = MakeString((char*)AnimFile.Data.Memory, AnimFile.Data.Size);
|
||||||
animation NewAnim = AnimParser_Parse(AnimFileString, State->AnimationSystem.Storage, GlobalAnimationClipsCount, GlobalAnimationClips);
|
animation NewAnim = AnimParser_Parse(AnimFileString, State->AnimationSystem.Storage, GlobalAnimationPatternsCount, GlobalAnimationPatterns);
|
||||||
|
|
||||||
u32 NewAnimIndex = AnimationArray_Push(&State->AnimationSystem.Animations, NewAnim);
|
u32 NewAnimIndex = AnimationArray_Push(&State->AnimationSystem.Animations, NewAnim);
|
||||||
State->AnimationSystem.ActiveAnimationIndex = NewAnimIndex;
|
State->AnimationSystem.ActiveAnimationIndex = NewAnimIndex;
|
||||||
|
@ -588,15 +588,15 @@ PANEL_MODAL_OVERRIDE_CALLBACK(LoadAnimationFileCallback)
|
||||||
}
|
}
|
||||||
|
|
||||||
internal void
|
internal void
|
||||||
DrawAnimationClipsList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem)
|
DrawAnimationPatternList(rect2 PanelBounds, ui_interface* Interface, u32 SelectedAnimationLayerHandle, animation_system* AnimationSystem)
|
||||||
{
|
{
|
||||||
ui_layout Layout = ui_CreateLayout(Interface, PanelBounds);
|
ui_layout Layout = ui_CreateLayout(Interface, PanelBounds);
|
||||||
ui_PushLayout(Interface, Layout);
|
ui_PushLayout(Interface, Layout);
|
||||||
for (s32 i = 0; i < GlobalAnimationClipsCount; i++)
|
for (s32 i = 0; i < GlobalAnimationPatternsCount; i++)
|
||||||
{
|
{
|
||||||
animation_clip Clip = GlobalAnimationClips[i];
|
animation_pattern Pattern = GlobalAnimationPatterns[i];
|
||||||
gs_string ClipName = MakeString(Clip.Name, Clip.NameLength);
|
gs_string PatternName = MakeString(Pattern.Name, Pattern.NameLength);
|
||||||
if (ui_LayoutListEntry(Interface, &Layout, ClipName, i))
|
if (ui_LayoutListEntry(Interface, &Layout, PatternName, i))
|
||||||
{
|
{
|
||||||
AddAnimationBlockAtCurrentTime(i + 1, SelectedAnimationLayerHandle, AnimationSystem);
|
AddAnimationBlockAtCurrentTime(i + 1, SelectedAnimationLayerHandle, AnimationSystem);
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ struct animation_system
|
||||||
};
|
};
|
||||||
|
|
||||||
// TODO(pjs): Better name - something like animation_prototype
|
// TODO(pjs): Better name - something like animation_prototype
|
||||||
struct animation_clip
|
struct animation_pattern
|
||||||
{
|
{
|
||||||
char* Name;
|
char* Name;
|
||||||
s32 NameLength;
|
s32 NameLength;
|
||||||
|
|
|
@ -6,7 +6,7 @@
|
||||||
#ifndef FOLDHAUS_ANIMATION_SERIALIZER_CPP
|
#ifndef FOLDHAUS_ANIMATION_SERIALIZER_CPP
|
||||||
|
|
||||||
internal gs_string
|
internal gs_string
|
||||||
AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_arena* Arena)
|
AnimSerializer_Serialize(animation Anim, animation_pattern* GlobalClips, gs_memory_arena* Arena)
|
||||||
{
|
{
|
||||||
serializer Serializer = {0};
|
serializer Serializer = {0};
|
||||||
Serializer.String = PushString(Arena, 4096);
|
Serializer.String = PushString(Arena, 4096);
|
||||||
|
@ -48,7 +48,7 @@ AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_
|
||||||
// TODO(pjs): Systematize the AnimationProcHandle
|
// TODO(pjs): Systematize the AnimationProcHandle
|
||||||
// :AnimProcHandle
|
// :AnimProcHandle
|
||||||
u32 AnimationProcIndex = AnimationBlockAt.AnimationProcHandle - 1;
|
u32 AnimationProcIndex = AnimationBlockAt.AnimationProcHandle - 1;
|
||||||
animation_clip Animation = GlobalClips[AnimationProcIndex];
|
animation_pattern Animation = GlobalClips[AnimationProcIndex];
|
||||||
|
|
||||||
Serializer_OpenStruct(&Serializer, AnimField_Block);
|
Serializer_OpenStruct(&Serializer, AnimField_Block);
|
||||||
{
|
{
|
||||||
|
@ -70,7 +70,7 @@ AnimSerializer_Serialize(animation Anim, animation_clip* GlobalClips, gs_memory_
|
||||||
}
|
}
|
||||||
|
|
||||||
internal animation
|
internal animation
|
||||||
AnimParser_Parse(gs_string File, gs_memory_arena* Arena, u32 AnimClipsCount, animation_clip* AnimClips)
|
AnimParser_Parse(gs_string File, gs_memory_arena* Arena, u32 AnimClipsCount, animation_pattern* AnimClips)
|
||||||
{
|
{
|
||||||
animation Result = {0};
|
animation Result = {0};
|
||||||
|
|
||||||
|
|
|
@ -211,7 +211,7 @@ UPDATE_AND_RENDER(UpdateAndRender)
|
||||||
|
|
||||||
// :AnimProcHandle
|
// :AnimProcHandle
|
||||||
u32 AnimationProcIndex = Block.AnimationProcHandle - 1;
|
u32 AnimationProcIndex = Block.AnimationProcHandle - 1;
|
||||||
animation_proc* AnimationProc = GlobalAnimationClips[AnimationProcIndex].Proc;
|
animation_proc* AnimationProc = GlobalAnimationPatterns[AnimationProcIndex].Proc;
|
||||||
AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, State->Transient);
|
AnimationProc(&LayerLEDBuffers[Layer], *Assembly, SecondsIntoBlock, State->Transient);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -209,8 +209,8 @@ EndCurrentOperationMode(app_state* State)
|
||||||
DeactivateCurrentOperationMode(&State->Modes);
|
DeactivateCurrentOperationMode(&State->Modes);
|
||||||
}
|
}
|
||||||
|
|
||||||
s32 GlobalAnimationClipsCount = 3;
|
s32 GlobalAnimationPatternsCount = 3;
|
||||||
animation_clip GlobalAnimationClips[] = {
|
animation_pattern GlobalAnimationPatterns[] = {
|
||||||
{ "Test Pattern One", 16, TestPatternOne },
|
{ "Test Pattern One", 16, TestPatternOne },
|
||||||
{ "Test Pattern Two", 16, TestPatternTwo },
|
{ "Test Pattern Two", 16, TestPatternTwo },
|
||||||
{ "Test Pattern Three", 18, TestPatternThree },
|
{ "Test Pattern Three", 18, TestPatternThree },
|
||||||
|
|
|
@ -479,8 +479,6 @@ WinMain (
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
MainWindow = Win32CreateWindow (HInstance, "Foldhaus", 1440, 768, HandleWindowEvents);
|
MainWindow = Win32CreateWindow (HInstance, "Foldhaus", 1440, 768, HandleWindowEvents);
|
||||||
Win32UpdateWindowDimension(&MainWindow);
|
Win32UpdateWindowDimension(&MainWindow);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue