home *** CD-ROM | disk | FTP | other *** search
/ Magazyn Exec 4 / CD_Magazyn_EXEC_nr_4.iso / Recent / dev / c / GSys.lha / gsys / ggraphics / GScreen.h < prev   
Encoding:
C/C++ Source or Header  |  2000-10-29  |  2.9 KB  |  130 lines

  1.  
  2.  
  3. #ifndef GSCREEN_H
  4. #define GSCREEN_H
  5.  
  6. #ifdef GAMIGA
  7.  
  8. #include <exec/types.h>
  9. #include <exec/memory.h>
  10. #include <cybergraphics/cybergraphics.h>
  11.  
  12. /*
  13. #ifdef GAMIGA_PPC
  14. #include <powerup/ppcproto/exec.h>
  15. #include <powerup/ppcproto/dos.h>
  16. #include <powerup/ppcproto/graphics.h>
  17. #include <powerup/ppcproto/intuition.h>
  18. #include <powerup/ppcproto/gadtools.h>
  19. #include <powerup/ppcproto/asl.h>
  20. #include <powerup/ppcproto/cybergraphics.h>
  21. #else
  22. #include <proto/exec.h>
  23. #include <proto/dos.h>
  24. #include <proto/graphics.h>
  25. #include <proto/intuition.h>
  26. #include <proto/gadtools.h>
  27. #include <proto/asl.h>
  28. #include <proto/cybergraphics.h>
  29. #endif
  30. */
  31. #endif
  32.  
  33. __inline UWORD G24to16(ULONG x)
  34. {
  35.     return  ( ((x>>19)&0x1f)<<11 ) | ( ((x>>10)&0x3f)<<5 ) | (x>>3)&0x1f;
  36. }
  37. __inline UBYTE G24to8(ULONG x)    // 323
  38. {
  39.     return  ( ((x>>21)&0x7)<<5 ) | ( ((x>>14)&0x3)<<3 ) | (x>>5)&0x7;
  40. }
  41. __inline UWORD G8to16(UBYTE x)
  42. {
  43.     return ( ((x>>5)<<11) | ( ((x>>3)&0x3)<<5) | x&0x7 );
  44. }
  45.  
  46. class GScreen : public GObject
  47. {
  48. public:
  49.     GScreen(class GRequestDisplay *GRequestDisplay);
  50.     GScreen(ULONG Width, ULONG Height, UWORD Depth);    /* åpner en skjerm med en BESTEMT størrelse */
  51.     ~GScreen();
  52.  
  53. // Get (and Set)
  54. //    BOOL IsValid() { return Valid; };
  55.     ULONG GetWidth();
  56.     ULONG GetHeight();
  57.     UWORD GetDepth();
  58.  
  59. // Methods for screen-updating and doublebuffering
  60.     void WaitSafeToWrite();
  61.     void SwapScreenBuffers();
  62.  
  63. // Methods for palettes in 8Bit-modes
  64.     void SetTrueColorPalette();
  65.  
  66. // Methods for using own PixelArrays and/or directdraw
  67.     BOOL AttachOwnPixelArray();
  68.     void LoadPixelArray();
  69.     void LoadPixelArrayDirect();
  70. //    void FreeFixedBackup() {};
  71.     ULONG *GetOwnPixelArray();    // { return Own24BitPixelArray; };
  72.  
  73. // Methods for direct draw
  74.     APTR LockScreen();        // for direct draw
  75.     void UnLockScreen();        // used after drawing
  76.     ULONG GetDDBytesPix() { return DDBytesPix; };
  77.     ULONG GetDDBytesRow() { return DDBytesRow; };
  78.     ULONG GetDDPxlFmt() { return DDPxlFmt; };
  79.     APTR GetDDBuffer() { return DDBuffer; };
  80.  
  81. // Silly Methots
  82. //    void PutPixel(ULONG X, ULONG Y, UBYTE Pen);
  83.     void PutPixel(ULONG X, ULONG Y, ULONG RGB);
  84.     void DrawLine(class GVertex *P1, class GVertex *P2, UBYTE Pen);
  85. //    void DrawLine(x1, y1, x2, y2, UBYTE Pen);
  86.     void DrawLine(int x1, int y1, int x2, int y2, UBYTE Pen);
  87.  
  88.     struct Screen *GetAmyScreen() { return AmigaScreen; };
  89.     void *GetAmyVI() { return AmigaVisualInfo; };
  90.  
  91. // Misc Methods
  92.     ULONG CheckScreenMsgs();
  93.  
  94.     WORD GetMouseX();
  95.     WORD GetMouseY();
  96.  
  97.  
  98. // Objects, Variables etc.
  99.     ULONG    ScrWidth;
  100.     ULONG    ScrHeight;
  101.     UWORD    ScrDepth;
  102.  
  103.     ULONG    *Own24BitPixelArray;    /* 24(32)bit: 00RRGGBB */
  104.  
  105.     ULONG    DDBytesPix;
  106.     ULONG    DDBytesRow;
  107.     ULONG    DDPxlFmt;
  108.     APTR    DDBuffer;
  109. private:
  110.  
  111. #ifdef GAMIGA
  112.     struct Screen *AmigaScreen;
  113.     struct Window *AmigaWindow;
  114.     struct ScreenBuffer *AmigaScreenBuffer[2];
  115.     struct MsgPort *DispPort, *WritePort;
  116.     APTR AmigaVisualInfo;
  117.     BOOL SafeToSwap, SafeToWrite, WaitSwap, WaitWrite;
  118.     LONG CurBuffer;
  119.     APTR Handle;
  120.     struct IntuiMessage *AmigaWinMsg;
  121. #endif
  122.  
  123. #ifdef GWINDOWS
  124.     feil her
  125. #endif
  126.  
  127. };
  128.  
  129. #endif /* ifndef GSCREEN_H */
  130.