Skip to content

Instantly share code, notes, and snippets.

View ChunChunMorning's full-sized avatar

あさちゅん ChunChunMorning

View GitHub Profile
@ChunChunMorning
ChunChunMorning / Main.cpp
Last active December 11, 2015 06:32
Siv3Dでポーズ画面を簡単に実装する with HamFramework
# include <Siv3D.hpp>
# include <HamFramework.hpp>
struct GameData {};
struct Game : SceneManager<String, GameData>::Scene
{
Font font;
Circle player;
Array<Circle> bullets;
@ChunChunMorning
ChunChunMorning / Main.cpp
Last active December 11, 2015 06:31
Siv3Dで簡単なアニメーションを作る
# include <Siv3D.hpp>
class Anime
{
public:
Anime(const Texture& texture, int size, int frame) :
m_texture(texture),
m_size(size),
m_frame(frame),
m_index(0),
@ChunChunMorning
ChunChunMorning / Main.cpp
Last active December 11, 2015 06:30
Siv3Dで画像連結ソフトを作る
# include <Siv3D.hpp>
Image createImage(const Array<Image>& images)
{
int width = 0;
int height = 0;
for (const auto& image : images)
{
width += image.width;
@ChunChunMorning
ChunChunMorning / Sample.cpp
Last active December 11, 2015 06:29
Siv3Dでセーブデータ的なサムシングを作る No1
FilePath savedataPath = L"Savedata.csv";
CSVReader reader(savedataPath);
if (!reader)
{
CSVWriter writer(savedataPath);
writer.writeRow(Vec2::Zero, 100, 100);
writer.writeRow(L"はじまりの町");
writer.writeRow(Palette::Green);
writer.close();
@ChunChunMorning
ChunChunMorning / Sample.cpp
Last active December 11, 2015 06:28
Siv3Dでセーブデータ的なサムシングを作る No2
// 失敗した場合Vec2()
Vec2 r1 = reader.get<Vec2>(0, 0);
// 失敗した場合、引数で指定した値
Vec2 r2 = reader.getOr<Vec2>(0, 0, {0.0, 0.0});
// Optionalの値が返って来る。失敗ならnone
Optional<Vec2> r3 = reader.getOpt<Vec2>(0, 0);
@ChunChunMorning
ChunChunMorning / Sample.cpp
Last active December 11, 2015 06:28
Siv3Dでセーブデータ的なサムシングを作る No3
# include <shlobj.h>
wchar_t appdataPath[MAX_PATH];
FilePath savedataPath;
if (SHGetSpecialFolderPath(NULL, appdataPath, CSIDL_APPDATA, true))
{
savedataPath = Format(appdataPath, L"/Asablo/Savedata.csv");
}
else
@ChunChunMorning
ChunChunMorning / Main.cpp
Last active December 11, 2015 06:27
Siv3Dでセーブデータ的なサムシングを作る No4
# include <Siv3D.hpp>
# include <shlobj.h>
void Main()
{
wchar_t appdataPath[MAX_PATH];
FilePath savedataPath;
if (SHGetSpecialFolderPath(NULL, appdataPath, CSIDL_APPDATA, true))
{
@ChunChunMorning
ChunChunMorning / Sample.cpp
Last active December 11, 2015 06:27
Siv3Dの機能をフル活用してセーブデータを実装する No1
std::unordered_map<String, String> m_data;
template<typename Type> void add(const String& key, const Type& value)
{
m_data[key] = Format(value);
}
template<typename Type> Optional<Type> getOpt(String key) const
{
if (hasKey(key))
@ChunChunMorning
ChunChunMorning / Sample.cpp
Last active December 11, 2015 06:26
Siv3Dの機能をフル活用してセーブデータを実装する No2
bool save(const FilePath& filePath)
{
String data = L"";
for (auto content : m_data)
{
data += m_delimiter + content.first + m_delimiter + content.second;
}
const MemoryReader encrypted = Crypto::EncryptString(data, m_aes128Key);
@ChunChunMorning
ChunChunMorning / OverstateUI.cs
Last active December 11, 2015 06:24
大きさが変わるuGUI
using UnityEngine;
using System.Collections;
public class OverstateUI : MonoBehaviour
{
[SerializeField] Vector3 m_MaxSize = Vector3.one;
[SerializeField] Vector3 m_MinSize = Vector3.zero;
[SerializeField] float m_AngularFrequency = 1.0f;
float m_Time;