Guest User

object.ci

a guest
Aug 21st, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 1.17 KB | None | 0 0
  1.  
  2. public class GameObj
  3. {
  4.     int x;
  5.     int y;
  6.  
  7.     bool isAllocated;
  8.    
  9.     /// Constructor
  10.     GameObj()
  11.     {
  12.         Debug.Print("GameObj()\n");
  13.         x = y = 0;
  14.         isAllocated = false;
  15.     }
  16.  
  17.     public virtual void Move()
  18.     {
  19.         // implementation        
  20.         Debug.Print("GameObj.Move()\n");            
  21.     }
  22.    
  23.     public virtual void Draw()
  24.     {
  25.         // implementation
  26.         Platform.Draw(this);
  27.        
  28.     }
  29.  
  30. }
  31.  
  32.  
  33.  
  34. public class MovingGameObj : GameObj
  35. {
  36.  
  37.     int xvel;
  38.     int yvel;
  39.    
  40.     /// Constructor
  41.     MovingGameObj()
  42.     {
  43.         Debug.Print("MovingGameObj()\n");
  44.         xvel = yvel = 0;
  45.     }
  46.  
  47.     public override void Move()
  48.     {        
  49.         Debug.Print("MovingGameObj.Move()\n");            
  50.         // implementation
  51.         x += xvel;
  52.         y += yvel;
  53.        
  54.        
  55.     }
  56.    
  57.  
  58.     public override void Draw()
  59.     {        
  60.         Debug.Print("MovingGameObj.Draw()\n");            
  61.  
  62.        
  63.        
  64.     }
  65.  
  66. }
  67.  
  68.  
  69.  
  70. public class Debug
  71. {
  72.    
  73.     public static void Print(string s)
  74.     {
  75.         native {  
  76.             printf(s);    
  77.         }
  78.     }
  79. }
Advertisement
Add Comment
Please, Sign In to add comment