diff --git a/RetroFE/Source/Graphics/Component/Component.cpp b/RetroFE/Source/Graphics/Component/Component.cpp index fd20fae..b9183af 100644 --- a/RetroFE/Source/Graphics/Component/Component.cpp +++ b/RetroFE/Source/Graphics/Component/Component.cpp @@ -371,18 +371,18 @@ void Component::Draw() if(BackgroundTexture) { SDL_Rect rect; - rect.h = static_cast(BaseViewInfo.GetHeight()); - rect.w = static_cast(BaseViewInfo.GetWidth()); - rect.x = static_cast(BaseViewInfo.GetXRelativeToOrigin()); - rect.y = static_cast(BaseViewInfo.GetYRelativeToOrigin()); + rect.h = static_cast(BaseViewInfo.ScaledHeight()); + rect.w = static_cast(BaseViewInfo.ScaledWidth()); + rect.x = static_cast(BaseViewInfo.XRelativeToOrigin()); + rect.y = static_cast(BaseViewInfo.YRelativeToOrigin()); SDL_SetTextureColorMod(BackgroundTexture, - static_cast(BaseViewInfo.GetBackgroundRed()*255), - static_cast(BaseViewInfo.GetBackgroundGreen()*255), - static_cast(BaseViewInfo.GetBackgroundBlue()*255)); + static_cast(BaseViewInfo.BackgroundRed*255), + static_cast(BaseViewInfo.BackgroundGreen*255), + static_cast(BaseViewInfo.BackgroundBlue*255)); - SDL::RenderCopy(BackgroundTexture, static_cast(BaseViewInfo.GetBackgroundAlpha()*255), NULL, &rect, BaseViewInfo.GetAngle()); + SDL::RenderCopy(BackgroundTexture, static_cast(BaseViewInfo.BackgroundAlpha*255), NULL, &rect, BaseViewInfo.Angle); } } @@ -418,51 +418,51 @@ bool Component::Animate(bool loop) switch(tween->GetProperty()) { case TWEEN_PROPERTY_X: - BaseViewInfo.SetX(value); + BaseViewInfo.X = value; break; case TWEEN_PROPERTY_Y: - BaseViewInfo.SetY(value); + BaseViewInfo.Y = value; break; case TWEEN_PROPERTY_HEIGHT: - BaseViewInfo.SetHeight(value); + BaseViewInfo.Height = value; break; case TWEEN_PROPERTY_WIDTH: - BaseViewInfo.SetWidth(value); + BaseViewInfo.Width = value; break; case TWEEN_PROPERTY_ANGLE: - BaseViewInfo.SetAngle(value); + BaseViewInfo.Angle = value; break; case TWEEN_PROPERTY_ALPHA: - BaseViewInfo.SetAlpha(value); + BaseViewInfo.Alpha = value; break; case TWEEN_PROPERTY_X_ORIGIN: - BaseViewInfo.SetXOrigin(value); + BaseViewInfo.XOrigin = value; break; case TWEEN_PROPERTY_Y_ORIGIN: - BaseViewInfo.SetYOrigin(value); + BaseViewInfo.YOrigin = value; break; case TWEEN_PROPERTY_X_OFFSET: - BaseViewInfo.SetXOffset(value); + BaseViewInfo.XOffset = value; break; case TWEEN_PROPERTY_Y_OFFSET: - BaseViewInfo.SetYOffset(value); + BaseViewInfo.YOffset = value; break; case TWEEN_PROPERTY_FONT_SIZE: - BaseViewInfo.SetFontSize(value); + BaseViewInfo.FontSize = value; break; case TWEEN_PROPERTY_BACKGROUND_ALPHA: - BaseViewInfo.SetBackgroundAlpha(value); + BaseViewInfo.BackgroundAlpha = value; break; } } diff --git a/RetroFE/Source/Graphics/Component/Image.cpp b/RetroFE/Source/Graphics/Component/Image.cpp index 8d9ea45..10ad254 100644 --- a/RetroFE/Source/Graphics/Component/Image.cpp +++ b/RetroFE/Source/Graphics/Component/Image.cpp @@ -62,8 +62,8 @@ void Image::AllocateGraphicsMemory() { SDL_SetTextureBlendMode(Texture, SDL_BLENDMODE_BLEND); SDL_QueryTexture(Texture, NULL, NULL, &width, &height); - BaseViewInfo.SetImageWidth(width * ScaleX); - BaseViewInfo.SetImageHeight(height * ScaleY); + BaseViewInfo.ImageWidth = width * ScaleX; + BaseViewInfo.ImageHeight = height * ScaleY; } SDL_UnlockMutex(SDL::GetMutex()); @@ -78,11 +78,11 @@ void Image::Draw() { SDL_Rect rect; - rect.x = static_cast(BaseViewInfo.GetXRelativeToOrigin()); - rect.y = static_cast(BaseViewInfo.GetYRelativeToOrigin()); - rect.h = static_cast(BaseViewInfo.GetHeight()); - rect.w = static_cast(BaseViewInfo.GetWidth()); + rect.x = static_cast(BaseViewInfo.XRelativeToOrigin()); + rect.y = static_cast(BaseViewInfo.YRelativeToOrigin()); + rect.h = static_cast(BaseViewInfo.ScaledHeight()); + rect.w = static_cast(BaseViewInfo.ScaledWidth()); - SDL::RenderCopy(Texture, static_cast((BaseViewInfo.GetAlpha() * 255)), NULL, &rect, BaseViewInfo.GetAngle()); + SDL::RenderCopy(Texture, static_cast((BaseViewInfo.Alpha * 255)), NULL, &rect, BaseViewInfo.Angle); } } diff --git a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp index 6b62e25..f87ee9d 100644 --- a/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp +++ b/RetroFE/Source/Graphics/Component/ReloadableMedia.cpp @@ -83,10 +83,10 @@ void ReloadableMedia::Update(float dt) { // video needs to run a frame to start getting size info - if(BaseViewInfo.GetImageHeight() == 0 && BaseViewInfo.GetImageWidth() == 0) + if(BaseViewInfo.ImageHeight == 0 && BaseViewInfo.ImageWidth == 0) { - BaseViewInfo.SetImageWidth(LoadedComponent->BaseViewInfo.GetImageWidth()); - BaseViewInfo.SetImageHeight(LoadedComponent->BaseViewInfo.GetImageHeight()); + BaseViewInfo.ImageWidth = LoadedComponent->BaseViewInfo.ImageWidth; + BaseViewInfo.ImageHeight = LoadedComponent->BaseViewInfo.ImageHeight; } LoadedComponent->Update(dt); @@ -188,8 +188,8 @@ void ReloadableMedia::ReloadTexture() if(LoadedComponent) { LoadedComponent->AllocateGraphicsMemory(); - BaseViewInfo.SetImageWidth(LoadedComponent->BaseViewInfo.GetImageWidth()); - BaseViewInfo.SetImageHeight(LoadedComponent->BaseViewInfo.GetImageHeight()); + BaseViewInfo.ImageWidth = LoadedComponent->BaseViewInfo.ImageWidth; + BaseViewInfo.ImageHeight = LoadedComponent->BaseViewInfo.ImageHeight; found = true; } } @@ -251,8 +251,8 @@ void ReloadableMedia::ReloadTexture() if (LoadedComponent != NULL) { LoadedComponent->AllocateGraphicsMemory(); - BaseViewInfo.SetImageWidth(LoadedComponent->BaseViewInfo.GetImageWidth()); - BaseViewInfo.SetImageHeight(LoadedComponent->BaseViewInfo.GetImageHeight()); + BaseViewInfo.ImageWidth = LoadedComponent->BaseViewInfo.ImageWidth; + BaseViewInfo.ImageHeight = LoadedComponent->BaseViewInfo.ImageHeight; } } @@ -260,8 +260,8 @@ void ReloadableMedia::ReloadTexture() if(!LoadedComponent && TextFallback) { LoadedComponent = new Text(imageBasename, FontInst, ScaleX, ScaleY); - BaseViewInfo.SetImageWidth(LoadedComponent->BaseViewInfo.GetImageWidth()); - BaseViewInfo.SetImageHeight(LoadedComponent->BaseViewInfo.GetImageHeight()); + BaseViewInfo.ImageWidth = LoadedComponent->BaseViewInfo.ImageWidth; + BaseViewInfo.ImageHeight = LoadedComponent->BaseViewInfo.ImageHeight; } } } @@ -273,8 +273,8 @@ void ReloadableMedia::Draw() if(LoadedComponent) { - BaseViewInfo.SetImageHeight(LoadedComponent->BaseViewInfo.GetImageHeight()); - BaseViewInfo.SetImageWidth(LoadedComponent->BaseViewInfo.GetImageWidth()); + BaseViewInfo.ImageHeight = LoadedComponent->BaseViewInfo.ImageHeight; + BaseViewInfo.ImageWidth = LoadedComponent->BaseViewInfo.ImageWidth; LoadedComponent->BaseViewInfo = BaseViewInfo; LoadedComponent->Draw(); } diff --git a/RetroFE/Source/Graphics/Component/ScrollingList.cpp b/RetroFE/Source/Graphics/Component/ScrollingList.cpp index 36d3a6c..9aa950b 100644 --- a/RetroFE/Source/Graphics/Component/ScrollingList.cpp +++ b/RetroFE/Source/Graphics/Component/ScrollingList.cpp @@ -742,11 +742,11 @@ void ScrollingList::ResetTweens(Component *c, AnimationEvents *sets, ViewInfo *c return; } - currentViewInfo->SetImageHeight(c->BaseViewInfo.GetImageHeight()); - currentViewInfo->SetImageWidth(c->BaseViewInfo.GetImageWidth()); - nextViewInfo->SetImageHeight(c->BaseViewInfo.GetImageHeight()); - nextViewInfo->SetImageWidth(c->BaseViewInfo.GetImageWidth()); - nextViewInfo->SetBackgroundAlpha(c->BaseViewInfo.GetBackgroundAlpha()); + currentViewInfo->ImageHeight = c->BaseViewInfo.ImageHeight; + currentViewInfo->ImageWidth = c->BaseViewInfo.ImageWidth; + nextViewInfo->ImageHeight = c->BaseViewInfo.ImageHeight; + nextViewInfo->ImageWidth = c->BaseViewInfo.ImageWidth; + nextViewInfo->BackgroundAlpha = c->BaseViewInfo.BackgroundAlpha; //todo: delete properly, memory leak (big), proof of concept c->SetTweens(sets); @@ -756,18 +756,18 @@ void ScrollingList::ResetTweens(Component *c, AnimationEvents *sets, ViewInfo *c c->BaseViewInfo = *currentViewInfo; TweenSet *set = new TweenSet(); - set->Push(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->GetHeight(), nextViewInfo->GetHeight(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->GetWidth(), nextViewInfo->GetWidth(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_ANGLE, EASE_INOUT_QUADRATIC, currentViewInfo->GetAngle(), nextViewInfo->GetAngle(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetAlpha(), nextViewInfo->GetAlpha(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_X, EASE_INOUT_QUADRATIC, currentViewInfo->GetX(), nextViewInfo->GetX(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_Y, EASE_INOUT_QUADRATIC, currentViewInfo->GetY(), nextViewInfo->GetY(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_X_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOrigin(), nextViewInfo->GetXOrigin(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_Y_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOrigin(), nextViewInfo->GetYOrigin(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_X_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetXOffset(), nextViewInfo->GetXOffset(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->GetYOffset(), nextViewInfo->GetYOffset(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->GetFontSize(), nextViewInfo->GetFontSize(), scrollTime)); - set->Push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->GetBackgroundAlpha(), nextViewInfo->GetBackgroundAlpha(), scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_HEIGHT, EASE_INOUT_QUADRATIC, currentViewInfo->ScaledHeight(), nextViewInfo->ScaledHeight(), scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_WIDTH, EASE_INOUT_QUADRATIC, currentViewInfo->ScaledWidth(), nextViewInfo->ScaledWidth(), scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_ANGLE, EASE_INOUT_QUADRATIC, currentViewInfo->Angle, nextViewInfo->Angle, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->Alpha, nextViewInfo->Alpha, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_X, EASE_INOUT_QUADRATIC, currentViewInfo->X, nextViewInfo->X, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_Y, EASE_INOUT_QUADRATIC, currentViewInfo->Y, nextViewInfo->Y, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_X_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->XOrigin, nextViewInfo->XOrigin, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_Y_ORIGIN, EASE_INOUT_QUADRATIC, currentViewInfo->YOrigin, nextViewInfo->YOrigin, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_X_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->XOffset, nextViewInfo->XOffset, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_Y_OFFSET, EASE_INOUT_QUADRATIC, currentViewInfo->YOffset, nextViewInfo->YOffset, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_FONT_SIZE, EASE_INOUT_QUADRATIC, currentViewInfo->FontSize, nextViewInfo->FontSize, scrollTime)); + set->Push(new Tween(TWEEN_PROPERTY_BACKGROUND_ALPHA, EASE_INOUT_QUADRATIC, currentViewInfo->BackgroundAlpha, nextViewInfo->BackgroundAlpha, scrollTime)); scrollTween->Push(set); } @@ -856,7 +856,7 @@ void ScrollingList::Draw(unsigned int layer) Component *c = s->GetComponent(); ViewInfo *currentViewInfo = ScrollPoints->at(i); - if(c && currentViewInfo && currentViewInfo->GetLayer() == layer) + if(c && currentViewInfo && currentViewInfo->Layer == layer) { c->Draw(); } diff --git a/RetroFE/Source/Graphics/Component/Text.cpp b/RetroFE/Source/Graphics/Component/Text.cpp index 1400294..d254620 100644 --- a/RetroFE/Source/Graphics/Component/Text.cpp +++ b/RetroFE/Source/Graphics/Component/Text.cpp @@ -76,25 +76,25 @@ void Text::Draw() } imageHeight = (float)FontInst->GetHeight(); - float scale = (float)BaseViewInfo.GetFontSize() / (float)imageHeight; + float scale = (float)BaseViewInfo.FontSize / (float)imageHeight; - float oldWidth = BaseViewInfo.GetRawWidth(); - float oldHeight = BaseViewInfo.GetRawHeight(); - float oldImageWidth = BaseViewInfo.GetImageHeight(); - float oldImageHeight = BaseViewInfo.GetImageWidth(); + float oldWidth = BaseViewInfo.Width; + float oldHeight = BaseViewInfo.Height; + float oldImageWidth = BaseViewInfo.ImageHeight; + float oldImageHeight = BaseViewInfo.ImageWidth; - BaseViewInfo.SetWidth(imageWidth*scale); - BaseViewInfo.SetHeight(BaseViewInfo.GetFontSize()); - BaseViewInfo.SetImageWidth(imageWidth); - BaseViewInfo.SetImageHeight(imageHeight); + BaseViewInfo.Width = imageWidth*scale; + BaseViewInfo.Height = BaseViewInfo.FontSize; + BaseViewInfo.ImageWidth = imageWidth; + BaseViewInfo.ImageHeight = imageHeight; - float xOrigin = BaseViewInfo.GetXRelativeToOrigin(); - float yOrigin = BaseViewInfo.GetYRelativeToOrigin(); + float xOrigin = BaseViewInfo.XRelativeToOrigin(); + float yOrigin = BaseViewInfo.YRelativeToOrigin(); - BaseViewInfo.SetWidth(oldWidth); - BaseViewInfo.SetHeight(oldHeight); - BaseViewInfo.SetImageWidth(oldImageWidth); - BaseViewInfo.SetImageHeight(oldImageHeight); + BaseViewInfo.Width = oldWidth; + BaseViewInfo.Height = oldHeight; + BaseViewInfo.ImageWidth = oldImageWidth; + BaseViewInfo.ImageHeight = oldImageHeight; SDL_Rect rect; @@ -123,11 +123,11 @@ void Text::Draw() } - SDL::RenderCopy(t, static_cast(BaseViewInfo.GetAlpha() * 255), &charRect, &rect, BaseViewInfo.GetAngle()); + SDL::RenderCopy(t, static_cast(BaseViewInfo.Alpha * 255), &charRect, &rect, BaseViewInfo.Angle); rect.x += static_cast(glyph.Advance * scale); - if((static_cast(rect.x) - xOrigin) > BaseViewInfo.GetMaxWidth()) + if((static_cast(rect.x) - xOrigin) > BaseViewInfo.MaxWidth) { break; } diff --git a/RetroFE/Source/Graphics/Component/VideoComponent.cpp b/RetroFE/Source/Graphics/Component/VideoComponent.cpp index ac90dc2..ad7d392 100644 --- a/RetroFE/Source/Graphics/Component/VideoComponent.cpp +++ b/RetroFE/Source/Graphics/Component/VideoComponent.cpp @@ -47,10 +47,10 @@ void VideoComponent::Update(float dt) VideoInst->Update(dt); // video needs to run a frame to start getting size info - if(BaseViewInfo.GetImageHeight() == 0 && BaseViewInfo.GetImageWidth() == 0) + if(BaseViewInfo.ImageHeight == 0 && BaseViewInfo.ImageWidth == 0) { - BaseViewInfo.SetImageHeight(static_cast(VideoInst->GetHeight())); - BaseViewInfo.SetImageWidth(static_cast(VideoInst->GetWidth())); + BaseViewInfo.ImageHeight = static_cast(VideoInst->GetHeight()); + BaseViewInfo.ImageWidth = static_cast(VideoInst->GetWidth()); } } @@ -89,16 +89,16 @@ void VideoComponent::Draw() { SDL_Rect rect; - rect.x = static_cast(BaseViewInfo.GetXRelativeToOrigin()); - rect.y = static_cast(BaseViewInfo.GetYRelativeToOrigin()); - rect.h = static_cast(BaseViewInfo.GetHeight()); - rect.w = static_cast(BaseViewInfo.GetWidth()); + rect.x = static_cast(BaseViewInfo.XRelativeToOrigin()); + rect.y = static_cast(BaseViewInfo.YRelativeToOrigin()); + rect.h = static_cast(BaseViewInfo.ScaledHeight()); + rect.w = static_cast(BaseViewInfo.ScaledWidth()); VideoInst->Draw(); SDL_Texture *texture = VideoInst->GetTexture(); if(texture) { - SDL::RenderCopy(texture, static_cast(BaseViewInfo.GetAlpha() * 255), NULL, &rect, static_cast(BaseViewInfo.GetAngle())); + SDL::RenderCopy(texture, static_cast(BaseViewInfo.Alpha * 255), NULL, &rect, static_cast(BaseViewInfo.Angle)); } } diff --git a/RetroFE/Source/Graphics/Page.cpp b/RetroFE/Source/Graphics/Page.cpp index 7878546..3b81833 100644 --- a/RetroFE/Source/Graphics/Page.cpp +++ b/RetroFE/Source/Graphics/Page.cpp @@ -143,7 +143,7 @@ bool Page::AddComponent(Component *c) { bool retVal = false; - unsigned int layer = c->BaseViewInfo.GetLayer(); + unsigned int layer = c->BaseViewInfo.Layer; if(layer < NUM_LAYERS) diff --git a/RetroFE/Source/Graphics/PageBuilder.cpp b/RetroFE/Source/Graphics/PageBuilder.cpp index 1582e5c..703819e 100644 --- a/RetroFE/Source/Graphics/PageBuilder.cpp +++ b/RetroFE/Source/Graphics/PageBuilder.cpp @@ -701,10 +701,10 @@ void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xm if(overrideItems.find(MENU_START) != overrideItems.end()) { xml_node<> *component = overrideItems[MENU_START]; - ViewInfo *viewInfo = CreateMenuItemInfo(component, itemDefaults, menu->BaseViewInfo.GetY() + height); + ViewInfo *viewInfo = CreateMenuItemInfo(component, itemDefaults, menu->BaseViewInfo.Y + height); points->push_back(viewInfo); tweenPoints->push_back(CreateTweenInstance(component)); - height += viewInfo->GetHeight(); + height += viewInfo->Height; // increment the selected index to account for the new "invisible" menu item selectedIndex++; @@ -724,9 +724,9 @@ void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xm BuildViewInfo(component, *viewInfo, itemDefaults); xml_attribute<> *itemSpacingXml = component->first_attribute("spacing"); int itemSpacing = itemSpacingXml ? Utils::ConvertInt(itemSpacingXml->value()) : 0; - float nextHeight = height + viewInfo->GetHeight() + itemSpacing; + float nextHeight = height + viewInfo->Height + itemSpacing; - if(nextHeight >= menu->BaseViewInfo.GetHeight()) + if(nextHeight >= menu->BaseViewInfo.Height) { end = true; } @@ -739,10 +739,10 @@ void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xm BuildViewInfo(component, *viewInfo, itemDefaults); xml_attribute<> *itemSpacingXml = component->first_attribute("spacing"); int itemSpacing = itemSpacingXml ? Utils::ConvertInt(itemSpacingXml->value()) : 0; - nextHeight = height + viewInfo->GetHeight() + itemSpacing; + nextHeight = height + viewInfo->Height + itemSpacing; } - viewInfo->SetY(menu->BaseViewInfo.GetY() + (float)height); + viewInfo->Y = menu->BaseViewInfo.Y + (float)height; points->push_back(viewInfo); tweenPoints->push_back(CreateTweenInstance(component)); index++; @@ -753,7 +753,7 @@ void PageBuilder::BuildVerticalMenu(ScrollingList *menu, xml_node<> *menuXml, xm if(overrideItems.find(MENU_END) != overrideItems.end()) { xml_node<> *component = overrideItems[MENU_END]; - ViewInfo *viewInfo = CreateMenuItemInfo(component, itemDefaults, menu->BaseViewInfo.GetY() + height); + ViewInfo *viewInfo = CreateMenuItemInfo(component, itemDefaults, menu->BaseViewInfo.Y + height); points->push_back(viewInfo); tweenPoints->push_back(CreateTweenInstance(component)); } @@ -781,7 +781,7 @@ ViewInfo *PageBuilder::CreateMenuItemInfo(xml_node<> *component, xml_node<> *def { ViewInfo *viewInfo = new ViewInfo(); BuildViewInfo(component, *viewInfo, defaults); - viewInfo->SetY(y); + viewInfo->Y = y; return viewInfo; } @@ -845,37 +845,37 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no xml_attribute<> *backgroundColor = FindAttribute(componentXml, "backgroundColor", defaultXml); xml_attribute<> *backgroundAlpha = FindAttribute(componentXml, "backgroundAlpha", defaultXml); - info.SetX(GetHorizontalAlignment(x, 0)); - info.SetY(GetVerticalAlignment(y, 0)); + info.X = GetHorizontalAlignment(x, 0); + info.Y = GetVerticalAlignment(y, 0); - info.SetXOffset( GetHorizontalAlignment(xOffset, 0)); - info.SetYOffset( GetVerticalAlignment(yOffset, 0)); + info.XOffset = GetHorizontalAlignment(xOffset, 0); + info.YOffset = GetVerticalAlignment(yOffset, 0); float xOriginRelative = GetHorizontalAlignment(xOrigin, 0); float yOriginRelative = GetVerticalAlignment(yOrigin, 0); // the origins need to be saved as a percent since the heights and widths can be scaled - info.SetXOrigin(xOriginRelative / ScreenWidth); - info.SetYOrigin(yOriginRelative / ScreenHeight); + info.XOrigin = xOriginRelative / ScreenWidth; + info.YOrigin = yOriginRelative / ScreenHeight; if(!height && !width) { - info.SetHeight(-1); - info.SetWidth(-1); + info.Height = -1; + info.Width = -1; } else { - info.SetHeight(GetVerticalAlignment(height, -1)); - info.SetWidth(GetHorizontalAlignment(width, -1)); + info.Height = GetVerticalAlignment(height, -1); + info.Width = GetHorizontalAlignment(width, -1); } - info.SetFontSize(GetVerticalAlignment(fontSize, -1)); - info.SetMinHeight(GetVerticalAlignment(minHeight, 0)); - info.SetMinWidth(GetHorizontalAlignment(minWidth, 0)); - info.SetMaxHeight(GetVerticalAlignment(maxHeight, FLT_MAX)); - info.SetMaxWidth(GetVerticalAlignment(maxWidth, FLT_MAX)); - info.SetAlpha( alpha ? Utils::ConvertFloat(alpha->value()) : 1); - info.SetAngle( angle ? Utils::ConvertFloat(angle->value()) : 0); - info.SetLayer( layer ? Utils::ConvertInt(layer->value()) : 0); + info.FontSize = GetVerticalAlignment(fontSize, -1); + info.MinHeight = GetVerticalAlignment(minHeight, 0); + info.MinWidth = GetHorizontalAlignment(minWidth, 0); + info.MaxHeight = GetVerticalAlignment(maxHeight, FLT_MAX); + info.MaxWidth = GetVerticalAlignment(maxWidth, FLT_MAX); + info.Alpha = alpha ? Utils::ConvertFloat(alpha->value()) : 1.f; + info.Angle = angle ? Utils::ConvertFloat(angle->value()) : 0.f; + info.Layer = layer ? Utils::ConvertInt(layer->value()) : 0; if(backgroundColor) { @@ -886,14 +886,14 @@ void PageBuilder::BuildViewInfo(xml_node<> *componentXml, ViewInfo &info, xml_no int green = (num / 0x100) % 0x100; int blue = num % 0x100; - info.SetBackgroundRed(static_cast(red)/255); - info.SetBackgroundGreen(static_cast(green)/255); - info.SetBackgroundBlue(static_cast(blue)/255); + info.BackgroundRed = static_cast(red/255); + info.BackgroundGreen = static_cast(green/255); + info.BackgroundBlue = static_cast(blue/255); } if(backgroundAlpha) { - info.SetBackgroundAlpha( backgroundAlpha ? Utils::ConvertFloat(backgroundAlpha->value()) : 1); + info.BackgroundAlpha = backgroundAlpha ? Utils::ConvertFloat(backgroundAlpha->value()) : 1.f; } } diff --git a/RetroFE/Source/Graphics/ViewInfo.cpp b/RetroFE/Source/Graphics/ViewInfo.cpp index 66b4b56..0b198f9 100644 --- a/RetroFE/Source/Graphics/ViewInfo.cpp +++ b/RetroFE/Source/Graphics/ViewInfo.cpp @@ -50,20 +50,20 @@ ViewInfo::~ViewInfo() { } -float ViewInfo::GetXRelativeToOrigin() const +float ViewInfo::XRelativeToOrigin() const { - return X + XOffset - XOrigin*GetWidth(); + return X + XOffset - XOrigin*ScaledWidth(); } -float ViewInfo::GetYRelativeToOrigin() const +float ViewInfo::YRelativeToOrigin() const { - return Y + YOffset - YOrigin*GetHeight(); + return Y + YOffset - YOrigin*ScaledHeight(); } -float ViewInfo::GetHeight() const +float ViewInfo::ScaledHeight() const { - float height = GetAbsoluteHeight(); - float width = GetAbsoluteWidth(); + float height = AbsoluteHeight(); + float width = AbsoluteWidth(); if (height < MinHeight || width < MinWidth) { @@ -105,10 +105,10 @@ float ViewInfo::GetHeight() const return height; } -float ViewInfo::GetWidth() const +float ViewInfo::ScaledWidth() const { - float height = GetAbsoluteHeight(); - float width = GetAbsoluteWidth(); + float height = AbsoluteHeight(); + float width = AbsoluteWidth(); if (height < MinHeight || width < MinWidth) { @@ -150,7 +150,7 @@ float ViewInfo::GetWidth() const return width; } -float ViewInfo::GetAbsoluteHeight() const +float ViewInfo::AbsoluteHeight() const { if(Height == -1 && Width == -1) { @@ -165,7 +165,7 @@ float ViewInfo::GetAbsoluteHeight() const return Height; } -float ViewInfo::GetAbsoluteWidth() const +float ViewInfo::AbsoluteWidth() const { if(Height == -1 && Width == -1) { @@ -179,245 +179,3 @@ float ViewInfo::GetAbsoluteWidth() const return Width; } - - -float ViewInfo::GetXOffset() const -{ - return XOffset; -} - - -float ViewInfo::GetXOrigin() const -{ - return XOrigin; -} - - -float ViewInfo::GetYOffset() const -{ - return YOffset; -} - - -float ViewInfo::GetYOrigin() const -{ - return YOrigin; -} - -float ViewInfo::GetAngle() const -{ - return Angle; -} - -void ViewInfo::SetAngle(float angle) -{ - Angle = angle; -} - -float ViewInfo::GetImageHeight() const -{ - return ImageHeight; -} - -void ViewInfo::SetImageHeight(float imageheight) -{ - ImageHeight = imageheight; -} - -float ViewInfo::GetImageWidth() const -{ - return ImageWidth; -} - -void ViewInfo::SetImageWidth(float imagewidth) -{ - ImageWidth = imagewidth; -} - -unsigned int ViewInfo::GetLayer() const -{ - return Layer; -} - -void ViewInfo::SetLayer(unsigned int layer) -{ - Layer = layer; -} - -float ViewInfo::GetMaxHeight() const -{ - return MaxHeight; -} - -void ViewInfo::SetMaxHeight(float maxheight) -{ - MaxHeight = maxheight; -} - -float ViewInfo::GetMaxWidth() const -{ - return MaxWidth; -} - -void ViewInfo::SetMaxWidth(float maxwidth) -{ - MaxWidth = maxwidth; -} - -float ViewInfo::GetMinHeight() const -{ - return MinHeight; -} - -void ViewInfo::SetMinHeight(float minheight) -{ - MinHeight = minheight; -} - -float ViewInfo::GetMinWidth() const -{ - return MinWidth; -} - -void ViewInfo::SetMinWidth(float minwidth) -{ - MinWidth = minwidth; -} - -float ViewInfo::GetAlpha() const -{ - return Alpha; -} - -void ViewInfo::SetAlpha(float alpha) -{ - Alpha = alpha; -} - -float ViewInfo::GetX() const -{ - return X; -} - -void ViewInfo::SetX(float x) -{ - X = x; -} - -void ViewInfo::SetXOffset(float offset) -{ - XOffset = offset; -} - - -void ViewInfo::SetXOrigin(float origin) -{ - XOrigin = origin; -} - -float ViewInfo::GetY() const -{ - return Y; -} - -void ViewInfo::SetY(float y) -{ - Y = y; -} - -void ViewInfo::SetYOffset(float offset) -{ - YOffset = offset; -} - - -void ViewInfo::SetYOrigin(float origin) -{ - YOrigin = origin; -} - -float ViewInfo::GetRawYOrigin() -{ - return YOrigin; -} -float ViewInfo::GetRawXOrigin() -{ - return XOrigin; -} - -float ViewInfo::GetRawWidth() -{ - return Width; -} - -float ViewInfo::GetRawHeight() -{ - return Height; -} - -void ViewInfo::SetHeight(float height) -{ - Height = height; -} - -void ViewInfo::SetWidth(float width) -{ - Width = width; -} - -float ViewInfo::GetFontSize() const -{ - if(FontSize == -1) - { - return GetHeight(); - } - else - { - return FontSize; - } -} - -void ViewInfo::SetFontSize(float fontSize) -{ - FontSize = fontSize; -} - - -float ViewInfo::GetBackgroundRed() -{ - return BackgroundRed; -} - -void ViewInfo::SetBackgroundRed(float value) -{ - BackgroundRed = value; -} - -float ViewInfo::GetBackgroundGreen() -{ - return BackgroundGreen; -} - -void ViewInfo::SetBackgroundGreen(float value) -{ - BackgroundGreen = value; -} -float ViewInfo::GetBackgroundBlue() -{ - return BackgroundBlue; -} - -void ViewInfo::SetBackgroundBlue(float value) -{ - BackgroundBlue = value; -} - -float ViewInfo::GetBackgroundAlpha() -{ - return BackgroundAlpha; -} - -void ViewInfo::SetBackgroundAlpha(float value) -{ - BackgroundAlpha = value; -} \ No newline at end of file diff --git a/RetroFE/Source/Graphics/ViewInfo.h b/RetroFE/Source/Graphics/ViewInfo.h index dab7166..38c43f8 100644 --- a/RetroFE/Source/Graphics/ViewInfo.h +++ b/RetroFE/Source/Graphics/ViewInfo.h @@ -26,60 +26,11 @@ public: ViewInfo(); virtual ~ViewInfo(); - float GetXRelativeToOrigin() const; - float GetYRelativeToOrigin() const; + float XRelativeToOrigin() const; + float YRelativeToOrigin() const; - float GetHeight() const; - float GetWidth() const; - - float GetAngle() const; - void SetAngle(float angle); - float GetImageHeight() const; - void SetImageHeight(float imageheight); - float GetImageWidth() const; - void SetImageWidth(float imagewidth); - unsigned int GetLayer() const; - void SetLayer(unsigned int layer); - float GetMaxHeight() const; - void SetMaxHeight(float maxheight); - float GetMaxWidth() const; - void SetMaxWidth(float maxwidth); - float GetMinHeight() const; - void SetMinHeight(float minheight); - float GetMinWidth() const; - void SetMinWidth(float minwidth); - float GetAlpha() const; - void SetAlpha(float alpha); - float GetX() const; - void SetX(float x); - float GetXOffset() const; - void SetXOffset(float offset); - float GetXOrigin() const; - void SetXOrigin(float origin); - float GetY() const; - void SetY(float y); - float GetYOffset() const; - void SetYOffset(float offset); - float GetYOrigin() const; - void SetYOrigin(float origin); - float GetRawYOrigin(); - float GetRawXOrigin(); - float GetRawWidth(); - float GetRawHeight(); - - float GetBackgroundRed(); - void SetBackgroundRed(float value); - float GetBackgroundGreen(); - void SetBackgroundGreen(float value); - float GetBackgroundBlue(); - void SetBackgroundBlue(float value); - float GetBackgroundAlpha(); - void SetBackgroundAlpha(float value); - - void SetHeight(float height); - void SetWidth(float width); - float GetFontSize() const; - void SetFontSize(float fontSize); + float ScaledHeight() const; + float ScaledWidth() const; static const int AlignCenter = -1; static const int AlignLeft = -2; @@ -87,9 +38,6 @@ public: static const int AlignRight = -4; static const int AlignBottom = -5; -private: - float GetAbsoluteHeight() const; - float GetAbsoluteWidth() const; float X; float Y; float XOrigin; @@ -114,4 +62,8 @@ private: float BackgroundGreen; float BackgroundBlue; float BackgroundAlpha; + +private: + float AbsoluteHeight() const; + float AbsoluteWidth() const; };