File indexing completed on 2024-04-14 03:59:23
0001 /*************************************************************************** 0002 * KBlocks, a falling blocks game by KDE * 0003 * SPDX-FileCopyrightText: 2010 Zhongjie Cai <squall.leonhart.cai@gmail.com> * 0004 * * 0005 * SPDX-License-Identifier: GPL-2.0-or-later 0006 ***************************************************************************/ 0007 #ifndef KBLOCKSGAMERECORDER_H 0008 #define KBLOCKSGAMERECORDER_H 0009 0010 #include "KBlocksDefine.h" 0011 0012 #include <stdio.h> 0013 #include <string> 0014 #include <list> 0015 0016 using std::string; 0017 using std::list; 0018 0019 struct _game_record_data { 0020 int index; 0021 int type; 0022 int value; 0023 timeLong time; 0024 }; 0025 0026 class KBlocksGameRecorder 0027 { 0028 public: 0029 KBlocksGameRecorder(); 0030 ~KBlocksGameRecorder(); 0031 0032 public: 0033 void append(int index, int type, int value); 0034 void save(const char *fileName, bool isBinaryMode = true); 0035 0036 private: 0037 void saveText(FILE *pFile); 0038 void saveBinary(FILE *pFile); 0039 void writeByte(FILE *pFile, int value); 0040 0041 private: 0042 list<_game_record_data> mGameRecord; 0043 }; 0044 0045 #endif