source: svn/trunk/zasc/app_c/DST_WinManager.c

Last change on this file was 2, checked in by jglee, 11 years ago

first commit

File size: 1.9 KB
Line 
1#include "DST_WinManager.h"
2
3// À©µµ¿ì °ü¸® ÇÔ¼ö ¿µ¿ª
4static CWindow *window[WIN_ID_MAX];
5// À©µµ¿ì¸¦ Ãß°¡ÇÑ´Ù.
6void DST_AddWin(WinID nID, CWindow *pData)
7{
8        if (!pData) return;
9        if (window[nID]) DeleteCWindow(window[nID]);
10        window[nID] = pData;
11}
12// À©µµ¿ì¸¦ Á¦°ÅÇÑ´Ù.
13void DST_RemoveWin(WinID nID)
14{
15        if (window[nID]) DeleteCWindow(window[nID]);
16        window[nID] = 0;
17}
18// ¸ðµç À©µµ¿ì¸¦ Á¦°ÅÇÑ´Ù.
19void DST_RemoveAllWindows()
20{
21        int i;
22        for ( i=WIN_NULL; i < WIN_ID_MAX; i++)
23        {
24                DST_RemoveWin((WinID)i);
25        }
26}
27
28void DST_RemoveAllWindowExceptBasicWin()
29{
30        int i;
31        for ( i=WIN_NULL; i < WIN_BASIC; i++)
32        {
33                DST_RemoveWin((WinID)i);
34        }
35}
36
37// À©µµ¿ì ¾ÆÀ̵ð·Î À©µµ¿ì Ŭ·¡½º Æ÷ÀÎÅ͸¦ °¡Á®¿Â´Ù.
38CWindow *DST_GetWin(WinID nID)
39{
40        if (nID < WIN_ID_MAX) return window[nID];
41        return 0;
42}
43
44// ¾÷µ¥ÀÌÆ® °ü¸® ÇÔ¼ö ¿µ¿ª
45static DST_RECT rectUpdate;
46// ¾÷µ¥ÀÌÆ® ¿µ¿ª ÃʱâÈ­
47void DST_ResetUpdateRegion()
48{
49        memset(&rectUpdate, 0, sizeof(DST_RECT));
50}
51// ¾÷µ¥ÀÌÆ® ¿µ¿ª Ãß°¡
52#define max(x,y) ((x)>(y)?(x):(y))
53#define min(x,y) ((x)<(y)?(x):(y))     
54void DST_AddUpdateRegion(DST_RECT rectNew)
55{
56        if (rectNew.w == 0 || rectNew.h == 0) return;
57        if (rectUpdate.w == 0 || rectUpdate.h == 0) // Çå¹Ú½ºÀÇ Å©±â°¡ 0ÀÌ¸é »õ¹Ú½ºÀÇ Å©±â·Î ´ëüÇÑ´Ù.
58        {
59                rectUpdate = rectNew;
60                return;
61        }
62        DST_RECT rectTemp = rectUpdate;
63        rectUpdate.x = min(rectTemp.x, rectNew.x );
64        rectUpdate.y = min(rectTemp.y, rectNew.y );
65        rectUpdate.w = max(rectTemp.x + rectTemp.w, rectNew.x + rectNew.w) - rectUpdate.x;
66        rectUpdate.h = max(rectTemp.y + rectTemp.h, rectNew.y + rectNew.h) - rectUpdate.y;
67
68        if (rectUpdate.x < 0) rectUpdate.x = 0;
69        if (rectUpdate.y < 0) rectUpdate.y = 0;
70        if (rectUpdate.w > DST_GetScreenWidth() - rectUpdate.x) rectUpdate.w = DST_GetScreenWidth() - rectUpdate.x;
71        if (rectUpdate.h > DST_GetScreenHeight() - rectUpdate.y) rectUpdate.h = DST_GetScreenHeight() - rectUpdate.y;
72}
73// ¾÷µ¥ÀÌÆ® ¿µ¿ª ¹Ýȯ
74DST_RECT DST_GetUpdateRegion()
75{
76        return rectUpdate;
77}
Note: See TracBrowser for help on using the repository browser.