From 3e399d7f2f37feb10e120d7c5950615ffb350a84 Mon Sep 17 00:00:00 2001 From: Fox Caminiti Date: Sun, 24 Jul 2022 11:22:48 -0400 Subject: demo scene added; minor oversights fixed --- main.cpp | 68 +++++++++++++++++++++++++++++++++++++--------------------------- 1 file changed, 39 insertions(+), 29 deletions(-) (limited to 'main.cpp') diff --git a/main.cpp b/main.cpp index c5605c3..844a6f7 100644 --- a/main.cpp +++ b/main.cpp @@ -118,40 +118,40 @@ MainFunction(main_sdl *Main, memory *Memory, cache_pool *Cache, pixel_buffer *CompBuffer) { SSE_ClearBuffer(CompBuffer); - for (int i = 0; i < File->NumberOfLayers; i++) { - project_layer *Layer = File->Layer[i]; - if (Layer->RenderInfo) { - // Keyframe updating - if (State->UpdateKeyframes) { - for (int p = 0; p < Layer->NumberOfEffects; p++) { - for (int o = 0; o < Layer->Effect[p]->NumberOfProperties; o++) { - CalculateKeyframesLinearly(File->CurrentFrame, &Layer->Effect[p]->Property[o]); - } - } - for (int r = 0; r < AmountOf(Layer->Property); r++) { - CalculateKeyframesLinearly(File->CurrentFrame, &Layer->Property[r]); - } - State->UpdateKeyframes = false; + for (int i = 0; i < File->NumberOfLayers; i++) { + project_layer *Layer = File->Layer[i]; + if (Layer->RenderInfo) { + // Keyframe updating + if (State->UpdateKeyframes) { + for (int p = 0; p < Layer->NumberOfEffects; p++) { + for (int o = 0; o < Layer->Effect[p]->NumberOfProperties; o++) { + CalculateKeyframesLinearly(File->CurrentFrame, &Layer->Effect[p]->Property[o]); + } } - - // Video updating - if (Layer->SourceType == source_video) { // && Layer->VideoCurrentFrame != File->CurrentFrame - Layer->VideoFrameOffset) { - video_source *Source = (video_source *)Layer->RenderInfo; - LoadVideoFrame(Source, Memory, File->CurrentFrame); // TODO(fox): Make above check work! - UpdateEffects(Layer, Memory); - Source->Raster.ToUpdate = true; + for (int r = 0; r < AmountOf(Layer->Property); r++) { + CalculateKeyframesLinearly(File->CurrentFrame, &Layer->Property[r]); } + } - // Effect updating - if (Layer->SourceType == source_image) { - image_source *Source = (image_source *)Layer->RenderInfo; - if (Source->Raster.ToUpdate) { - UpdateEffects(Layer, Memory); - Source->Raster.ToUpdate = false; - } + // Video updating + if (Layer->SourceType == source_video) { // && Layer->VideoCurrentFrame != File->CurrentFrame - Layer->VideoFrameOffset) { + video_source *Source = (video_source *)Layer->RenderInfo; + LoadVideoFrame(Source, Memory, File->CurrentFrame); // TODO(fox): Make above check work! + UpdateEffects(Layer, Memory); + Source->Raster.ToUpdate = true; + } + + // Effect updating + if (Layer->SourceType == source_image) { + image_source *Source = (image_source *)Layer->RenderInfo; + if (Source->Raster.ToUpdate) { + UpdateEffects(Layer, Memory); + Source->Raster.ToUpdate = false; } } } + } + State->UpdateKeyframes = false; QueueCurrentFrame(File, CompBuffer, State); } @@ -458,7 +458,17 @@ int main(int argc, char *argv[]) { SDL_GL_SetAttribute(SDL_GL_STENCIL_SIZE, 8); SDL_WindowFlags window_flags = (SDL_WindowFlags)(SDL_WINDOW_OPENGL | SDL_WINDOW_RESIZABLE | SDL_WINDOW_ALLOW_HIGHDPI); // uint32 ScreenSize[2] = {2560/1.2, 1600/1.2}; - real32 ScreenSize[2] = {3840/1.2, 2160/1.2}; + // real32 ScreenSize[2] = {3840/1.2, 2160/1.2}; + real32 ScreenSize[2]; + SDL_DisplayMode current; + int windowtest = SDL_GetCurrentDisplayMode(0, ¤t); + if (windowtest == 0) { + ScreenSize[0] = current.w; + ScreenSize[1] = current.h; + } else { + ScreenSize[0] = 1920; + ScreenSize[1] = 1080; + } SDL_Window* window = SDL_CreateWindow("Event Tester", SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, ScreenSize[0], ScreenSize[1], window_flags); SDL_GLContext gl_context = SDL_GL_CreateContext(window); SDL_GL_MakeCurrent(window, gl_context); -- cgit v1.2.3