home *** CD-ROM | disk | FTP | other *** search
/ NEXT Generation 27 / NEXT27.iso / pc / demos / emperor / dx3.exe / SDK / SAMPLES / IKLOWNS / CGGRAPH.H < prev    next >
C/C++ Source or Header  |  1996-08-28  |  3KB  |  121 lines

  1. /*===========================================================================*\
  2. |
  3. |  File:        cggraph.h
  4. |
  5. |  Description: 
  6. |       
  7. |-----------------------------------------------------------------------------
  8. |
  9. |  Copyright (C) 1995-1996 Microsoft Corporation.  All Rights Reserved.
  10. |
  11. |  Written by Moss Bay Engineering, Inc. under contract to Microsoft Corporation
  12. |
  13. \*===========================================================================*/
  14.  
  15. /**************************************************************************
  16.  
  17.     (C) Copyright 1995-1996 Microsoft Corp.  All rights reserved.
  18.  
  19.     You have a royalty-free right to use, modify, reproduce and 
  20.     distribute the Sample Files (and/or any modified version) in 
  21.     any way you find useful, provided that you agree that 
  22.     Microsoft has no warranty obligations or liability for any 
  23.     Sample Application Files which are modified. 
  24.  
  25.     we do not recomend you base your game on IKlowns, start with one of
  26.     the other simpler sample apps in the GDK
  27.  
  28.  **************************************************************************/
  29.  
  30. #ifndef CGGRAPH_H
  31. #define CGGRAPH_H
  32.  
  33. #include <windows.h>
  34. #include "cglevel.h"
  35. #include "cgscreen.h"
  36. #include "cgupdate.h"
  37.  
  38. class CGameGraphic
  39. {
  40. public:
  41.     CGameGraphic(
  42.         int curz = 0
  43.         );
  44.  
  45.     virtual ~CGameGraphic();
  46.  
  47.     virtual void Update(CGameLevel* pLevel, CGameUpdateList* pUpdate) = 0;
  48.     virtual void Render(CGameLevel* pLevel, CGameScreen* pScreen, CGameUpdateList* pUpdate) = 0;
  49.     virtual void MoveTo( int worldX, int worldY ) {};
  50.  
  51.     virtual HPALETTE GetHPalette() = 0;
  52.  
  53.     // return this graphic's current z position
  54.     virtual int GetCurrentZ()
  55.     {
  56.         return mCurZ;
  57.     }
  58.  
  59.     virtual int GetMinZ()
  60.     {
  61.         return mCurZ;       // generic graphics cannot have range
  62.     }
  63.  
  64.     virtual int GetMaxZ()
  65.     {
  66.         return mCurZ;       // generic graphics cannot have range
  67.     }
  68.  
  69.     virtual int GetWidth()
  70.     {
  71.         return mWidth;
  72.     }
  73.  
  74.     virtual int GetHeight()
  75.     {
  76.         return mHeight;
  77.     }
  78.  
  79.     virtual CGameGraphic* GetNext()
  80.     {
  81.         return mpNext;
  82.     }
  83.  
  84.     virtual void SetNext( CGameGraphic * next)
  85.     {
  86.         mpNext = next;
  87.     }
  88.  
  89.     // insert given graphic into the list after us
  90.     virtual void Add( CGameGraphic* pGraphic )
  91.     {
  92.         // simple insertion into the list
  93.         pGraphic->mpNext = mpNext;
  94.         mpNext = pGraphic;
  95.     }
  96.  
  97.     virtual RECT * GetRect() { return &mRect; };
  98.     virtual void SetRect(RECT *rect) {
  99.         mRect.top = rect->top;
  100.         mRect.left = rect->left;
  101.         mRect.bottom = rect->bottom;
  102.         mRect.right = rect->right;
  103.     };
  104.  
  105. protected:
  106.     RECT mRect;
  107.     BOOL mIsValid;      // flag whether this graphic object is valid
  108.     int mXpos;
  109.     int mYpos;
  110.     int mWidth;     // width in pixels
  111.     int mHeight;        // height in pixels
  112.  
  113.     int mCurZ;      // our current Z position
  114.     int mXParallax;
  115.     int mYParallax;
  116.  
  117.     CGameGraphic* mpNext;   // we're in a linked list of CGameGraphic
  118. };
  119.  
  120. #endif // CGGRAPH
  121.