mirror of
https://github.com/kichikuou/xsystem35-sdl2.git
synced 2026-10-09 23:58:25 +03:00
Make MyRectangle an alias of SDL_Rect
This commit is contained in:
+33
-33
@@ -239,32 +239,32 @@ static void init_selwindow() {
|
||||
int i;
|
||||
MyRectangle r;
|
||||
|
||||
r.x = sel.win->x;
|
||||
r.y = sel.win->y;
|
||||
r.width = 4 + (sel.WinResizeWidth ? sel.MsgFontSize * maxElementLength : sel.win->width);
|
||||
r.height = 2 + (sel.WinResizeHeight ? (sel.MsgFontSize +2) * regnum : max((sel.MsgFontSize +2) * regnum, sel.win->height));
|
||||
r.x = sel.win->x;
|
||||
r.y = sel.win->y;
|
||||
r.w = 4 + (sel.WinResizeWidth ? sel.MsgFontSize * maxElementLength : sel.win->width);
|
||||
r.h = 2 + (sel.WinResizeHeight ? (sel.MsgFontSize +2) * regnum : max((sel.MsgFontSize +2) * regnum, sel.win->height));
|
||||
|
||||
if (sel.win->save) {
|
||||
saveArea.x = r.x - sel.Framedot;
|
||||
saveArea.y = r.y - sel.Framedot;
|
||||
saveArea.width = r.width + 2 * sel.Framedot;
|
||||
saveArea.height = r.height + 2 * sel.Framedot;
|
||||
saveimg = ags_saveRegion(saveArea.x, saveArea.y, saveArea.width, saveArea.height);
|
||||
saveArea.w = r.w + 2 * sel.Framedot;
|
||||
saveArea.h = r.h + 2 * sel.Framedot;
|
||||
saveimg = ags_saveRegion(saveArea.x, saveArea.y, saveArea.w, saveArea.h);
|
||||
} else {
|
||||
saveArea = r;
|
||||
}
|
||||
|
||||
if (sel.WinBackgroundTransparent == 255) {
|
||||
ags_fillRectangle(r.x, r.y, r.width, r.height, sel.WinBackgroundColor);
|
||||
ags_fillRectangle(r.x, r.y, r.w, r.h, sel.WinBackgroundColor);
|
||||
} else {
|
||||
ags_wrapColor(r.x, r.y, r.width, r.height, sel.WinBackgroundColor, sel.WinBackgroundTransparent);
|
||||
ags_wrapColor(r.x, r.y, r.w, r.h, sel.WinBackgroundColor, sel.WinBackgroundTransparent);
|
||||
}
|
||||
|
||||
switch(sel.WindowFrameType) {
|
||||
case WINDOW_FRAME_EMPTY:
|
||||
break;
|
||||
case WINDOW_FRAME_LINE:
|
||||
drawLineFrame(r.x, r.y, r.width, r.height);
|
||||
drawLineFrame(r.x, r.y, r.w, r.h);
|
||||
break;
|
||||
case WINDOW_FRAME_CG:
|
||||
printf("frameType is CG %d,%d,%d\n",sel.FrameCgNoTop, sel.FrameCgNoMid, sel.FrameCgNoBot);
|
||||
@@ -278,30 +278,30 @@ static void init_selwindow() {
|
||||
DEBUG_MESSAGE("%d:%s\n", i +1, elm[i]);
|
||||
ags_drawString(r.x +2, r.y + i * (sel.MsgFontSize +2) +1, elm[i], sel.MsgFontColor);
|
||||
}
|
||||
ags_updateArea(saveArea.x, saveArea.y, saveArea.width, saveArea.height);
|
||||
ags_updateArea(saveArea.x, saveArea.y, saveArea.w, saveArea.h);
|
||||
|
||||
/* マウスカーソルの自動移動 */
|
||||
if (default_element == 0) {
|
||||
MyPoint p;
|
||||
sys_getMouseInfo(&p, TRUE);
|
||||
if (p.y < r.y) {
|
||||
ags_setCursorLocation(r.x + r.width * MOUSE_INIT_X_RATIO/100,
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
} else if (p.y > (r.y + r.height)) {
|
||||
ags_setCursorLocation(r.x + r.width * MOUSE_INIT_X_RATIO/100,
|
||||
} else if (p.y > (r.y + r.h)) {
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
} else {
|
||||
ags_setCursorLocation(r.x + r.width * MOUSE_INIT_X_RATIO/100,
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
p.y * MOUSE_INIT_Y_RATIO/100,
|
||||
TRUE);
|
||||
}
|
||||
} else if (default_element < regnum) {
|
||||
ags_setCursorLocation(r.x + r.width * MOUSE_INIT_X_RATIO/100,
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * default_element * MOUSE_INIT_Y_RATIO/100, TRUE);
|
||||
} else if (default_element < 1000) {
|
||||
ags_setCursorLocation(r.x + r.width * MOUSE_INIT_X_RATIO/100,
|
||||
ags_setCursorLocation(r.x + r.w * MOUSE_INIT_X_RATIO/100,
|
||||
r.y + (sel.MsgFontSize +2) * regnum * MOUSE_INIT_Y_RATIO/100, TRUE);
|
||||
}
|
||||
}
|
||||
@@ -309,7 +309,7 @@ static void init_selwindow() {
|
||||
static void remove_selwindow() {
|
||||
if (sel.win->save) {
|
||||
ags_restoreRegion(saveimg, saveArea.x, saveArea.y);
|
||||
ags_updateArea(saveArea.x, saveArea.y, saveArea.width, saveArea.height);
|
||||
ags_updateArea(saveArea.x, saveArea.y, saveArea.w, saveArea.h);
|
||||
saveimg = NULL;
|
||||
}
|
||||
}
|
||||
@@ -333,8 +333,8 @@ static int whereElement(void) {
|
||||
mpy = p.y;
|
||||
|
||||
for (i = 0; i < regnum; i++) {
|
||||
if (p.x >= r[i].x && p.x < r[i].x + r[i].width &&
|
||||
p.y >= r[i].y && p.y < r[i].y + r[i].height) {
|
||||
if (p.x >= r[i].x && p.x < r[i].x + r[i].w &&
|
||||
p.y >= r[i].y && p.y < r[i].y + r[i].h) {
|
||||
return i;
|
||||
}
|
||||
}
|
||||
@@ -342,10 +342,10 @@ static int whereElement(void) {
|
||||
}
|
||||
|
||||
static void lineEncloseElement(MyRectangle *r, int col, boolean thick) {
|
||||
ags_drawRectangle(r->x, r->y, r->width + 2, r->height + 2, col);
|
||||
ags_drawRectangle(r->x, r->y, r->w + 2, r->h + 2, col);
|
||||
if (thick)
|
||||
ags_drawRectangle(r->x + 1, r->y + 1, r->width, r->height, col);
|
||||
ags_updateArea(r->x, r->y, r->width + 2, r->height + 2);
|
||||
ags_drawRectangle(r->x + 1, r->y + 1, r->w, r->h, col);
|
||||
ags_updateArea(r->x, r->y, r->w + 2, r->h + 2);
|
||||
}
|
||||
|
||||
static void encloseElement(int sw, int no) {
|
||||
@@ -354,7 +354,7 @@ static void encloseElement(int sw, int no) {
|
||||
if (sw == 0) { /* off */
|
||||
if (sel.WinBackgroundTransparent != 255) {
|
||||
ags_restoreRegion(saveimg2, r->x, r->y);
|
||||
ags_updateArea(r->x, r->y, r->width +2, r->height +2);
|
||||
ags_updateArea(r->x, r->y, r->w +2, r->h +2);
|
||||
saveimg2 = NULL;
|
||||
} else {
|
||||
switch(sel.EncloseType) {
|
||||
@@ -363,9 +363,9 @@ static void encloseElement(int sw, int no) {
|
||||
case 1:
|
||||
lineEncloseElement(r, sel.WinBackgroundColor, FALSE); break;
|
||||
case 2:
|
||||
ags_fillRectangle(r->x, r->y, r->width +2, r->height +2, sel.WinBackgroundColor);
|
||||
ags_fillRectangle(r->x, r->y, r->w +2, r->h +2, sel.WinBackgroundColor);
|
||||
ags_drawString(r->x +2, r->y +1, elm[no], sel.MsgFontColor);
|
||||
ags_updateArea(r->x, r->y, r->width +2, r->height +2);
|
||||
ags_updateArea(r->x, r->y, r->w +2, r->h +2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -374,7 +374,7 @@ static void encloseElement(int sw, int no) {
|
||||
|
||||
} else { /* on */
|
||||
if (sel.WinBackgroundTransparent != 255) {
|
||||
saveimg2 = ags_saveRegion(r->x, r->y, r->width +2, r->height +2);
|
||||
saveimg2 = ags_saveRegion(r->x, r->y, r->w +2, r->h +2);
|
||||
}
|
||||
switch(sel.EncloseType) {
|
||||
case 0:
|
||||
@@ -382,9 +382,9 @@ static void encloseElement(int sw, int no) {
|
||||
case 1:
|
||||
lineEncloseElement(r, 255, FALSE); break;
|
||||
case 2:
|
||||
ags_fillRectangle(r->x, r->y, r->width +2, r->height +2, sel.MsgFontColor);
|
||||
ags_fillRectangle(r->x, r->y, r->w +2, r->h +2, sel.MsgFontColor);
|
||||
ags_drawString(r->x +2, r->y +1, elm[no], sel.WinBackgroundColor);
|
||||
ags_updateArea(r->x, r->y, r->width +2, r->height +2);
|
||||
ags_updateArea(r->x, r->y, r->w +2, r->h +2);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -424,10 +424,10 @@ void sel_select() {
|
||||
}
|
||||
|
||||
for (i = 0; i < regnum; i++) {
|
||||
workR[i].x = sel.win->x;
|
||||
workR[i].y = sel.win->y + i * (sel.MsgFontSize +2);
|
||||
workR[i].width = 2 + (sel.WinResizeWidth ? sel.MsgFontSize * maxElementLength : sel.win->width);
|
||||
workR[i].height = 2 + sel.MsgFontSize;
|
||||
workR[i].x = sel.win->x;
|
||||
workR[i].y = sel.win->y + i * (sel.MsgFontSize +2);
|
||||
workR[i].w = 2 + (sel.WinResizeWidth ? sel.MsgFontSize * maxElementLength : sel.win->width);
|
||||
workR[i].h = 2 + sel.MsgFontSize;
|
||||
}
|
||||
|
||||
sys_key_releasewait(SYS35KEY_RET, FALSE);
|
||||
|
||||
Reference in New Issue
Block a user