Advertisement
SteelGolem

sgWin32 guide 2019-01-30

Jan 30th, 2019
199
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 2.70 KB | None | 0 0
  1.  
  2.  
  3.  
  4. sgWin32 guide
  5.  
  6. defined in sgWin32.cpp
  7.  
  8.     const int NES_WIDTH
  9.     const int NES_HEIGHT
  10.     const int GAMEBOY_WIDTH
  11.     const int GAMEBOY_HEIGHT
  12.     const int SNES_WIDTH
  13.     const int SNES_HEIGHT
  14.    
  15.     VOID* sgMemAlloc (long numBytes)
  16.     void sgMemFree (VOID* memPointer)
  17.     void sgMemCopy (VOID* src, VOID* dest, long numBytes)
  18.    
  19.     ////////////////////////////////////////////////////////////////
  20.  
  21.     const DWORD SG_COLOR_MASK
  22.     const DWORD SG_COLOR_WHITE
  23.     const DWORD SG_COLOR_LIGHT_GRAY
  24.     const DWORD SG_COLOR_RED
  25.     const DWORD SG_COLOR_GREEN
  26.     const DWORD SG_COLOR_BLUE
  27.     const DWORD SG_COLOR_YELLOW
  28.     const DWORD SG_COLOR_BLACK
  29.    
  30.     DWORD sgMakeColor (BYTE r, BYTE g, BYTE b)
  31.     BYTE sgGetColorR (DWORD color)
  32.     BYTE sgGetColorG (DWORD color)
  33.     BYTE sgGetColorB (DWORD color)
  34.    
  35.     ////////////////////////////////////////////////////////////////
  36.  
  37.     const DWORD SG_MASKED
  38.     const DWORD SG_FLIP_X
  39.     const DWORD SG_FLIP_Y
  40.    
  41.     struct SG_BITMAP
  42.     {
  43.         int width
  44.         int height
  45.         HBITMAP win32Bitmap
  46.         DWORD* pixelData
  47.        
  48.         DWORD* pixel (int x, int y)
  49.         void clear (DWORD color)
  50.         void draw (SG_BITMAP* dest, int destx, int desty, DWORD color, DWORD flags)
  51.         void drawRegion (int srcx, int srcy, int srcw, int srch,
  52.             SG_BITMAP* dest, int destx, int desty,
  53.             DWORD color, DWORD flags)
  54.     }
  55.    
  56.     SG_BITMAP* sgCreateBackBuffer (HWND window, int width, int height)
  57.     SG_BITMAP* sgCreateBitmap (int width, int height)
  58.     SG_BITMAP* sgLoadBitmap (char* filename)
  59.    
  60.     ////////////////////////////////////////////////////////////////
  61.  
  62.     struct SG_TILEMAP
  63.     {
  64.         int width;
  65.         int height;
  66.         int tileWidth;
  67.         int tileHeight;
  68.         int* tileData;
  69.         DWORD* colorData;
  70.        
  71.         int* tile (int x, int y)
  72.         DWORD* color (int x, int y)
  73.         void draw (SG_BITMAP* tileAtlas, SG_BITMAP* dest, int destx, int desty)
  74.         void write (char* text, int x, int y)
  75.     }
  76.  
  77.     SG_TILEMAP* sgCreateTilemap (int width, int height, int tileWidth, int tileHeight)
  78.    
  79.     ////////////////////////////////////////////////////////////////
  80.  
  81.     int sgTextLength (char* data)
  82.     BYTE sgIsWordChar (char c)
  83.  
  84.     struct SG_TEXT
  85.     {
  86.         char* data;
  87.         int length;
  88.         int dataSize;
  89.  
  90.         void append (char* newData)
  91.         int findNext (char c, int from)
  92.         int findPrev (char c, int from)
  93.     }
  94.    
  95.     SG_TEXT* sgCreateText (void)
  96.     void sgDestroyText (SG_TEXT* text)
  97.    
  98.     ////////////////////////////////////////////////////////////////
  99.    
  100.     const BYTE SG_KEY_ESC
  101.     const BYTE SG_KEY_UP
  102.     const BYTE SG_KEY_DOWN
  103.     const BYTE SG_KEY_LEFT
  104.     const BYTE SG_KEY_RIGHT
  105.  
  106.     BYTE keyState[256]
  107.     BYTE lastKeyState[256]
  108.    
  109.     void sgGetKeyStates ()
  110.  
  111. defined in win32.cpp
  112.  
  113.     DWORD targetFPS
  114.     DWORD targetFrameTime
  115.    
  116.     int clientScale
  117.     int clientWidth
  118.     int clientHeight
  119.    
  120.     SG_BITMAP* backBuffer
  121.     int gameRunning
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement