Skip to content

Instantly share code, notes, and snippets.

View yashihei's full-sized avatar

Ryuhei Kobayashi yashihei

View GitHub Profile
@yashihei
yashihei / gist:de08869146f86834f37312f556f75eec
Last active May 10, 2019 10:30
masterでcommitしてしまった…って時

まずは深呼吸。

git branch new_branch [ブランチを分けたいコミット]
git co new_branch
git graph master -n 10 | cat #とかでcherry-pickするコミット番号確認
git cherry-pick [cherry-pick の始点となるコミット]..[cherry-pick の終点となるコミット]
@yashihei
yashihei / memo.md
Last active October 30, 2019 12:38
uGUIのButtonでキー操作(パッド操作)オンリーのUI構築メモ

ButtonをLayoutGroupでいい感じに配置して終わりではって感じなんだけど、面倒なところが少しあったのでメモ

マウス入力問題

今回作っているゲームでは、基本的にマウスでUIは操作しないため、マウスの入力は無視したい。
マウス入力を無視するには、上に透明なレイヤをおいてそこでクリックを吸収する、とか他にも方法があるみたいだけど、今回はStandaloneInputModuleのマウス入力を無効化した。

using UnityEngine;
using UnityEngine.EventSystems;
#include <winbase.h>
#include <boost/format.hpp>
inline void Log(boost::format &bfmt) {
#if defined(_DEBUG)
OutputDebugString(bfmt.str().c_str());
#endif
}
template<class First, class... Rest>
@yashihei
yashihei / memo.md
Last active June 14, 2017 16:26
Windowsでターミナル環境なメモ
@yashihei
yashihei / memo.md
Last active June 14, 2017 16:25
DirectX初期化メモ

プロジェクトの設定

「VC++ Directories」→「Include Directories」
$(DXSDK_DIR)Include;$(IncludePath)

「VC++ Directories」→「Library Directories」
$(DXSDK_DIR)Lib\x86;$(LibraryPath)

「Linker」→「Input」

d3dx9d.lib;d3d9.lib;winmm.lib;dxguid.lib;dinput8.lib;xinput.lib (Debug)
d3dx9.lib;d3d9.lib;winmm.lib;dxguid.lib;dinput8.lib;xinput.lib (Relese)

@yashihei
yashihei / debug.cpp
Created February 15, 2016 21:34
何か数値をログに出したい時
template <typename Type> inline void OutputDebugValue(Type& value) {
OutputDebugString(std::to_string(value).c_str());
OutputDebugString("\n");
}
@yashihei
yashihei / actor.cpp
Last active December 20, 2015 16:33
class Actor {
public:
Actor() = default;
virtual ~Actor() = default;
virtual void update() = 0;
virtual void draw() = 0;
void kill() { enable = false; }
bool isEnabled() const { return enable; }
private:
@yashihei
yashihei / text.md
Last active December 2, 2015 23:15
C言語でのファイル分割の定石について

この文章では、C言語においてチーム制作では欠かすことが出来ないファイル分割について説明する。

まず前提として

プレイヤー、敵、弾などのオブジェクト毎に、敵に関する処理はenemy.cpp、プレイヤーはplayer.cppみたく、ファイルを分割する。

どのように分割すれば良いのか

例えば敵の処理を分割したい場合。

enemy.h

@yashihei
yashihei / memo.md
Last active August 29, 2015 14:24
rbenv導入

Ubuntu14.10にて、以下の通りに。 2.2.0がコケる何で。とりあえず1.9.3を入れる。

$ git clone https://github.com/sstephenson/rbenv.git ~/.rbenv
$ echo 'export PATH="$HOME/.rbenv/bin:$PATH"' >> ~/.bashrc
$ echo 'eval "$(rbenv init -)"' >> ~/.bashrc
$ git clone https://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build
$ rbenv install 1.9.3-p551
@yashihei
yashihei / memo.md
Created June 26, 2015 15:02
vectorでpush_backするとイテレータ破壊される

されるのだけど、これで困るのがイテレータを回してる時にpush_backしたいとき。

解決法としては

  1. 別のvectorコンテナに入れてあとでmergeする
  2. std::listを使う