shtctl的指定省略

This commit is contained in:
Yourtion
2016-04-15 10:55:11 +08:00
parent de008d0ec5
commit cfde17cc0d
4 changed files with 26 additions and 23 deletions

View File

@@ -15,7 +15,7 @@ struct SHTCTL *shtctl_init(struct MEMMAN *memman, unsigned char *vram, int xsize
ctl->vram = vram;
ctl->xsize = xsize;
ctl->ysize = ysize;
ctl->top = -1; /* <EFBFBD>V<EFBFBD>[<5B>g<EFBFBD>͈ꖇ<CD88><EA9687><EFBFBD>Ȃ<EFBFBD> */
ctl->top = -1; /* 没有一张SHEET */
for (i = 0; i < MAX_SHEETS; i++) {
ctl->sheets0[i].flags = 0; /* 标记为未使用 */
}

View File

@@ -40,17 +40,17 @@ void HariMain(void)
sheet_setbuf(sht_mouse, buf_mouse, 16, 16, 99); /* 透明色号99 */
init_screen8(buf_back, binfo->scrnx, binfo->scrny);
init_mouse_cursor8(buf_mouse, 99); /* 背景色号99 */
sheet_slide(shtctl, sht_back, 0, 0);
sheet_slide(sht_back, 0, 0);
mx = (binfo->scrnx - 16) / 2; /* 按显示在画面中央来计算坐标 */
my = (binfo->scrny - 28 - 16) / 2;
sheet_slide(shtctl, sht_mouse, mx, my);
sheet_updown(shtctl, sht_back, 0);
sheet_updown(shtctl, sht_mouse, 1);
sheet_slide(sht_mouse, mx, my);
sheet_updown(sht_back, 0);
sheet_updown(sht_mouse, 1);
sprintf(s, "(%3d, %3d)", mx, my);
putfonts8_asc(buf_back, binfo->scrnx, 0, 0, COL8_FFFFFF, s);
sprintf(s, "memory %dMB free : %dKB", memtotal / (1024 * 1024), memman_total(memman) / 1024);
putfonts8_asc(buf_back, binfo->scrnx, 0, 32, COL8_FFFFFF, s);
sheet_refresh(shtctl, sht_back, 0, 0, binfo->scrnx, 48); /* 刷新文字 */
sheet_refresh(sht_back, 0, 0, binfo->scrnx, 48); /* 刷新文字 */
for (;;) {
io_cli();
@@ -63,7 +63,7 @@ void HariMain(void)
sprintf(s, "%02X", i);
boxfill8(buf_back, binfo->scrnx, COL8_008484, 0, 16, 15, 31);
putfonts8_asc(buf_back, binfo->scrnx, 0, 16, COL8_FFFFFF, s);
sheet_refresh(shtctl, sht_back, 0, 16, 16, 32); /* 刷新文字 */
sheet_refresh(sht_back, 0, 16, 16, 32); /* 刷新文字 */
} else if (fifo8_status(&mousefifo) != 0) {
i = fifo8_get(&mousefifo);
io_sti();
@@ -81,7 +81,7 @@ void HariMain(void)
}
boxfill8(buf_back, binfo->scrnx, COL8_008484, 32, 16, 32 + 15 * 8 - 1, 31);
putfonts8_asc(buf_back, binfo->scrnx, 32, 16, COL8_FFFFFF, s);
sheet_refresh(shtctl, sht_back, 32, 16, 32 + 15 * 8, 32); /* 刷新文字 */
sheet_refresh(sht_back, 32, 16, 32 + 15 * 8, 32); /* 刷新文字 */
/* 移动光标 */
mx += mdec.x;
my += mdec.y;
@@ -100,8 +100,8 @@ void HariMain(void)
sprintf(s, "(%3d, %3d)", mx, my);
boxfill8(buf_back, binfo->scrnx, COL8_008484, 0, 0, 79, 15); /* 消坐标 */
putfonts8_asc(buf_back, binfo->scrnx, 0, 0, COL8_FFFFFF, s); /* 写坐标 */
sheet_refresh(shtctl, sht_back, 0, 0, 80, 16); /* 刷新文字 */
sheet_slide(shtctl, sht_mouse, mx, my); /* 包含sheet_refresh含sheet_refresh */
sheet_refresh(sht_back, 0, 0, 80, 16); /* 刷新文字 */
sheet_slide(sht_mouse, mx, my); /* 包含sheet_refresh含sheet_refresh */
}
}
}

