ゲームが作れるようになるまでがんばる日記

ゲーム制作のことを中心にゲームに関することを書いています

2009-09-18から1日間の記事一覧

矩形と点の当たり判定

矩形と点の当たり判定は非常に簡単。矩形の範囲内に点があるかどうか調べれば良い。 typedef struct { int left; int top; int right; int bottom; } RECT; bool isHit(RECT& r, int x, int y) { if ( r.top > y || r.bottom < y || r.left > x || r.right <…