XNA Creators Club Online
Page 1 of 1 (2 items)
Sort Posts: Previous Next

Change enum state in a pointer parameter

Last post 12/4/2008 12:42 PM by Rinse. 1 replies.
  • 12/4/2008 8:43 AM

    Change enum state in a pointer parameter

    I have a problem in passing enum variable as parameter.

    In game1.cs
            enum statoProgramma  
            { 
                schermataIniziale = 1, 
                menuPrincipale, 
                impostazioniGioco, 
                finestraDiGioco 
            } 
     
    [...] 
            protected override void Update(GameTime gameTime) 
            { 
                if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) 
                    this.Exit(); 
     
                selezioneStato = eventiInput.moveCursor(ref correnteStatoProgramma); 
     
                base.Update(gameTime); 
            } 

    And this is a part of Input.cs

           public Vector2 moveCursor(ref correnteStatoProgramma) 
            { 
                keyboardState= Keyboard.GetState(); 
     
                if (keyboardState.IsKeyDown(Keys.Enter) == true) correnteStatoProgramma = statoProgramma.finestraDiGioco; 

    I want to change the enum state in the game1.cs using a pointer of enum passed in a parameter, how can I do?



  • 12/4/2008 12:42 PM In reply to

    Re: Change enum state in a pointer parameter

    Hmm, you don't say what the nature of the problem is, but at first glance my guess is just a misformed function.

    public Vector2 moveCursor(ref statoProgramma correnteStatoProgramma)    
    {    
        keyboardState= Keyboard.GetState();    
        
        if (keyboardState.IsKeyDown(Keys.Enter) == true)  
            correnteStatoProgramma = statoProgramma.finestraDiGioco;    
    ...  
    }  
     

    In your code, argument to the function doesnt have a function type, just an identifier.
    When does a game stop being a game and become Skynet? WHEN, LORD? WHEN?
Page 1 of 1 (2 items) Previous Next