pingus-cvs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Pingus-CVS] CVS: Games/Pingus/src GameDelta.hh,NONE,1.1 GameEvent.hh,NO


From: grumbel
Subject: [Pingus-CVS] CVS: Games/Pingus/src GameDelta.hh,NONE,1.1 GameEvent.hh,NONE,1.1 InputEvent.hh,NONE,1.1 Screen.cc,NONE,1.1 Screen.hh,NONE,1.1 ScreenManager.cc,NONE,1.1 ScreenManager.hh,NONE,1.1
Date: 11 Jun 2002 13:24:54 -0000

Update of /usr/local/cvsroot/Games/Pingus/src
In directory dark:/tmp/cvs-serv14713

Added Files:
        GameDelta.hh GameEvent.hh InputEvent.hh Screen.cc Screen.hh 
        ScreenManager.cc ScreenManager.hh 
Log Message:
some event handling ideas

--- NEW FILE: GameDelta.hh ---
//  $Id: GameDelta.hh,v 1.1 2002/06/11 13:24:52 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef GAMEDELTA_HH
#define GAMEDELTA_HH

namespace Pingus 
{
  class GameDelta
  {
  private:
    
  public:
    /**  */
    Event peek_event ();

    /**  */
    Event pop_event ();
    
    /** Return the time that has passed in seconds */
    float get_time ();
  };
}

#endif

/* EOF */

--- NEW FILE: GameEvent.hh ---
//  $Id: GameEvent.hh,v 1.1 2002/06/11 13:24:52 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef EVENT_HH
#define EVENT_HH

/** This will need some^H^H^H^H a lot of work */
typedef enum {
  /** Pointer Events (pos contains the move-delta) */

} GameEventType;

class GameEvent
{
public:
  /** When should the action happen? */
  int time_stamp;
};

class PinguGameEvent : public GameEvent
{
  /** The id of the pingu to which this action should apply
  int pingu_id;
  
  /** The action to apply to the pingu */
  std::string action;
};

class ArmageddonGameEvent : public GameEvent
{
  // nothing
};

#endif

/* EOF */

--- NEW FILE: InputEvent.hh ---
//  $Id: InputEvent.hh,v 1.1 2002/06/11 13:24:52 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef INPUTEVENT_HH
#define INPUTEVENT_HH

/** This will need some^H^H^H^H a lot of work */
typedef enum {
  /** Pointer Events (pos contains the move-delta) */
  MOUSE_MOVE,
  
  /** The scroll controll has been move, in theory this could be a
      second mouse, an second analog stick or a combination of button
      press and cursor movement */
  SCROLL_MOVE,

  /*** Generic button events (pos contains position) */
  PRIMARY_BUTTON_PRESSED,
  SECONDARY_BUTTON_PRESSED,
  
  /** Escape is pressed */
  ESCAPE_TRIGGERED,
  
  /** 'p' or 'Pause' got pressed */
  PAUSE_PRESSED,
  
  /** Buttons for switching to the next/previous Action */
  ACTION_UP,
  ACTION_DOWN,
  
  /** Action selected, Most likly one of the F1-F?? buttons is
      pressed, this could also be a combination of shift-button or
      something else */
  ACTION_SELECTED

} InputEventType;


class InputEvent
{
public:
  /** Position or movement */
  CL_Vector pos;
  
  /** integer data */
  int data;
  
  /** The type of event */
  EventType type;

  /** The 'owner' or player of this event */
  int owner;
};

#endif

/* EOF */

--- NEW FILE: Screen.cc ---
//  $Id: Screen.cc,v 1.1 2002/06/11 13:24:52 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "Screen.hh"

using namespace Pingus;

/* EOF */

--- NEW FILE: Screen.hh ---
//  $Id: Screen.hh,v 1.1 2002/06/11 13:24:52 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SCREEN_HH
#define SCREEN_HH

#include "GameDelta.hh"

namespace Pingus
{
  /** A interface for screens. A screen is a Pingus 'thing' which gets
      complete controll over the display and input. Examples of
      screens are the PingusMenu or a PingusGameSession */
  class Screen
  {
  private:
    
  public:
    /** Draw this screen */
    void draw () =0;

    /** Pass a delta to the screen */
    void update (const GameDelta& delta) =0;
  };
}

#endif

/* EOF */

--- NEW FILE: ScreenManager.cc ---
//  $Id: ScreenManager.cc,v 1.1 2002/06/11 13:24:52 grumbel Exp $
//
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#include "ScreenManager.cc"

ScreenManager::ScreenManager ()
{
}

ScreenManager::~ScreenManager ()
{
}

void
ScreenManager::display ()
{
  while (screen_stack.size () > 0)
    {
      Screen* screen = screen_stack.top ();

      screen->draw ();
      screen->update ();
    }
}

int 
ScreenManager::number_of_screens ()
{
  return screen_stack.size ();
}

void
ScreenManager::push_screen (Screen* screen)
{
  screen_stack.push (screen);
}

void
ScreenManager::pop_screen ()
{
  screen_stack.pop ();
}

/* EOF */

--- NEW FILE: ScreenManager.hh ---
//  $Id: ScreenManager.hh,v 1.1 2002/06/11 13:24:52 grumbel Exp $
// 
//  Pingus - A free Lemmings clone
//  Copyright (C) 2000 Ingo Ruhnke <address@hidden>
//
//  This program is free software; you can redistribute it and/or
//  modify it under the terms of the GNU General Public License
//  as published by the Free Software Foundation; either version 2
//  of the License, or (at your option) any later version.
//
//  This program is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
// 
//  You should have received a copy of the GNU General Public License
//  along with this program; if not, write to the Free Software
//  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.

#ifndef SCREENMANAGER_HH
#define SCREENMANAGER_HH

namespace Pingus
{
  class ScreenManager
  {
  private:
    /** The stack of screens */
    std::stack<Screen*> screen_stack;
  public:
    ScreenManager ();
    ~ScreenManager ();

    /** Start the screen manager and let it take controll, this will
        not return until the screen stack is empty. */
    void display ();

    int number_of_screens ();

    /** Replace the current screen */
    void replace_screen (Screen*);
    
    /** Add a screen on top of another screen */
    void push_screen (Screen*);

    /** Remove the current screen */
    void pop_screen ();
  };
  
}

#endif

/* EOF */




reply via email to

[Prev in Thread] Current Thread [Next in Thread]