summaryrefslogtreecommitdiff
path: root/kon/konrmdraw.h
diff options
context:
space:
mode:
Diffstat (limited to 'kon/konrmdraw.h')
-rw-r--r--kon/konrmdraw.h58
1 files changed, 58 insertions, 0 deletions
diff --git a/kon/konrmdraw.h b/kon/konrmdraw.h
new file mode 100644
index 0000000..dc3a304
--- /dev/null
+++ b/kon/konrmdraw.h
@@ -0,0 +1,58 @@
+/* SPDX-License-Identifier: MIT */
+/*
+ * konrmdraw.h
+ *
+ * Copyright (c) 2026 KonAki
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in all
+ * copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#ifndef KONRMDRAW_H
+#define KONRMDRAW_H
+
+#include "konsofren.h"
+#include "konrmmap.h"
+#include "konrmtile.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+/*** definition ***/
+
+/* draws the tiles of an RPG Maker map the way RPG Maker lays them out: the ground layers, the shadows, the upper layers, and the
+ tiles marked with a star as a second pass for after the characters are drawn. you load the tileset's pictures yourself, in the
+ order of its names (see konrmtile.h), and keep them for as long as you draw. a picture that is NULL leaves its tiles out */
+typedef struct kon_rmSheets {
+ const kon_image *image[KON_RM_SHEETS];
+} kon_rmSheets_t;
+
+/* cameraX and cameraY are the map pixel at the top left of fb. tiles are drawn at the size they have in the pictures, which is 48
+ pixels for most games, so the camera counts in those too. a map that loops (its scroll type) is drawn around its edges.
+ pass 0 draws everything that goes under the characters, pass 1 what goes over them. frame changes the water and waterfalls,
+ count it up once every half second (30 frames of the game) */
+void kon_rmDrawTiles(kon_framebuffer_t *fb, const kon_rmMap_t *map, const kon_rmTileset_t *tileset, const kon_rmSheets_t *sheets, int frame, int cameraX, int cameraY, int pass);
+
+/* the size of a tile in the pictures, 48 for the usual ones, or 0 when none of the pictures is there */
+int kon_rmTileSize(const kon_rmSheets_t *sheets);
+
+#ifdef __cplusplus
+}
+#endif
+#endif