Skip to content

Instantly share code, notes, and snippets.

@ChunChunMorning
Last active December 11, 2015 06:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ChunChunMorning/fe242b489f6405df3045 to your computer and use it in GitHub Desktop.
Save ChunChunMorning/fe242b489f6405df3045 to your computer and use it in GitHub Desktop.
Siv3Dでセーブデータ的なサムシングを作る No4
# include <Siv3D.hpp>
# include <shlobj.h>
void Main()
{
wchar_t appdataPath[MAX_PATH];
FilePath savedataPath;
if (SHGetSpecialFolderPath(NULL, appdataPath, CSIDL_APPDATA, true))
{
savedataPath = Format(appdataPath, L"/Asablo/Savedata.csv");
}
else
{
Println(L"ファイルパスの取得に失敗");
}
CSVReader reader(savedataPath);
if (!reader)
{
CSVWriter writer(savedataPath);
writer.writeRow(Vec2::Zero, 100, 100);
writer.writeRow(L"はじまりの町");
writer.writeRow(Palette::Green);
writer.close();
reader.open(savedataPath);
}
Println(reader.get<Vec2>(0, 0), L" ", reader.get<int>(0, 1), L" ", reader.get<int>(0, 2));
Println(reader.get<String>(1, 0));
Println(reader.get<Color>(2, 0));
WaitKey();
reader.close();
FileSystem::Remove(FileSystem::ParentPath(savedataPath));
Println(FileSystem::ParentPath(savedataPath), L"を消去");
WaitKey();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment