bool EditBoxLayer::Initialize() { RETURN_FALSE_IF_FALSE(BaseCaseLayer::Initialize()); INode* sprite=NodeFactory::Instance().CreateSingleLineEditBox(msize(500,180), FontId("PaperBlack.ttf",96),L"ABC"); sprite->SetDock(DockPoint::MiddleCenter); sprite->SetAnchor(0.5f, 0.5f); AddChild(sprite); return true; }
bool BaseCaseLayer::Initialize() { RETURN_FALSE_IF_FALSE(ILayer::Initialize()); HeapString title = Class().Name(); title.RemoveLast("Layer"); ILabel* label = NodeFactory::Instance().CreateSingleLineLabel(FontId("arial22.fnt"), title, Alignment::LeftBottom, Size2U::Zero, true); label->SetDock(DockPoint::MiddleTop); label->SetAnchorPoint(AnchorPoint::MiddleTop); label->SetLogicZ(9999); AddChild(label); return true; }
void ApplicationStatics::UpdateLabels() { mRenderQueueChanged |= RenderableChangedFlags::RenderQueueChanged | RenderableChangedFlags::BatchChanged; if (IsShowGPU()) { if (mGPULabel == nullptr) { StringRef versionStr = Render::Instance().GetString(GraphicsStringName::Version); StringRef vendorStr = Render::Instance().GetString(GraphicsStringName::Vendor); StringRef shaderLanguageVersionStr = Render::Instance().GetString(GraphicsStringName::ShaderLanguageVersion); StringRef renderStr = Render::Instance().GetString(GraphicsStringName::Renderer); int textureSize = Render::Instance().GetInteger(GraphicsIntegerName::MaxTextureSize); Rect2I viewPort; Render::Instance().GetIntegerArray(GraphicsIntegerArrayName::Viewport, (int*)&viewPort); HeapString text; text.AppendLine(versionStr); text.AppendLine(vendorStr); text.AppendLine(renderStr); text.AppendLine(shaderLanguageVersionStr); text.AppendFormat("MaxTextureSize:{}", textureSize); text.AppendLine(); text.AppendFormat("ViewPort:{},{} {}*{}", viewPort.Origin.X, viewPort.Origin.Y, viewPort.Size.Width, viewPort.Size.Height); mGPULabel = NodeFactory::Instance().CreateMultipleLineLabel(FontId("arial22.fnt", 22), text.c_str(), Alignment::LeftTop, Size2U::Zero, true); mGPULabel->EnableLayout(false); mGPULabel->SetRenderingStrategy(RenderingStrategy::SingleStaticBatch); const Size2F& screenSize = ResolutionAdapter::Instance().WinSize(); mGPULabel->SetAnchor(Point3F(0.f, 1.f, 0.f)); //mGPULabel->SetDockPoint(DockPoint::LeftTop); mGPULabel->SetPosition(Point3F(0.f, (float)screenSize.Height, 0.f)); mGPULabel->ForceUpdateRenderState(); mRenderQueue->AddNode(mGPULabel); } } else { if (mGPULabel!=nullptr) { mRenderQueue->RemoveNode(mGPULabel); } SAFE_DELETE(mGPULabel); } if (IsShowPerformance()) { if (mPerformanceLabel == nullptr) { mPerformanceLabel = NodeFactory::Instance().CreateMultipleLineLabel(FontId("arial22.fnt", 22), "6\n123.4567\n52.3"); mPerformanceLabel->EnableLayout(false); mPerformanceLabel->SetDock(DockPoint::LeftBottom); mPerformanceLabel->SetAnchorPoint(AnchorPoint::LeftBottom); mPerformanceLabel->ForceUpdateRenderState(); //mPerformanceLabel=NodeFactory::Instance().CreateSingleLineLabel("MedusaFPSLabel",FontInfo("fps","arial22.fnt"),"6\n123.4567\n52.3"); mRenderQueue->AddNode(mPerformanceLabel); } } else { if (mPerformanceLabel != nullptr) { mRenderQueue->RemoveNode(mPerformanceLabel); } SAFE_DELETE(mPerformanceLabel); } if (IsShowTouch()) { if (mDebugLabel == nullptr) { mDebugLabel = NodeFactory::Instance().CreateSingleLineLabel(FontId("arial22.fnt", 22), ","); mDebugLabel->EnableLayout(false); mDebugLabel->SetAnchorPoint(AnchorPoint::RightBottom); const Size2F& screenSize = ResolutionAdapter::Instance().WinSize(); mDebugLabel->SetPosition(Point3F((float)screenSize.Width, 0.f, 0.f)); mDebugLabel->ForceUpdateRenderState(); mRenderQueue->AddNode(mDebugLabel); } } else { if (mDebugLabel != nullptr) { mRenderQueue->RemoveNode(mDebugLabel); } SAFE_DELETE(mDebugLabel); } }