• WP7备注(2)(XNA基本元素)


    GraphicsDeviceManager :

    以XNA为基础的游戏程序必须在初始化的时候声明GraphicsDeviceManager的对象,并设定游戏界面的高度与宽度:

    GraphicsDeviceManager graphics;

    graphics = new GraphicsDeviceManager(this);

    graphics.PreferredBackBufferHeight = 480;

    graphics.PreferredBackBufferWidth = 800;

    GraphicsDevice:

    Buffer背景颜色

    GraphicsDevice.Clear(Color color)

    SpriteBatch:

    SpriteBatch 主要显示2D图像,包括游戏背景、游戏人物、游戏的状态和菜单

    SpriteBatch spriteBatch;

    spriteBatch = new SpriteBatch(GraphicsDevice);

    SpriteBatch 进行DrawString

    spriteBatch.Begin();

    spriteBatch.DrawString(segoe14, text, textPosition, Color.White);

    spriteBatch.End();

    Viewport:

    Viewport主要表示一个二维的Rectangle(X,Y,Width,Height)

    获取设备的Viewport:

    Viewport viewport = this.GraphicsDevice.Viewport;

    SpriteFont:

    加载:SpriteFont spriteFont= this.Content.Load<SpriteFont>("spriteFont");

    Texture2D:

    Texture2D segoe14 = this.Content.Load<Texture2D>("texture2D");

    SoundEffect:

    SoundEffect soundEffect= ScreenManager.Game.Content.Load<SoundEffect>("soundEffect");

    Vector2:

    获取SpriteFont描述的字体对于相应文本所占有的二维空间坐标(X,Y)

    Vector2 textPosition = spriteFont.MeasureString(text)

  • 相关阅读:
    因数最多的数
    剪枝策略
    计蒜客 引爆炸弹(DFS、并查集)
    计蒜客 方程的解数(DFS)
    计蒜客 数独(DFS)
    计蒜客 王子救公主(DFS)
    kuangbin专题 专题九 连通图 POJ 3694 Network
    2019 ICPC Asia Nanjing Regional K. Triangle
    HDU 1875 畅通工程再续
    还是畅通工程 HDU
  • 原文地址:https://www.cnblogs.com/otomii/p/2029092.html
Copyright © 2020-2023  润新知