// Copyright (c) 2014-2015, THUNDERBEAST GAMES LLC All rights reserved // Please see LICENSE.md in repository root for license information // https://github.com/AtomicGameEngine/AtomicGameEngine #include "AtomicEditor.h" #include #include #include #include #include #include #include #include #include #include #include "UI/Modal/UIModalOps.h" #include "License/AELicenseSystem.h" #include "AEEditor.h" #include "AEEvents.h" #include "UIPlayer.h" namespace Atomic { void FixMeSetLight2DGroupViewport(Viewport *viewport); } namespace AtomicEditor { // UIBuildSettings------------------------------------------------ UIPlayer::UIPlayer(Context* context): UIModalOpWindow(context) { aePlayer_ = GetSubsystem(); aePlayer_->SetUIPlayer(this); UI* tbui = GetSubsystem(); window_->SetSettings(WINDOW_SETTINGS_DEFAULT & ~WINDOW_SETTINGS_CLOSE_BUTTON); window_->SetText("Atomic Player"); tbui->LoadResourceFile(window_->GetContentRoot(), "AtomicEditor/editor/ui/playerwidget.tb.txt"); Graphics* graphics = GetSubsystem(); float gwidth = graphics->GetWidth(); float aspect = float(graphics->GetHeight())/ gwidth; gwidth -= 150; playerSize_.x_ = gwidth; playerSize_.y_ = gwidth * aspect; TBLayout* playercontainer = window_->GetWidgetByIDAndType(TBIDC("playerlayout")); assert(playercontainer); window_->ResizeToFitContent(); Center(); SubscribeToEvent(E_UPDATE, HANDLER(UIPlayer, HandleUpdate)); } UIPlayer::~UIPlayer() { } void UIPlayer::HandleUpdate(StringHash eventType, VariantMap& eventData) { } bool UIPlayer::OnEvent(const TBWidgetEvent &ev) { if (ev.type == EVENT_TYPE_CLICK) { if (ev.target->GetID() == TBIDC("play")) { if (GetSubsystem()->IsPlayingProject()) { SendEvent(E_EDITORPLAYSTOP); return true; } } } return true; } }