4 extern IO_MemoryControl sys_mem_ctrl;
\r
6 UI_Sheet_Control sys_sheet_ctrl;
\r
8 void Sheet_Initialise(UI_Sheet_Control *sheetctrl, IO_MemoryControl *memctrl, void *vram, uint xsize, uint ysize, uint bpp)
\r
12 sheetctrl->memctrl = memctrl;
\r
14 sheetctrl->mainvram = vram;
\r
15 sheetctrl->map = MemoryBlock_Allocate_User(xsize * ysize * 4, sheetctrl->memctrl);
\r
16 MemoryBlock_Write_Description(sheetctrl->map, "SHTCTRL_MAP");
\r
17 for(y = 0; y < ysize; y++){
\r
18 for(x = 0; x < xsize; x++){
\r
19 sheetctrl->map[(y * xsize) + x] = 0;
\r
22 sheetctrl->mainvramsize.x = xsize;
\r
23 sheetctrl->mainvramsize.y = ysize;
\r
24 sheetctrl->mainvrambpp = bpp;
\r
26 sheetctrl->base.vram = 0;
\r
27 sheetctrl->base.position.x = 0;
\r
28 sheetctrl->base.position.y = 0;
\r
29 sheetctrl->base.size.x = 0;
\r
30 sheetctrl->base.size.y = 0;
\r
31 sheetctrl->base.bpp = 0;
\r
32 sheetctrl->base.invcol = 0;
\r
33 sheetctrl->base.next = 0;
\r
34 sheetctrl->base.before = 0;
\r
35 sheetctrl->base.Refresh = 0;
\r
36 sheetctrl->base.WriteMap = 0;
\r
37 sheetctrl->base.visible = false;
\r
38 sheetctrl->base.mouse_movable = false;
\r
39 sheetctrl->base.myctrl = sheetctrl;
\r
40 sheetctrl->base.fifo = 0;
\r
41 sheetctrl->base.msignal_flags = 0;
\r
42 sheetctrl->base.ksignal_flags = 0;
\r
44 sheetctrl->sheets = 0;
\r
48 UI_Sheet *Sheet_Get(UI_Sheet_Control *ctrl, uint xsize, uint ysize, uint bpp, uint invcol)
\r
53 bpp = ctrl->mainvrambpp;
\r
56 sheet = MemoryBlock_Allocate_User(sizeof(UI_Sheet), ctrl->memctrl);
\r
57 MemoryBlock_Write_Description(sheet, "UI_Sheet");
\r
58 sheet->vram = MemoryBlock_Allocate_User(xsize * ysize * (bpp >> 3), ctrl->memctrl);
\r
59 MemoryBlock_Write_Description(sheet->vram, "UI_Sheet_VRAM");
\r
60 sheet->position.x = 0;
\r
61 sheet->position.y = 0;
\r
62 sheet->size.x = xsize;
\r
63 sheet->size.y = ysize;
\r
65 sheet->invcol = invcol;
\r
66 if(sheet->invcol == 0){
\r
67 sheet->WriteMap = Sheet_Write_Map_NoInvisible;
\r
68 } else if(sheet->bpp == 32){
\r
69 sheet->WriteMap = Sheet_Write_Map_32;
\r
70 } else if(sheet->bpp == 16){
\r
71 sheet->WriteMap = Sheet_Write_Map_16;
\r
72 sheet->invcol = RGB_32_To_16(sheet->invcol);
\r
73 } else if(sheet->bpp == 8){
\r
74 sheet->WriteMap = Sheet_Write_Map_08;
\r
75 sheet->invcol = RGB_32_To_08(sheet->invcol);
\r
80 sheet->Refresh = Sheet_Refresh_Invalid;
\r
81 sheet->myctrl = ctrl;
\r
83 sheet->visible = false;
\r
84 sheet->mouse_movable = false;
\r
85 sheet->MouseEventProcedure = 0;
\r
87 sheet->msignal_flags = 0;
\r
88 sheet->ksignal_flags = 0;
\r
93 uint Sheet_Show(UI_Sheet *sheet, int px, int py, uint height)
\r
97 UI_Sheet_Control *ctrl;
\r
100 eflags = IO_Load_EFlags();
\r
103 ctrl = sheet->myctrl;
\r
106 for(i = 0; i <= height; i++){
\r
107 if(now->next == 0){
\r
115 now->next->before = sheet;
\r
116 sheet->next = now->next;
\r
117 sheet->before = now;
\r
121 sheet->position.x = px;
\r
122 sheet->position.y = py;
\r
123 sheet->visible = true;
\r
125 if(ctrl->mainvrambpp == 32){
\r
126 if(sheet->bpp == 32){
\r
127 sheet->Refresh = Sheet_Refresh_32from32;
\r
128 // } else if(sheet->bpp == 16){
\r
130 // } else if(sheet->bpp == 8){
\r
133 } else if(ctrl->mainvrambpp == 16){
\r
134 if(sheet->bpp == 32){
\r
135 sheet->Refresh = Sheet_Refresh_16from32;
\r
136 } else if(sheet->bpp == 16){
\r
137 sheet->Refresh = Sheet_Refresh_16from16;
\r
138 // } else if(sheet->bpp == 8){
\r
141 } else if(ctrl->mainvrambpp == 8){
\r
142 if(sheet->bpp == 32){
\r
143 sheet->Refresh = Sheet_Refresh_08from32;
\r
144 // } else if(sheet->bpp == 16){
\r
146 } else if(sheet->bpp == 8){
\r
147 sheet->Refresh = Sheet_Refresh_08from08;
\r
150 IO_Store_EFlags(eflags);
\r
152 Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);
\r
153 sheet->Refresh(sheet, 0, 0, sheet->size.x - 1, sheet->size.y - 1);
\r
158 void Sheet_Set_Movable(UI_Sheet *sheet, bool movable)
\r
160 sheet->mouse_movable = movable;
\r
164 void Sheet_Set_MouseEventProcedure(UI_Sheet *sheet, void (*procedure)(UI_MouseEventArguments *e), uint flags)
\r
166 sheet->MouseEventProcedure = procedure;
\r
167 sheet->msignal_flags = flags;
\r
171 void Sheet_Set_FIFO(UI_Sheet *sheet, DATA_FIFO *fifo, uint flags)
\r
173 sheet->fifo = fifo;
\r
174 sheet->ksignal_flags = flags;
\r
178 void Sheet_Slide(UI_Sheet *sheet, int px, int py)
\r
181 DATA_Position2D target0, target1;
\r
182 UI_Sheet_Control *ctrl;
\r
184 ctrl = sheet->myctrl;
\r
185 movex = px - sheet->position.x;
\r
186 movey = py - sheet->position.y;
\r
188 if(movex == 0 && movey == 0){ //
\93®
\82©
\82È
\82¢
\r
191 if(movey == 0){ //
\89¡
\82É
\83X
\83\89\83C
\83h
\82·
\82é
\82¾
\82¯
\r
192 target0.y = sheet->position.y;
\r
193 target1.y = sheet->position.y + sheet->size.y - 1;
\r
194 if(movex > 0){ //
\89E
\95û
\8cü
\r
195 target0.x = sheet->position.x;
\r
196 target1.x = sheet->position.x + sheet->size.x - 1 + movex;
\r
197 } else{ //
\8d¶
\95û
\8cü
\r
198 target0.x = sheet->position.x + movex;
\r
199 target1.x = sheet->position.x + sheet->size.x - 1;
\r
201 } else if(movex == 0){ //
\8fc
\82É
\83X
\83\89\83C
\83h
\82·
\82é
\82¾
\82¯
\r
202 target0.x = sheet->position.x;
\r
203 target1.x = sheet->position.x + sheet->size.x - 1;
\r
204 if(movey > 0){ //
\89º
\95û
\8cü
\r
205 target0.y = sheet->position.y;
\r
206 target1.y = sheet->position.y + sheet->size.y - 1 + movey;
\r
207 } else{ //
\8fã
\95û
\8cü
\r
208 target0.y = sheet->position.y + movey;
\r
209 target1.y = sheet->position.y + sheet->size.y - 1;
\r
211 } else if(movex > 0 && movey > 0){ //
\89E
\89º
\82Ö
\83X
\83\89\83C
\83h
\r
212 target0.x = sheet->position.x;
\r
213 target0.y = sheet->position.y;
\r
214 target1.x = sheet->position.x + sheet->size.x - 1 + movex;
\r
215 target1.y = sheet->position.y + sheet->size.y - 1 + movey;
\r
216 } else if(movex > 0 && movey < 0){ //
\89E
\8fã
\82Ö
\83X
\83\89\83C
\83h
\r
217 target0.x = sheet->position.x;
\r
218 target0.y = sheet->position.y + movey;
\r
219 target1.x = sheet->position.x + sheet->size.x - 1 + movex;
\r
220 target1.y = sheet->position.y + sheet->size.y - 1;
\r
221 } else if(movex < 0 && movey > 0){ //
\8d¶
\89º
\82Ö
\83X
\83\89\83C
\83h
\r
222 target0.x = sheet->position.x + movex;
\r
223 target0.y = sheet->position.y;
\r
224 target1.x = sheet->position.x + sheet->size.x - 1;
\r
225 target1.y = sheet->position.y + sheet->size.y - 1 + movey;
\r
226 } else if(movex < 0 && movey < 0){ //
\8d¶
\8fã
\82Ö
\83X
\83\89\83C
\83h
\r
227 target0.x = sheet->position.x + movex;
\r
228 target0.y = sheet->position.y + movey;
\r
229 target1.x = sheet->position.x + sheet->size.x - 1;
\r
230 target1.y = sheet->position.y + sheet->size.y - 1;
\r
233 sheet->visible = false;
\r
234 Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);
\r
235 sheet->position.x = px;
\r
236 sheet->position.y = py;
\r
237 sheet->visible = true;
\r
238 Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);
\r
239 Sheet_Refresh_All(ctrl->base.next, sheet->next, target0.x, target0.y, target1.x, target1.y);
\r
243 uint Sheet_UpDown(UI_Sheet *sheet, uint height)
\r
248 if(sheet->before == 0){
\r
252 now = &sheet->myctrl->base;
\r
254 for(i = 0; now != sheet; i++){
\r
260 Sheet_Remove(sheet);
\r
261 return Sheet_Show(sheet, sheet->position.x, sheet->position.y, height - 1);
\r
264 void Sheet_Remove(UI_Sheet *sheet)
\r
266 UI_Sheet_Control *ctrl;
\r
269 eflags = IO_Load_EFlags();
\r
272 ctrl = sheet->myctrl;
\r
275 sheet->visible = false;
\r
276 Sheet_Refresh_Map(sheet, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);
\r
277 sheet->before->next = sheet->next;
\r
278 sheet->next->before = sheet->before;
\r
279 Sheet_Refresh_All(ctrl->base.next, sheet->next, sheet->position.x, sheet->position.y, sheet->position.x + sheet->size.x - 1, sheet->position.y + sheet->size.y - 1);
\r
283 IO_Store_EFlags(eflags);
\r
287 void Sheet_Refresh_Map(UI_Sheet *sheet, int x0, int y0, int x1, int y1)
\r
291 DATA_Position2D target0, target1;
\r
292 UI_Sheet_Control *ctrl;
\r
294 ctrl = sheet->myctrl;
\r
295 if(x0 >= ctrl->mainvramsize.x || y0 >= ctrl->mainvramsize.y || x1 < 0 || y1 < 0){
\r
304 if(x1 >= ctrl->mainvramsize.x){
\r
305 x1 = ctrl->mainvramsize.x - 1;
\r
307 if(y1 >= ctrl->mainvramsize.y){
\r
308 y1 = ctrl->mainvramsize.y - 1;
\r
311 before = &ctrl->base.next;
\r
312 for(i = 0; i < ctrl->sheets; i++){
\r
313 for(y = y0; y <= y1; y++){
\r
314 for(x = x0; x <= x1; x++){
\r
315 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)*before){
\r
316 ctrl->map[(y * ctrl->mainvramsize.x) + x] = 0;
\r
320 if(*before == sheet){
\r
323 before = &(*before)->next;
\r
329 target0.x = (*before)->position.x;
\r
330 target0.y = (*before)->position.y;
\r
331 target1.x = (*before)->position.x + (*before)->size.x - 1;
\r
332 target1.y = (*before)->position.y + (*before)->size.y - 1;
\r
334 if(target0.x <= x1 && target0.y <= y1 && target1.x >= x0 && target1.y >= y0 && (*before)->visible){
\r
335 if(target0.x < x0){
\r
338 if(target0.y < y0){
\r
341 if(target1.x > x1){
\r
344 if(target1.y > y1){
\r
347 (*before)->WriteMap(*before, target0.x, target0.y, target1.x, target1.y);
\r
349 before = &(*before)->before;
\r
354 void Sheet_Write_Map_32(UI_Sheet *sheet, int x0, int y0, int x1, int y1)
\r
357 UI_Sheet_Control *ctrl;
\r
359 ctrl = sheet->myctrl;
\r
360 for(y = y0; y <= y1; y++){
\r
361 for(x = x0; x <= x1; x++){
\r
362 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != sheet->invcol){
\r
363 ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;
\r
370 void Sheet_Write_Map_16(UI_Sheet *sheet, int x0, int y0, int x1, int y1)
\r
373 UI_Sheet_Control *ctrl;
\r
375 ctrl = sheet->myctrl;
\r
376 for(y = y0; y <= y1; y++){
\r
377 for(x = x0; x <= x1; x++){
\r
378 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((ushort *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != (ushort)sheet->invcol){
\r
379 ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;
\r
386 void Sheet_Write_Map_08(UI_Sheet *sheet, int x0, int y0, int x1, int y1)
\r
389 UI_Sheet_Control *ctrl;
\r
391 ctrl = sheet->myctrl;
\r
392 for(y = y0; y <= y1; y++){
\r
393 for(x = x0; x <= x1; x++){
\r
394 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0 && ((uchar *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)] != (uchar)sheet->invcol){
\r
395 ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;
\r
402 void Sheet_Write_Map_NoInvisible(UI_Sheet *sheet, int x0, int y0, int x1, int y1)
\r
405 UI_Sheet_Control *ctrl;
\r
407 ctrl = sheet->myctrl;
\r
408 for(y = y0; y <= y1; y++){
\r
409 for(x = x0; x <= x1; x++){
\r
410 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == 0){
\r
411 ctrl->map[(y * ctrl->mainvramsize.x) + x] = (uint)sheet;
\r
418 void Sheet_Refresh_All(UI_Sheet *sheet0, UI_Sheet *sheet1, int x0, int y0, int x1, int y1)
\r
422 DATA_Position2D target0, target1;
\r
423 UI_Sheet_Control *ctrl;
\r
425 ctrl = sheet0->myctrl;
\r
427 for(i = 0; i < ctrl->sheets; i++){
\r
428 target0.x = now->position.x;
\r
429 target0.y = now->position.y;
\r
430 target1.x = now->position.x + now->size.x - 1;
\r
431 target1.y = now->position.y + now->size.y - 1;
\r
433 if(target0.x <= x1 && target0.y <= y1 && target1.x >= x0 && target1.y >= y0 && now->visible){
\r
434 if(target0.x < x0){
\r
437 if(target0.y < y0){
\r
440 if(target1.x > x1){
\r
443 if(target1.y > y1){
\r
446 now->Refresh(now, target0.x - now->position.x, target0.y - now->position.y, target1.x - now->position.x, target1.y - now->position.y);
\r
448 if(now->next == sheet1 || now->next == 0){
\r
456 void Sheet_Refresh_32from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
459 UI_Sheet_Control *ctrl;
\r
461 ctrl = sheet->myctrl;
\r
462 px0 = px0 + sheet->position.x;
\r
463 py0 = py0 + sheet->position.y;
\r
464 px1 = px1 + sheet->position.x;
\r
465 py1 = py1 + sheet->position.y;
\r
467 if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){
\r
476 if(px1 >= ctrl->mainvramsize.x){
\r
477 px1 = ctrl->mainvramsize.x - 1;
\r
479 if(py1 >= ctrl->mainvramsize.y){
\r
480 py1 = ctrl->mainvramsize.y - 1;
\r
483 for(y = py0; y <= py1; y++){
\r
484 for(x = px0; x <= px1; x++){
\r
485 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){
\r
486 ((uint *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];
\r
493 void Sheet_Refresh_16from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
496 UI_Sheet_Control *ctrl;
\r
498 ctrl = sheet->myctrl;
\r
499 px0 = px0 + sheet->position.x;
\r
500 py0 = py0 + sheet->position.y;
\r
501 px1 = px1 + sheet->position.x;
\r
502 py1 = py1 + sheet->position.y;
\r
504 if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){
\r
513 if(px1 >= ctrl->mainvramsize.x){
\r
514 px1 = ctrl->mainvramsize.x - 1;
\r
516 if(py1 >= ctrl->mainvramsize.y){
\r
517 py1 = ctrl->mainvramsize.y - 1;
\r
520 for(y = py0; y <= py1; y++){
\r
521 for(x = px0; x <= px1; x++){
\r
522 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){
\r
523 ((ushort *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = RGB_32_To_16(((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)]);
\r
530 void Sheet_Refresh_08from32(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
533 UI_Sheet_Control *ctrl;
\r
535 ctrl = sheet->myctrl;
\r
536 px0 = px0 + sheet->position.x;
\r
537 py0 = py0 + sheet->position.y;
\r
538 px1 = px1 + sheet->position.x;
\r
539 py1 = py1 + sheet->position.y;
\r
541 if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){
\r
550 if(px1 >= ctrl->mainvramsize.x){
\r
551 px1 = ctrl->mainvramsize.x - 1;
\r
553 if(py1 >= ctrl->mainvramsize.y){
\r
554 py1 = ctrl->mainvramsize.y - 1;
\r
557 for(y = py0; y <= py1; y++){
\r
558 for(x = px0; x <= px1; x++){
\r
559 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){
\r
560 ((uchar *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = RGB_32_To_08_xy(((uint *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)], x, y);
\r
567 void Sheet_Refresh_16from16(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
570 UI_Sheet_Control *ctrl;
\r
572 ctrl = sheet->myctrl;
\r
573 px0 = px0 + sheet->position.x;
\r
574 py0 = py0 + sheet->position.y;
\r
575 px1 = px1 + sheet->position.x;
\r
576 py1 = py1 + sheet->position.y;
\r
578 if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){
\r
587 if(px1 >= ctrl->mainvramsize.x){
\r
588 px1 = ctrl->mainvramsize.x - 1;
\r
590 if(py1 >= ctrl->mainvramsize.y){
\r
591 py1 = ctrl->mainvramsize.y - 1;
\r
594 for(y = py0; y <= py1; y++){
\r
595 for(x = px0; x <= px1; x++){
\r
596 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){
\r
597 ((ushort *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((ushort *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];
\r
604 void Sheet_Refresh_08from08(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
607 UI_Sheet_Control *ctrl;
\r
609 ctrl = sheet->myctrl;
\r
610 px0 = px0 + sheet->position.x;
\r
611 py0 = py0 + sheet->position.y;
\r
612 px1 = px1 + sheet->position.x;
\r
613 py1 = py1 + sheet->position.y;
\r
615 if(px0 >= ctrl->mainvramsize.x || py0 >= ctrl->mainvramsize.y || px1 < 0 || py1 < 0){
\r
624 if(px1 >= ctrl->mainvramsize.x){
\r
625 px1 = ctrl->mainvramsize.x - 1;
\r
627 if(py1 >= ctrl->mainvramsize.y){
\r
628 py1 = ctrl->mainvramsize.y - 1;
\r
631 for(y = py0; y <= py1; y++){
\r
632 for(x = px0; x <= px1; x++){
\r
633 if(ctrl->map[(y * ctrl->mainvramsize.x) + x] == (uint)sheet){
\r
634 ((uchar *)ctrl->mainvram)[(y * ctrl->mainvramsize.x) + x] = ((uchar *)sheet->vram)[((y - sheet->position.y) * sheet->size.x) + (x - sheet->position.x)];
\r
641 void Sheet_Refresh_Invalid(UI_Sheet *sheet, int px0, int py0, int px1, int py1)
\r
646 void Sheet_Draw_Put_String(UI_Sheet *sheet, uint x, uint y, uint c, const uchar *s)
\r
650 for(i = 0; s[i] != 0x00; i++){
\r
654 if(y > sheet->size.y - 16){
\r
658 if(sheet->bpp == 32){
\r
659 Draw_Put_String_32(sheet->vram, sheet->size.x, x, y, c, s);
\r
660 } else if(sheet->bpp == 16){
\r
661 Draw_Put_String_16(sheet->vram, sheet->size.x, x, y, c, s);
\r
662 } else if(sheet->bpp == 8){
\r
663 Draw_Put_String_08(sheet->vram, sheet->size.x, x, y, c, s);
\r
666 sheet->Refresh(sheet, x, y, x + (i * 8), y + 16);
\r
670 void Sheet_Draw_Put_String_With_BackColor(UI_Sheet *sheet, uint x, uint y, uint c, uint bc, const uchar *s)
\r
674 for(i = 0; s[i] != 0x00; i++){
\r
678 Sheet_Draw_Fill_Rectangle(sheet, bc, x, y, x + (i * 8) - 1, y + 16 - 1);
\r
680 if(y > sheet->size.y - 16){
\r
684 if(sheet->bpp == 32){
\r
685 Draw_Put_String_32(sheet->vram, sheet->size.x, x, y, c, s);
\r
686 } else if(sheet->bpp == 16){
\r
687 Draw_Put_String_16(sheet->vram, sheet->size.x, x, y, c, s);
\r
688 } else if(sheet->bpp == 8){
\r
689 Draw_Put_String_08(sheet->vram, sheet->size.x, x, y, c, s);
\r
692 sheet->Refresh(sheet, x, y, x + (i * 8), y + 16);
\r
696 void Sheet_Draw_Fill_Rectangle(UI_Sheet *sheet, uint c, uint x0, uint y0, uint x1, uint y1)
\r
698 if(x1 >= sheet->size.x || y1 >= sheet->size.y){
\r
702 if(sheet->bpp == 32){
\r
703 Draw_Fill_Rectangle_32(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);
\r
704 } else if(sheet->bpp == 16){
\r
705 Draw_Fill_Rectangle_16(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);
\r
706 } else if(sheet->bpp == 8){
\r
707 Draw_Fill_Rectangle_08(sheet->vram, sheet->size.x, c, x0, y0, x1, y1);
\r
709 sheet->Refresh(sheet, x0, y0, x1, y1);
\r
713 void Sheet_Draw_Fill_Rectangle_Gradation_Vertical(UI_Sheet *sheet, uint c0, uint c1, uint x0, uint y0, uint x1, uint y1)
\r
715 int nowcol, nowcol_R, nowcol_G, nowcol_B, add_R, add_G, add_B;
\r
718 if(x1 >= sheet->size.x || y1 >= sheet->size.y){
\r
729 add_R = (((int)((c1 & 0x00ff0000) >> 16) << 10) - ((int)((c0 & 0x00ff0000) >> 16) << 10)) / (int)(y1 - y0);
\r
730 add_G = (((int)((c1 & 0x0000ff00) >> 8) << 10) - ((int)((c0 & 0x0000ff00) >> 8) << 10)) / (int)(y1 - y0);
\r
731 add_B = (((int)(c1 & 0x000000ff) << 10) - ((int)(c0 & 0x000000ff) << 10)) / (int)(y1 - y0);
\r
733 nowcol_R = ((c0 & 0x00ff0000) >> 16) << 10;
\r
734 nowcol_G = ((c0 & 0x0000ff00) >> 8) << 10;
\r
735 nowcol_B = (c0 & 0x000000ff) << 10;
\r
737 for(y = y0; y <= y1; y++){
\r
738 nowcol = ((nowcol_R >> 10) << 16) | ((nowcol_G >> 10) << 8) | (nowcol_B >> 10);
\r
739 for(x = x0; x <= x1; x++){
\r
740 Sheet_Draw_Point(sheet, (uint)nowcol, x, y);
\r
749 void Sheet_Draw_Point(UI_Sheet *sheet, uint c, uint x, uint y)
\r
751 if(sheet->bpp == 32){
\r
752 ((uint *)sheet->vram)[y * sheet->size.x + x] = c;
\r
753 } else if(sheet->bpp == 16){
\r
754 c = RGB_32_To_16(c);
\r
755 ((ushort *)sheet->vram)[y * sheet->size.x + x] = (ushort)c;
\r
756 } else if(sheet->bpp == 8){
\r
757 // c = RGB_32_To_08(c);
\r
758 c = RGB_32_To_08_xy(c, x, y);
\r
759 ((uchar *)sheet->vram)[y * sheet->size.x + x] = (uchar)c;
\r
761 sheet->Refresh(sheet, x, y, x, y);
\r
765 void System_Sheet_Initialise(void *vram, uint xsize, uint ysize, uint bpp)
\r
767 Sheet_Initialise(&sys_sheet_ctrl, &sys_mem_ctrl, vram, xsize, ysize, bpp);
\r
771 UI_Sheet *System_Sheet_Get(uint xsize, uint ysize, uint bpp, uint invcol)
\r
773 return Sheet_Get(&sys_sheet_ctrl, xsize, ysize, bpp, invcol);
\r
776 UI_Sheet *Sheet_Get_From_Position(UI_Sheet_Control *ctrl, int x, int y)
\r
778 if(x < 0 || y < 0 || x > ctrl->mainvramsize.x || y > ctrl->mainvramsize.y){
\r
781 return (UI_Sheet *)ctrl->map[(y * ctrl->mainvramsize.x) + x];
\r
784 uint Sheet_Get_Top_Of_Height(UI_Sheet_Control *ctrl)
\r
786 if(ctrl->sheets < 1){
\r
789 return ctrl->sheets - 1;
\r
792 uint System_Sheet_Get_Top_Of_Height(void)
\r
794 return Sheet_Get_Top_Of_Height(&sys_sheet_ctrl);
\r