Skip to content
This repository has been archived by the owner on Jul 8, 2022. It is now read-only.

Commit

Permalink
Close #27: Set initial content size 1:1, limit by wall height
Browse files Browse the repository at this point in the history
  • Loading branch information
tribal-tec committed Jun 14, 2013
1 parent 01ffd27 commit ab9fb4f
Showing 1 changed file with 12 additions and 5 deletions.
17 changes: 12 additions & 5 deletions src/ContentWindowManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,18 @@ ContentWindowManager::ContentWindowManager(boost::shared_ptr<Content> content)
// content dimensions
content->getDimensions(contentWidth_, contentHeight_);

// default position / size, assumes a 16/9 aspect ratio
// the actual aspect ratio will be set after the content is loaded
x_ = y_ = 0.01;
h_ = 0.3;
w_ = (double)g_configuration->getTotalHeight() / (double)g_configuration->getTotalWidth() * 16./9. * h_;
const double contentAR = contentHeight_ == 0 ? 16./9 :
double(contentWidth_) / double(contentHeight_);
const double configAR = double(g_configuration->getTotalHeight()) /
double(g_configuration->getTotalWidth());

// full height and centered
y_ = 0.;
h_ = contentHeight_ == 0 ? 1. : double(contentHeight_) /
double(g_configuration->getTotalHeight());
h_ = std::min( h_, 1. );
w_ = configAR * contentAR * h_;
x_ = (1. - w_) * .5;

// default to centered
centerX_ = 0.5;
Expand Down

0 comments on commit ab9fb4f

Please sign in to comment.