summaryrefslogtreecommitdiff
path: root/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'main.cpp')
-rw-r--r--main.cpp68
1 files changed, 39 insertions, 29 deletions
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, &current);
+ 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);