libtcod
Loading...
Searching...
No Matches
zip.h
Go to the documentation of this file.
1/* BSD 3-Clause License
2 *
3 * Copyright © 2008-2025, Jice and the libtcod contributors.
4 * All rights reserved.
5 *
6 * Redistribution and use in source and binary forms, with or without
7 * modification, are permitted provided that the following conditions are met:
8 *
9 * 1. Redistributions of source code must retain the above copyright notice,
10 * this list of conditions and the following disclaimer.
11 *
12 * 2. Redistributions in binary form must reproduce the above copyright notice,
13 * this list of conditions and the following disclaimer in the documentation
14 * and/or other materials provided with the distribution.
15 *
16 * 3. Neither the name of the copyright holder nor the names of its
17 * contributors may be used to endorse or promote products derived from
18 * this software without specific prior written permission.
19 *
20 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
23 * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
24 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
25 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
26 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
27 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
28 * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
29 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
30 * POSSIBILITY OF SUCH DAMAGE.
31 */
34#pragma once
35#ifndef TCOD_ZIP_H_
36#define TCOD_ZIP_H_
37#ifndef TCOD_NO_ZLIB
38
39#include "color.h"
40#include "console_types.h"
41#include "image.h"
42#include "mersenne.h"
43#include "portability.h"
44
45#ifdef __cplusplus
46extern "C" {
47#endif
48struct TCOD_Zip;
49typedef struct TCOD_Zip* TCOD_zip_t;
50
51TCOD_DEPRECATED("This method of serialization is not cross-platform. It's recommended to find a standard alternative.")
52TCODLIB_API TCOD_zip_t TCOD_zip_new(void);
53TCODLIB_API void TCOD_zip_delete(TCOD_zip_t zip);
54
55/* output interface */
56TCODLIB_API void TCOD_zip_put_char(TCOD_zip_t zip, char val);
57TCODLIB_API void TCOD_zip_put_int(TCOD_zip_t zip, int val);
58TCODLIB_API void TCOD_zip_put_float(TCOD_zip_t zip, float val);
59TCODLIB_API void TCOD_zip_put_string(TCOD_zip_t zip, const char* val);
60TCODLIB_API void TCOD_zip_put_color(TCOD_zip_t zip, const TCOD_color_t val);
61TCODLIB_API void TCOD_zip_put_image(TCOD_zip_t zip, const TCOD_Image* val);
62TCOD_DEPRECATED("This function will corrupt console characters greater than 255.")
63TCODLIB_API void TCOD_zip_put_console(TCOD_zip_t zip, const TCOD_Console* val);
70TCODLIB_API void TCOD_zip_put_random(TCOD_zip_t zip, const TCOD_Random* val);
71TCODLIB_API void TCOD_zip_put_data(TCOD_zip_t zip, int nbBytes, const void* data);
72TCODLIB_API uint32_t TCOD_zip_get_current_bytes(TCOD_zip_t zip);
73TCODLIB_API int TCOD_zip_save_to_file(TCOD_zip_t zip, const char* filename);
74
75/* input interface */
76TCODLIB_API int TCOD_zip_load_from_file(TCOD_zip_t zip, const char* filename);
77TCODLIB_API char TCOD_zip_get_char(TCOD_zip_t zip);
78TCODLIB_API int TCOD_zip_get_int(TCOD_zip_t zip);
79TCODLIB_API float TCOD_zip_get_float(TCOD_zip_t zip);
80TCODLIB_API const char* TCOD_zip_get_string(TCOD_zip_t zip);
81TCODLIB_API TCOD_color_t TCOD_zip_get_color(TCOD_zip_t zip);
82TCODLIB_API TCOD_Image* TCOD_zip_get_image(TCOD_zip_t zip);
83TCODLIB_API TCOD_console_t TCOD_zip_get_console(TCOD_zip_t zip);
90TCODLIB_API TCOD_Random* TCOD_zip_get_random(TCOD_zip_t zip);
91TCODLIB_API int TCOD_zip_get_data(TCOD_zip_t zip, int nbBytes, void* data);
92TCODLIB_API uint32_t TCOD_zip_get_remaining_bytes(TCOD_zip_t zip);
93TCODLIB_API void TCOD_zip_skip_bytes(TCOD_zip_t zip, uint32_t nbBytes);
94#ifdef __cplusplus
95}
96#endif
97#endif // TCOD_NO_ZLIB
98#endif // TCOD_ZIP_H_
Color handling module.
C types for console functions.
Image handling module.
Random number generator functions.
Miscellaneous tools needed across platforms.
A libtcod console containing a grid of tiles with {ch, fg, bg} information.
Definition console.h:125
Definition image.h:54
Pseudorandom number generator toolkit, all attributes are private.
Definition mersenne_types.h:87
TCOD_Random * TCOD_zip_get_random(TCOD_zip_t zip)
Read a TCOD_Random* object.
void TCOD_zip_put_random(TCOD_zip_t zip, const TCOD_Random *val)
Write a TCOD_Random* object.