| 1 |
#ifndef CWINDOWDIVINFO_H_INCLUDED |
| 2 |
#define CWINDOWDIVINFO_H_INCLUDED |
| 3 |
|
| 4 |
#include "CCamera.h" |
| 5 |
|
| 6 |
class CScene; |
| 7 |
class CWindowDivInfo; |
| 8 |
class CSceneryMode; |
| 9 |
|
| 10 |
const int WIN_DIV_MAX = 2; // 画面分割単位 |
| 11 |
const int WIN_DIV_MARGIN = 5; // 画面分割余白 |
| 12 |
const int WIN_DIV_PADDING = 2; // 画面分割線幅 |
| 13 |
const int WIN_DIV_MOVE_MARGIN = 1; // 画面分割移動判定幅 |
| 14 |
const int WIN_DIV_MIN_SIZE = 50; // 画面分割最小サイズ |
| 15 |
|
| 16 |
class CWindowInfo { |
| 17 |
friend class CWindowDivInfo; |
| 18 |
|
| 19 |
private: |
| 20 |
CScene *m_Scene; |
| 21 |
CCamera m_Camera; |
| 22 |
CWindowDivInfo *m_Div; |
| 23 |
int m_PosX, m_PosY; |
| 24 |
int m_Width, m_Height; |
| 25 |
|
| 26 |
public: |
| 27 |
CWindowInfo(); |
| 28 |
~CWindowInfo(); |
| 29 |
|
| 30 |
CWindowDivInfo *GetDiv(){ return m_Div; } |
| 31 |
CWindowDivInfo **GetDivAdr(){ return &m_Div; } |
| 32 |
int GetWidth() const { return m_Width; } |
| 33 |
int GetHeight() const { return m_Height; } |
| 34 |
CScene *GetScene(){ return m_Scene; } |
| 35 |
CCamera *GetCamera(){ return &m_Camera; } |
| 36 |
void SetCamera(const CCamera& cam){ m_Camera = cam; } |
| 37 |
void SetScene(CScene *scene){ m_Scene = scene; } |
| 38 |
void Free(); |
| 39 |
CWindowInfo *GetPointWindow(int x, int y, int w, int h, const POINT& pos); |
| 40 |
CWindowInfo *GetFirstLeaf(); |
| 41 |
void ApplyViewportAndCamera(); |
| 42 |
void RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt); |
| 43 |
void OnDeleteScene(CScene *scene); |
| 44 |
char *Read(char *); |
| 45 |
void Save(FILE *, string indent); |
| 46 |
}; |
| 47 |
|
| 48 |
class CWindowDivInfo { |
| 49 |
friend class CWindowInfo; |
| 50 |
|
| 51 |
private: |
| 52 |
enum { |
| 53 |
DRAG_STATE_NONE = 0, |
| 54 |
DRAG_STATE_HORZ = 1, |
| 55 |
DRAG_STATE_VERT = 2, |
| 56 |
DRAG_STATE_HORZVERT = DRAG_STATE_HORZ|DRAG_STATE_VERT, |
| 57 |
}; |
| 58 |
|
| 59 |
public: |
| 60 |
static CWindowDivInfo **s_DragDivInfo; |
| 61 |
static CWindowDivInfo *s_MoveDivInfo; |
| 62 |
static CCamera *s_DragDivCamera; |
| 63 |
static CScene **s_DragDivScene; |
| 64 |
static int s_DragState; |
| 65 |
static int s_ShrinkState; |
| 66 |
static int s_ShrinkAnim; |
| 67 |
static int s_TargetPosX, s_TargetPosY; |
| 68 |
static int s_TargetWidth, s_TargetHeight; |
| 69 |
|
| 70 |
float m_HorzRatio; |
| 71 |
float m_VertRatio; |
| 72 |
CWindowInfo m_ChildWindow[WIN_DIV_MAX][WIN_DIV_MAX]; |
| 73 |
int m_ChildWidth[WIN_DIV_MAX]; |
| 74 |
int m_ChildHeight[WIN_DIV_MAX]; |
| 75 |
int m_DragState; |
| 76 |
|
| 77 |
public: |
| 78 |
static void InitState(); |
| 79 |
void CalcChildSize(int w, int h); |
| 80 |
int ScanInputSelf(CWindowDivInfo** info, int x, int y, int w, int h); |
| 81 |
static int ScanInput(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene); |
| 82 |
static int ScanInputRecursive(CWindowDivInfo** info, int x, int y, int w, int h, CCamera *cam, CScene **scene); |
| 83 |
static void RenderInterface(); |
| 84 |
void InitCamera(const CCamera& cam, CScene *scene); |
| 85 |
void RenderInterfaceRecursive(int x, int y, int w, int h); |
| 86 |
void RenderScene(int x, int y, int w, int h, CSceneryMode* mode, int opt); |
| 87 |
CWindowInfo* GetPointWindow(int x, int y, int w, int h, const POINT& pos); |
| 88 |
void OnDeleteScene(CScene *scene); |
| 89 |
|
| 90 |
CWindowDivInfo(); |
| 91 |
~CWindowDivInfo(); |
| 92 |
char *Read(char *); |
| 93 |
void Save(FILE *, string indent); |
| 94 |
}; |
| 95 |
|
| 96 |
#endif |