本文整理汇总了C#中SFML.Graphics.Text.centerOrigin方法的典型用法代码示例。如果您正苦于以下问题:C# Text.centerOrigin方法的具体用法?C# Text.centerOrigin怎么用?C# Text.centerOrigin使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.Text
的用法示例。
在下文中一共展示了Text.centerOrigin方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: PauseState
public PauseState(StateStack stack, Context context)
: base(stack, context)
{
RenderWindow window = mContext.window;
mBackgroundSprite = new Sprite();
mPausedText = new Text();
mInstructionText = new Text();
mPausedText.Font = mContext.fonts.get(FontID.Main);
mPausedText.DisplayedString = "Game Paused";
mPausedText.CharacterSize = 70;
mPausedText.centerOrigin();
mPausedText.Position = new Vector2f(0, 0);
mInstructionText.Font = mContext.fonts.get(FontID.Main);
mInstructionText.DisplayedString = "(Press Backspace to return to main menu)";
mInstructionText.centerOrigin();
mInstructionText.Position = new Vector2f(0, 0);
backgroundShape = new RectangleShape();
backgroundShape.FillColor = new Color(0, 0, 0, 150);
backgroundShape.Position = window.GetView().Center;
backgroundShape.centerOrigin();
backgroundShape.Size = window.GetView().Size;
}
示例2: TitleState
public TitleState(StateStack stack, Context context)
: base(stack, context)
{
mTextEffectTime = Time.Zero;
mShowText = true;
mText = new Text();
mText.Font = mContext.fonts.get(FontID.Main);
mText.DisplayedString = "Press any key to start";
//sets origin to center
FloatRect bounds = mText.GetLocalBounds();
mText.centerOrigin();
mText.Position = mContext.window.getCenter();
mBackgroundSprite = new Sprite(mContext.textures.get(ResourceID.TitleScreen));
}
示例3: TitleState
public TitleState(StateStack stack, Context context)
: base(stack, context)
{
starttimer = new Clock();
starttimer.Restart();
titletext = new Text();
titletext.Scale = new Vector2f(2, 2);
titletext.DisplayedString = "PIXELTASIM";
titletext.Font = mContext.mFonts.get(FontID.Title);
titletext.centerOrigin();
titletext.Position = new Vector2f(mContext.mWindow.Size.X/2, mContext.mWindow.Size.Y / 8);
titletext.Color = Color.Black;
square = new RectangleShape(new Vector2f(UnitConverter.toPixScale(0.5f), UnitConverter.toPixScale(0.5f)));
square.centerOrigin();
square.FillColor = Color.Red;
square.OutlineColor = Color.Black;
square.OutlineThickness = 1;
b2World = new World(new Vec2(0, 10), false);
BodyDef b2Def = new BodyDef();
b2Def.BodyType = BodyType.Dynamic;
b2Def.Position = new Vec2(UnitConverter.toSimScale(mContext.mWindow.Size.X / 2), UnitConverter.toSimScale(mContext.mWindow.Size.Y / 8*3));
b2Body = b2World.CreateBody(b2Def);
PolygonShape dynamicbox = new PolygonShape();
dynamicbox.SetAsBox(UnitConverter.toSimScale(32), UnitConverter.toSimScale(32));
FixtureDef fixDef = new FixtureDef();
fixDef.Shape = dynamicbox;
fixDef.Density = 1;
fixDef.Friction = 0.3f;
b2Body.CreateFixture(fixDef);
square.Position = new Vector2f(UnitConverter.toPixScale(b2Body.Position.X), UnitConverter.toPixScale(b2Body.Position.Y));
}