2013-09-01 14:27:21 +00:00
|
|
|
/*
|
|
|
|
** tilequad.h
|
|
|
|
**
|
|
|
|
** This file is part of mkxp.
|
|
|
|
**
|
2021-09-06 18:50:44 +00:00
|
|
|
** Copyright (C) 2021 Amaryllis Kulla <amaryllis.kulla@protonmail.com>
|
2013-09-01 14:27:21 +00:00
|
|
|
**
|
|
|
|
** mkxp 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 2 of the License, or
|
|
|
|
** (at your option) any later version.
|
|
|
|
**
|
|
|
|
** mkxp 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 mkxp. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef TILEQUAD_H
|
|
|
|
#define TILEQUAD_H
|
|
|
|
|
|
|
|
#include "etc-internal.h"
|
|
|
|
|
|
|
|
/* Tiled Quads
|
|
|
|
*
|
|
|
|
* These functions enable drawing a tiled subrectangle
|
|
|
|
* of a texture,
|
|
|
|
* but no advanced stuff like rotation, scaling etc.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include "quadarray.h"
|
|
|
|
|
|
|
|
namespace TileQuads
|
|
|
|
{
|
|
|
|
/* Calculate needed quad counts */
|
|
|
|
int oneDimCount(int tileDimension,
|
2014-05-07 15:52:11 +00:00
|
|
|
int destDimension);
|
2013-09-01 14:27:21 +00:00
|
|
|
int twoDimCount(int tileW, int tileH,
|
2014-05-07 15:52:11 +00:00
|
|
|
int destW, int destH);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
/* Build tiling quads */
|
|
|
|
int buildH(const IntRect &sourceRect,
|
2014-05-07 15:52:11 +00:00
|
|
|
int width, int x, int y,
|
|
|
|
Vertex *verts);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
int buildV(const IntRect &sourceRect,
|
2014-05-07 15:52:11 +00:00
|
|
|
int height, int ox, int oy,
|
|
|
|
Vertex *verts);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
int build(const IntRect &sourceRect,
|
2014-05-07 15:52:11 +00:00
|
|
|
const IntRect &destRect,
|
|
|
|
Vertex *verts);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
/* Build a quad "frame" (see Window cursor_rect) */
|
|
|
|
int buildFrame(const IntRect &rect,
|
2014-05-07 15:52:11 +00:00
|
|
|
Vertex vert[36]);
|
2013-09-01 14:27:21 +00:00
|
|
|
|
|
|
|
int buildFrameSource(const IntRect &rect,
|
2013-09-21 12:45:27 +00:00
|
|
|
Vertex vert[36]);
|
2013-09-01 14:27:21 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // TILEQUAD_H
|