SteelGolem icon

sgWin32 guide 2019-01-30

SteelGolem | PRO | 01/30/19 11:08:03 PM UTC | 0 ⭐ | 466 👁️ | Never ⏰ | []
C++ |

2.7 KB

|

None

|

0 👍

/

0 👎

 
 
 
sgWin32 guide
 
defined in sgWin32.cpp
 
    const int NES_WIDTH
    const int NES_HEIGHT
    const int GAMEBOY_WIDTH
    const int GAMEBOY_HEIGHT
    const int SNES_WIDTH
    const int SNES_HEIGHT
    
    VOID* sgMemAlloc (long numBytes)
    void sgMemFree (VOID* memPointer)
    void sgMemCopy (VOID* src, VOID* dest, long numBytes)
    
    ////////////////////////////////////////////////////////////////
 
    const DWORD SG_COLOR_MASK
    const DWORD SG_COLOR_WHITE
    const DWORD SG_COLOR_LIGHT_GRAY
    const DWORD SG_COLOR_RED
    const DWORD SG_COLOR_GREEN
    const DWORD SG_COLOR_BLUE
    const DWORD SG_COLOR_YELLOW
    const DWORD SG_COLOR_BLACK
    
    DWORD sgMakeColor (BYTE r, BYTE g, BYTE b)
    BYTE sgGetColorR (DWORD color)
    BYTE sgGetColorG (DWORD color)
    BYTE sgGetColorB (DWORD color)
    
    ////////////////////////////////////////////////////////////////
 
    const DWORD SG_MASKED
    const DWORD SG_FLIP_X
    const DWORD SG_FLIP_Y
    
    struct SG_BITMAP
    {
        int width
        int height
        HBITMAP win32Bitmap
        DWORD* pixelData
        
        DWORD* pixel (int x, int y)
        void clear (DWORD color)
        void draw (SG_BITMAP* dest, int destx, int desty, DWORD color, DWORD flags)
        void drawRegion (int srcx, int srcy, int srcw, int srch, 
            SG_BITMAP* dest, int destx, int desty,
            DWORD color, DWORD flags)
    }
    
    SG_BITMAP* sgCreateBackBuffer (HWND window, int width, int height)
    SG_BITMAP* sgCreateBitmap (int width, int height)
    SG_BITMAP* sgLoadBitmap (char* filename)
    
    ////////////////////////////////////////////////////////////////
 
    struct SG_TILEMAP
    {
        int width;
        int height;
        int tileWidth;
        int tileHeight;
        int* tileData;
        DWORD* colorData;
        
        int* tile (int x, int y)
        DWORD* color (int x, int y)
        void draw (SG_BITMAP* tileAtlas, SG_BITMAP* dest, int destx, int desty)
        void write (char* text, int x, int y)
    }
 
    SG_TILEMAP* sgCreateTilemap (int width, int height, int tileWidth, int tileHeight)
    
    ////////////////////////////////////////////////////////////////
 
    int sgTextLength (char* data)
    BYTE sgIsWordChar (char c)
 
    struct SG_TEXT
    {
        char* data;
        int length;
        int dataSize;
 
        void append (char* newData)
        int findNext (char c, int from)
        int findPrev (char c, int from)
    }
    
    SG_TEXT* sgCreateText (void)
    void sgDestroyText (SG_TEXT* text)
    
    ////////////////////////////////////////////////////////////////
    
    const BYTE SG_KEY_ESC
    const BYTE SG_KEY_UP
    const BYTE SG_KEY_DOWN
    const BYTE SG_KEY_LEFT
    const BYTE SG_KEY_RIGHT
 
    BYTE keyState[256]
    BYTE lastKeyState[256]
    
    void sgGetKeyStates ()
 
defined in win32.cpp
 
    DWORD targetFPS
    DWORD targetFrameTime
    
    int clientScale
    int clientWidth
    int clientHeight
    
    SG_BITMAP* backBuffer
    int gameRunning

Comments