⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 tools.h

📁 Is a small example rpg game world in c++ for building in linux.
💻 H
字号:
/* tools.h, miscellaneous shared routines.   Copyright (C) 2007 EasyRPG Project <http://easyrpg.sourceforge.net/>.   This program is free software: you can redistribute it and/or modify   it under the terms of the GNU General Public License as published by   the Free Software Foundation, either version 3 of the License, or   (at your option) any later version.   This program is distributed in the hope that it will be useful,   but WITHOUT ANY WARRANTY; without even the implied warranty of   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the   GNU General Public License for more details.   You should have received a copy of the GNU General Public License   along with this program.  If not, see <http://www.gnu.org/licenses/>.  */   #ifndef TOOLS_H
#define TOOLS_H

    // =========================================================================
    #include <stdlib.h>
    #include <stdio.h>
    #include <string>
    #include <SDL/SDL.h>
    using namespace std;
    // =========================================================================
    
    // --- Chunk structure -----------------------------------------------------
    struct tChunk
    {
        unsigned char ID;
        
        union
        {
        	unsigned long Length;
        	unsigned long NumEvents;
        };
        
        unsigned long BytesRead;
    };
    
    // --- Read functions ------------------------------------------------------
    unsigned long ReadCompressedInteger(FILE * FileStream);
    string ReadString(FILE * FileStream);
    string ReadString(FILE * FileStream, unsigned char Lenght);
    
    // --- Surface Tools -------------------------------------------------------
    struct Color
    {
        unsigned char r, g, b;
        // ---------------------------------------------------------------------
        Color()                       { r=g=b=0; }
        Color(int nr, int ng, int nb) { r=nr;g=ng;b=nb;}
        
        unsigned long GetColorFromFormat(SDL_PixelFormat * fmt)
        {
            return SDL_MapRGB(fmt, r, g, b);
        }
    };
    
    SDL_Surface * CreateSurface(int Width, int Height, Color TransColor);
    SDL_Surface * LoadSurface(string Filename, Color TransColor);
    SDL_Surface * GrabFromSurface(SDL_Surface * Source, int sX, int sY, int sW, int sH);
    void DrawSurface(SDL_Surface * Destiny, int dX, int dY, SDL_Surface * Source, int sX=0, int sY=0, int sW=-1, int sH=-1);
    
#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -