Exemple #1
1
 //constructor
 //Possibly requires explicit keyword
 public Aircraft(Type type, ResourceHolder<Texture, ResourceID> textures)
 {
     mType = type;
     mSprite = new Sprite(textures.get(toTextureID(type)));
     FloatRect bounds = mSprite.GetLocalBounds();
     mSprite.Origin = new Vector2f(bounds.Width / 2, bounds.Height / 2);
 }
        public Button(ResourceHolder<Font, FontID> fonts, ResourceHolder<Texture, ResourceID> textures) 
        {
            //ACTION IS NOT INITIALIZED
            mNormalTexture = new Texture(textures.get(ResourceID.ButtonNormal));
            mSelectedTexture = new Texture(textures.get(ResourceID.ButtonSelected));
            mPressedTexture = new Texture(textures.get(ResourceID.ButtonPressed));

            mSprite = new Sprite(mNormalTexture);

            mText = new Text("", fonts.get(FontID.Main), 16);
            mIsToggle = false;

            FloatRect bounds = mSprite.GetLocalBounds();
            mText.Position = new Vector2f(bounds.Width / 2, bounds.Height / 2);
        }
 public TextNode(ResourceHolder<Font, FontID> fonts, string text) 
 {
     mText = new Text();
     mText.Font = fonts.get(FontID.Main);
     mText.DisplayedString = text;
     mText.CharacterSize = 20;
        
 }
 public Projectile(Type type, ResourceHolder<Texture, ResourceID> textures):base(1) //I don't know how much HP there is
 {
     mType = type;
     mSprite = new Sprite(textures.get(Table[(int)type].texture));
     
     mSprite.centerOrigin();
     mTargetDirection = new Vector2f();
     
 }
        public Aircraft(Type type, ResourceHolder<Texture, ResourceID> textures, ResourceHolder<Font,FontID> fonts) :base(Table[(int)type].hitpoints)
        { 
            mType = type; 
            mSprite = new Sprite(textures.get(toTextureID(type)));
            FloatRect bounds = mSprite.GetLocalBounds();
            mSprite.Origin = new Vector2f(bounds.Width / 2, bounds.Height / 2);

            TextNode healthDisplay = new TextNode(fonts, " "); ;
            mHealthDisplay = healthDisplay;
            attachChild(healthDisplay);

            mTravelledDistance = 0;
            mDirectionIndex = 0;

            mIsFiring = false;
            mIsLaunchingMissile = false;
            MissileAmmo = 3;
            mIsMarkedForRemoval = false;
            mFireCountdown = Time.Zero;
            mFireRateLevel = 1;
            mSpreadLevel = 1;

            mFireCommand = new Command();
            mFireCommand.category = (uint)Category.PlayerAircraft;
            mFireCommand.actionfunc = (SceneNode node, Time time) =>
            {
                SceneNode aircraft = (Aircraft)node;
                createBullets(aircraft, textures);
            };

            mLaunchCommand = new Command();
        }
Exemple #6
0
 public Label(string text, ResourceHolder<Font, FontID> fonts) 
 {
     mText = new Text(text, fonts.get(FontID.Main), 16);
 }