How do I create window height and window width in visual c# 2008?

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Devin Allen
    New Member
    • Dec 2010
    • 1

    How do I create window height and window width in visual c# 2008?

    using System;
    using System.Collecti ons.Generic;
    using System.Linq;
    using System.Text;
    using Microsoft.Xna.F ramework;
    using Microsoft.Xna.F ramework.Audio;
    using Microsoft.Xna.F ramework.Conten t;
    using Microsoft.Xna.F ramework.GamerS ervices;
    using Microsoft.Xna.F ramework.Graphi cs;
    using Microsoft.Xna.F ramework.Input;
    using Microsoft.Xna.F ramework.Media;
    using Microsoft.Xna.F ramework.Net;
    using Microsoft.Xna.F ramework.Storag e;

    namespace SimplePlayer1
    {

    class Player
    {
    Vector2 position;
    Texture2D shipSprite;
    Vector2 spriteOrigin;
    int windowWidth, windowHeight;

    public Player(Graphics Device devic, Vector2 position, Texture2D sprite)
    {
    //The position that is passed in is now set to the position above
    this.position = position;

    //Set the Texture2D
    shipSprite = sprite;

    //Setup origin
    spriteOrigin.X = (float)shipSpri te.Width / 2.0f;
    spriteOrigin.Y = (float)shipSpri te.Height / 2.0f;

    windowHeight = device.Viewport .Height;
    windowWidth = device.Viewport .Width;

    }
    }
    }

    When I type in the code it comes up with an error that says the name device does not exist in the current context.

    Please help
  • GaryTexmo
    Recognized Expert Top Contributor
    • Jul 2009
    • 1501

    #2
    public Player(Graphics Device devic, Vector2 position, Texture2D sprite)
    Looks like you've got a typo there :)

    Comment

    Working...