View File

@@ -149,6 +149,7 @@ int memman_free_4k(struct MEMMAN *man, unsigned int addr, unsigned int size);
struct SHEET {
unsigned char *buf;
int bxsize, bysize, vx0, vy0, col_inv, height, flags;
struct SHTCTL *ctl;
};
struct SHTCTL {
@@ -161,7 +162,7 @@ struct SHTCTL {
struct SHTCTL *shtctl_init(struct MEMMAN *memman, unsigned char *vram, int xsize, int ysize);
struct SHEET *sheet_alloc(struct SHTCTL *ctl);
void sheet_setbuf(struct SHEET *sht, unsigned char *buf, int xsize, int ysize, int col_inv);
void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height);
void sheet_refresh(struct SHTCTL *ctl, struct SHEET *sht, int bx0, int by0, int bx1, int by1);
void sheet_slide(struct SHTCTL *ctl, struct SHEET *sht, int vx0, int vy0);
void sheet_free(struct SHTCTL *ctl, struct SHEET *sht);
void sheet_updown(struct SHEET *sht, int height);
void sheet_refresh(struct SHEET *sht, int bx0, int by0, int bx1, int by1);
void sheet_slide(struct SHEET *sht, int vx0, int vy0);
void sheet_free(struct SHEET *sht);

View File

@@ -15,9 +15,10 @@ struct SHTCTL *shtctl_init(struct MEMMAN *memman, unsigned char *vram, int xsize
ctl->vram = vram;
ctl->xsize = xsize;
ctl->ysize = ysize;
ctl->top = -1; /* <EFBFBD>V<EFBFBD>[<5B>g<EFBFBD>͈ꖇ<CD88><EA9687><EFBFBD>Ȃ<EFBFBD> */
ctl->top = -1; /* 没有一张SHEET */
for (i = 0; i < MAX_SHEETS; i++) {
ctl->sheets0[i].flags = 0; /* 标记为未使用 */
ctl->sheets0[i].ctl = ctl; /* 记录所属*/
}
err:
return ctl;
@@ -47,8 +48,9 @@ void sheet_setbuf(struct SHEET *sht, unsigned char *buf, int xsize, int ysize, i
return;
}
void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height)
void sheet_updown(struct SHEET *sht, int height)
{
struct SHTCTL *ctl = sht->ctl;
int h, old = sht->height; /* 存储设置前的高度信息 */
if (height > ctl->top + 1) {
height = ctl->top + 1;
@@ -100,10 +102,10 @@ void sheet_updown(struct SHTCTL *ctl, struct SHEET *sht, int height)
return;
}
void sheet_refresh(struct SHTCTL *ctl, struct SHEET *sht, int bx0, int by0, int bx1, int by1)
void sheet_refresh(struct SHEET *sht, int bx0, int by0, int bx1, int by1)
{
if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面*/
sheet_refreshsub(ctl, sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1);
sheet_refreshsub(sht->ctl, sht->vx0 + bx0, sht->vy0 + by0, sht->vx0 + bx1, sht->vy0 + by1);
}
return;
}
@@ -148,22 +150,22 @@ void sheet_refreshsub(struct SHTCTL *ctl, int vx0, int vy0, int vx1, int vy1)
}
void sheet_slide(struct SHTCTL *ctl, struct SHEET *sht, int vx0, int vy0)
void sheet_slide(struct SHEET *sht, int vx0, int vy0)
{
int old_vx0 = sht->vx0, old_vy0 = sht->vy0;
sht->vx0 = vx0;
sht->vy0 = vy0;
if (sht->height >= 0) { /* 如果正在显示,则按新图层的信息刷新画面 */
sheet_refreshsub(ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize);
sheet_refreshsub(ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize);
sheet_refreshsub(sht->ctl, old_vx0, old_vy0, old_vx0 + sht->bxsize, old_vy0 + sht->bysize);
sheet_refreshsub(sht->ctl, vx0, vy0, vx0 + sht->bxsize, vy0 + sht->bysize);
}
return;
}
void sheet_free(struct SHTCTL *ctl, struct SHEET *sht)
void sheet_free(struct SHEET *sht)
{
if (sht->height >= 0) {
sheet_updown(ctl, sht, -1); /* 如果处于显示状态,则先设定为隐藏 */
sheet_updown(sht, -1); /* 如果处于显示状态,则先设定为隐藏 */
}
sht->flags = 0; /* "未使用"标志 */
return;