1 /***************************************************************************
3 * Open \______ \ ____ ____ | | _\_ |__ _______ ___
4 * Source | _// _ \_/ ___\| |/ /| __ \ / _ \ \/ /
5 * Jukebox | | ( <_> ) \___| < | \_\ ( <_> > < <
6 * Firmware |____|_ /\____/ \___ >__|_ \|___ /\____/__/\_ \
10 * Copyright (C) 2007-2009 Joshua Simmons <mud at majidejima dot com>
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License
14 * as published by the Free Software Foundation; either version 2
15 * of the License, or (at your option) any later version.
17 * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
18 * KIND, either express or implied.
20 ****************************************************************************/
28 /* for xlcd_filltriangle */
31 unsigned int intersection_size
= 0;
33 #define LINE_OFFSET (intersection_size / 2)
35 /* pixel offsets for the board on the LCD */
38 int board_pixel_width
= 0;
39 int board_pixel_height
= 0;
41 /* current cursor position in board coordinates (intersections, not
43 unsigned short cursor_pos
= POS (0, 0);
45 /* we way need to "move" our notion of which intersections to draw when
46 the cursor moves, since we can be zoomed in (and often will be) this is
47 used to signal when we need to do that */
48 unsigned short last_cursor_pos
= INVALID_POS
;
49 unsigned int last_int_size
= MAX_INT_SIZE
+ 1;
51 unsigned int min_x_int
= 0;
52 unsigned int min_y_int
= 0;
53 unsigned int num_x_ints
= 0;
54 unsigned int num_y_ints
= 0;
56 int extend_t
= 0, extend_b
= 0, extend_l
= 0, extend_r
= 0;
58 bool draw_variations
= true;
59 unsigned int saved_circle_size
= 0;
60 bool has_comment
= false;
62 unsigned char display_marks
[MAX_BOARD_SIZE
* MAX_BOARD_SIZE
];
65 /* function prototypes */
67 static int pixel_x (unsigned short pos
);
68 static int pixel_y (unsigned short pos
);
70 static void draw_circle (int c_x
, int c_y
, int r
, bool filled
);
72 static void draw_cursor (unsigned short pos
);
73 static void draw_stone_raw (int pixel_x
, int pixel_y
, bool black
);
74 static void draw_stone (unsigned short pos
, bool black
);
75 static void draw_all_stones (void);
77 static void draw_hoshi (unsigned short pos
);
78 static void draw_footer (void);
79 static void draw_all_marks (void);
80 static void draw_all_hoshi (void);
82 static unsigned int unzoomed_int_size (void);
83 static void cursor_updated (void);
86 clear_marks_display (void)
88 rb
->memset (display_marks
, ' ', sizeof (display_marks
));
93 set_mark_display (unsigned short pos
, unsigned char mark_char
)
100 if ((mark_char
== 'b' || mark_char
== 'w') &&
101 display_marks
[I (pos
) + J (pos
) * board_width
] != ' ')
103 /* don't overwrite real board marks with last-move or variation
108 display_marks
[I (pos
) + J (pos
) * board_width
] = mark_char
;
113 set_comment_display (bool new_val
)
115 has_comment
= new_val
;
120 draw_all_marks (void)
123 for (x
= MIN_X
; x
< MAX_X
; ++x
)
125 for (y
= MIN_Y
; y
< MAX_Y
; ++y
)
127 if (display_marks
[x
+ y
* board_width
] != ' ')
130 if (display_marks
[x
+ y
* board_width
] != 'b' &&
131 display_marks
[x
+ y
* board_width
] != 'w')
133 rb
->lcd_set_foreground (MARK_COLOR
);
137 rb
->lcd_set_foreground (CURSOR_COLOR
);
139 rb
->lcd_set_drawmode (DRMODE_FG
);
141 rb
->lcd_set_drawmode (DRMODE_FG
+ DRMODE_COMPLEMENT
);
144 if (display_marks
[x
+ y
* board_width
] & (1 << 7))
150 display_marks
[x
+ y
* board_width
] & (~(1 << 7));
151 to_display
[1] = '\0';
153 rb
->lcd_getstringsize (to_display
, &width
, &height
);
156 pixel_x (POS (x
, y
)) + LINE_OFFSET
- (width
/ 2);
158 pixel_y (POS (x
, y
)) + LINE_OFFSET
- (height
/ 2);
170 if (display_x
+ width
>= LCD_WIDTH
)
172 display_x
= LCD_WIDTH
- 1 - width
;
175 if (display_y
+ height
>= LCD_HEIGHT
)
177 display_y
= LCD_HEIGHT
- 1 - height
;
180 rb
->lcd_putsxy (display_x
, display_y
, to_display
);
184 switch (display_marks
[x
+ y
* board_width
])
186 /* moves, 'mark', 'square' */
189 if (intersection_size
<= 5)
191 DEBUGF ("screen is too small to mark current move\n");
195 if (intersection_size
<= 5)
197 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
+
199 pixel_y (POS (x
, y
)) + LINE_OFFSET
+
201 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
-
203 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
208 rb
->lcd_drawrect (pixel_x (POS (x
, y
)) + LINE_OFFSET
-
209 intersection_size
/ 6,
210 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
211 intersection_size
/ 6,
212 (intersection_size
/ 6) * 2 + 1,
213 (intersection_size
/ 6) * 2 + 1);
217 if (intersection_size
<= 5)
219 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
+
221 pixel_y (POS (x
, y
)) + LINE_OFFSET
+
223 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
-
225 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
230 rb
->lcd_fillrect (pixel_x (POS (x
, y
)) + LINE_OFFSET
-
231 intersection_size
/ 6,
232 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
233 intersection_size
/ 6,
234 (intersection_size
/ 6) * 2 + 1,
235 (intersection_size
/ 6) * 2 + 1);
240 if (intersection_size
> 7)
242 draw_circle (pixel_x (POS (x
, y
)) + LINE_OFFSET
,
243 pixel_y (POS (x
, y
)) + LINE_OFFSET
,
244 (intersection_size
- 1) / 4, true);
248 /* purposely don't break here, draw small the same as
252 if (intersection_size
<= 7)
254 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
-
256 pixel_y (POS (x
, y
)) + LINE_OFFSET
+
258 rb
->lcd_drawpixel (pixel_x (POS (x
, y
)) + LINE_OFFSET
+
260 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
265 xlcd_filltriangle (pixel_x (POS (x
, y
)) + LINE_OFFSET
,
266 pixel_y (POS (x
, y
)) + LINE_OFFSET
-
267 intersection_size
/ 4,
268 pixel_x (POS (x
, y
)) + LINE_OFFSET
+
269 intersection_size
/ 4,
270 pixel_y (POS (x
, y
)) + LINE_OFFSET
+
271 intersection_size
/ 4,
272 pixel_x (POS (x
, y
)) + LINE_OFFSET
-
273 intersection_size
/ 4,
274 pixel_y (POS (x
, y
)) + LINE_OFFSET
+
275 intersection_size
/ 4);
279 DEBUGF ("tried to display unknown mark '%c' %d\n",
280 display_marks
[x
+ y
* board_width
],
281 display_marks
[x
+ y
* board_width
]);
285 rb
->lcd_set_drawmode (DRMODE_SOLID
);
286 /* don't have to undo the colors for LCD_DEPTH > 1, most
287 functions assume bg and fg get clobbered */
295 draw_circle (int c_x
, int c_y
, int r
, bool filled
)
301 /* draw the points on the axes to make the loop easier */
302 rb
->lcd_drawpixel (c_x
, c_y
+ r
);
303 rb
->lcd_drawpixel (c_x
, c_y
- r
);
307 rb
->lcd_hline (c_x
- r
, c_x
+ r
, c_y
);
311 rb
->lcd_drawpixel (c_x
+ r
, c_y
);
312 rb
->lcd_drawpixel (c_x
- r
, c_y
);
315 /* Now walk from the very top of the circle to 1/8th of the way around
316 to the right. For each point, draw the 8 symmetrical points. */
319 /* walk one pixel to the right */
322 /* And then adjust our discriminant, and adjust y if we've
323 ventured outside of the circle. This boils down to walking a
324 tightrope between being inside and outside the circle. The
325 updating functions are taken from expanding the discriminant
326 function f(x, y) = x^2 + y^2 - r^2 after substituting in x + 1
327 and y - 1 and then subtracting out f(x, y) */
335 f
+= (x
- y
) * 2 + 1;
340 /* each line takes care of 2 points on the circle so we only
342 rb
->lcd_hline (c_x
- y
, c_x
+ y
, c_y
+ x
);
343 rb
->lcd_hline (c_x
- y
, c_x
+ y
, c_y
- x
);
344 rb
->lcd_hline (c_x
- x
, c_x
+ x
, c_y
+ y
);
345 rb
->lcd_hline (c_x
- x
, c_x
+ x
, c_y
- y
);
349 /* Draw all 8 symmetrical points */
350 rb
->lcd_drawpixel (c_x
+ x
, c_y
+ y
);
351 rb
->lcd_drawpixel (c_x
+ y
, c_y
+ x
);
352 rb
->lcd_drawpixel (c_x
+ y
, c_y
- x
);
353 rb
->lcd_drawpixel (c_x
+ x
, c_y
- y
);
354 rb
->lcd_drawpixel (c_x
- x
, c_y
+ y
);
355 rb
->lcd_drawpixel (c_x
- y
, c_y
+ x
);
356 rb
->lcd_drawpixel (c_x
- y
, c_y
- x
);
357 rb
->lcd_drawpixel (c_x
- x
, c_y
- y
);
364 draw_screen_display (void)
367 int saved_fg
= rb
->lcd_get_foreground ();
368 int saved_bg
= rb
->lcd_get_background ();
370 int saved_drmode
= rb
->lcd_get_drawmode ();
372 if (cursor_pos
!= last_cursor_pos
|| intersection_size
!= last_int_size
)
378 rb
->lcd_set_backdrop (NULL
);
380 rb
->lcd_set_foreground (BOARD_COLOR
);
381 rb
->lcd_set_background (BACKGROUND_COLOR
);
382 rb
->lcd_set_drawmode (DRMODE_SOLID
);
385 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
388 rb
->lcd_clear_display ();
390 rb
->lcd_fillrect (pixel_x (POS (MIN_X
, MIN_Y
)),
391 pixel_y (POS (MIN_X
, MIN_Y
)),
392 (MAX_X
- MIN_X
) * intersection_size
,
393 (MAX_Y
- MIN_Y
) * intersection_size
);
396 rb
->lcd_set_foreground (LINE_COLOR
);
398 rb
->lcd_set_drawmode (DRMODE_SOLID
);
402 for (i
= MIN_Y
; i
< MAX_Y
; ++i
)
404 rb
->lcd_hline (pixel_x (POS (MIN_X
, i
)) + LINE_OFFSET
+ extend_l
,
405 pixel_x (POS (MAX_X
- 1, i
)) + LINE_OFFSET
+ extend_r
,
406 pixel_y (POS (MIN_X
, i
)) + LINE_OFFSET
);
409 for (i
= MIN_X
; i
< MAX_X
; ++i
)
411 rb
->lcd_vline (pixel_x (POS (i
, MIN_Y
)) + LINE_OFFSET
,
412 pixel_y (POS (i
, MIN_Y
)) + LINE_OFFSET
+ extend_t
,
413 pixel_y (POS (i
, MAX_Y
- 1)) + LINE_OFFSET
+ extend_b
);
418 draw_cursor (cursor_pos
);
422 mark_child_variations_sgf ();
431 rb
->lcd_set_foreground (saved_fg
);
432 rb
->lcd_set_background (saved_bg
);
434 rb
->lcd_set_drawmode (saved_drmode
);
439 #if defined(GBN_WIDE_SCREEN)
441 /* the size of the string, in pixels, when drawn vertically */
443 vert_string_size (char *string
, int *width
, int *height
)
453 temp_buffer
[0] = temp_buffer
[1] = 0;
462 temp_buffer
[0] = *string
;
463 rb
->lcd_getstringsize (temp_buffer
, &temp_width
, &temp_height
);
465 ret_height
+= temp_height
;
467 if (ret_width
< temp_width
)
469 ret_width
= temp_width
;
482 *height
= ret_height
;
487 putsxy_vertical (int x
, int y
, int width
, char *str
)
493 temp_buffer
[0] = temp_buffer
[1] = 0;
502 temp_buffer
[0] = *str
;
503 rb
->lcd_getstringsize (temp_buffer
, &temp_width
, &temp_height
);
504 DEBUGF ("putting %s at %d %d\n", temp_buffer
,
505 x
+ (width
- temp_width
) / 2, y
);
506 rb
->lcd_putsxy (x
+ (width
- temp_width
) / 2, y
, temp_buffer
);
512 #endif /* GBN_WIDE_SCREEN */
518 char captures_buffer
[16];
519 char display_flags
[16] = "";
527 rb
->lcd_set_background (BACKGROUND_COLOR
);
528 rb
->lcd_set_foreground (BLACK_COLOR
);
530 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
533 rb
->snprintf (captures_buffer
, sizeof (captures_buffer
),
534 "%d", white_captures
);
537 rb
->lcd_getstringsize (captures_buffer
, &size_x
, &size_y
);
538 #if defined(GBN_TALL_SCREEN)
539 rb
->lcd_putsxy (size_y
+ 2, LCD_HEIGHT
- size_y
, captures_buffer
);
541 vert_string_size (captures_buffer
, &vert_x
, &vert_y
);
542 if (board_pixel_width
+ size_x
<= LCD_WIDTH
)
544 rb
->lcd_putsxy (LCD_WIDTH
- size_x
- 1, vert_x
+ 2, captures_buffer
);
548 putsxy_vertical (LCD_WIDTH
- vert_x
- 1, vert_x
+ 2, vert_x
,
554 rb
->lcd_set_drawmode (DRMODE_SOLID
);
557 #if defined(GBN_TALL_SCREEN)
558 draw_circle (size_y
/ 2,
559 LCD_HEIGHT
- (size_y
/ 2), (size_y
- 1) / 2, true);
562 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
563 draw_circle (size_y
/ 2,
564 LCD_HEIGHT
- (size_y
/ 2), (size_y
- 1) / 2, false);
565 #endif /* LCD_DEPTH */
567 #else /* !GBN_TALL_SCREEN */
568 draw_circle (LCD_WIDTH
- 1 - vert_x
/ 2,
569 (vert_x
/ 2), (vert_x
- 1) / 2, true);
572 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
573 draw_circle (LCD_WIDTH
- 1 - vert_x
/ 2,
574 (vert_x
/ 2), (vert_x
- 1) / 2, false);
575 #endif /* LCD_DEPTH */
577 #endif /* GBN_TALL_SCREEN */
581 rb
->lcd_set_foreground (WHITE_COLOR
);
583 rb
->snprintf (captures_buffer
, sizeof (captures_buffer
),
584 "%d", black_captures
);
586 rb
->lcd_getstringsize (captures_buffer
, &size_x
, &size_y
);
587 #if defined(GBN_TALL_SCREEN)
588 rb
->lcd_putsxy (LCD_WIDTH
- (size_y
+ 1) - size_x
,
589 LCD_HEIGHT
- size_y
, captures_buffer
);
591 draw_circle (LCD_WIDTH
- (size_y
/ 2),
592 LCD_HEIGHT
- (size_y
/ 2), (size_y
- 1) / 2, true);
594 vert_string_size (captures_buffer
, &vert_x
, &vert_y
);
595 if (board_pixel_width
+ size_x
<= LCD_WIDTH
)
597 rb
->lcd_putsxy (LCD_WIDTH
- size_x
- 1,
598 LCD_HEIGHT
- vert_x
- size_y
- 3, captures_buffer
);
602 putsxy_vertical (LCD_WIDTH
- vert_x
- 1,
603 LCD_HEIGHT
- vert_x
- 3 - vert_y
,
604 vert_x
, captures_buffer
);
607 draw_circle (LCD_WIDTH
- 1 - vert_x
/ 2,
608 LCD_HEIGHT
- 1 - vert_x
/ 2, (vert_x
- 1) / 2, true);
613 rb
->lcd_set_foreground (BLACK_COLOR
);
618 rb
->strcat (display_flags
, "C");
621 if (has_more_nodes_sgf ())
623 rb
->strcat (display_flags
, "+");
626 if (num_variations_sgf () > 1)
628 rb
->strcat (display_flags
, "*");
633 rb
->snprintf (captures_buffer
, sizeof (captures_buffer
),
634 "%d%s", move_num
, display_flags
);
636 rb
->lcd_getstringsize (captures_buffer
, &size_x
, &size_y
);
637 #if defined(GBN_TALL_SCREEN)
638 rb
->lcd_putsxy ((LCD_WIDTH
- size_x
) / 2,
639 LCD_HEIGHT
- size_y
, captures_buffer
);
641 if (board_pixel_width
+ size_x
<= LCD_WIDTH
)
643 rb
->lcd_putsxy (LCD_WIDTH
- size_x
- 1,
644 (LCD_HEIGHT
- size_y
) / 2, captures_buffer
);
648 vert_string_size (captures_buffer
, &vert_x
, &vert_y
);
649 putsxy_vertical (LCD_WIDTH
- vert_x
- 1,
650 (LCD_HEIGHT
- vert_y
) / 2, vert_x
, captures_buffer
);
655 rb
->lcd_set_drawmode (DRMODE_SOLID
);
665 pixel_x (unsigned short pos
)
667 return board_x
+ (I (pos
) - min_x_int
) * intersection_size
;
671 pixel_y (unsigned short pos
)
673 return board_y
+ (J (pos
) - min_y_int
) * intersection_size
;
679 move_display (unsigned short pos
)
686 while ((unsigned) I (pos
) >= REAL_MAX_X
)
688 cursor_pos
= EAST (cursor_pos
);
691 while ((unsigned) I (pos
) < REAL_MIN_X
)
693 cursor_pos
= WEST (cursor_pos
);
697 while ((unsigned) J (pos
) >= REAL_MAX_Y
)
699 cursor_pos
= SOUTH (cursor_pos
);
702 while ((unsigned) J (pos
) < REAL_MIN_Y
)
704 cursor_pos
= NORTH (cursor_pos
);
711 cursor_updated (void)
713 if (!on_board(cursor_pos
))
715 cursor_pos
= WRAP (cursor_pos
);
718 if (intersection_size
!= last_int_size
||
719 ((unsigned) I (cursor_pos
)) < REAL_MIN_X
+ 1 ||
720 ((unsigned) I (cursor_pos
)) > REAL_MAX_X
- 2 ||
721 ((unsigned) J (cursor_pos
)) < REAL_MIN_Y
+ 1 ||
722 ((unsigned) J (cursor_pos
)) > REAL_MAX_Y
- 2)
724 if ((unsigned) I (cursor_pos
) < (num_x_ints
/ 2))
730 min_x_int
= min (I (cursor_pos
) - (num_x_ints
/ 2),
731 board_width
- num_x_ints
);
734 if ((unsigned) J (cursor_pos
) < (num_y_ints
/ 2))
741 min_y_int
= min (J (cursor_pos
) - (num_y_ints
/ 2),
742 board_height
- num_y_ints
);
746 /* these are used in line drawing to extend the lines if there is more
747 board in that direction */
750 extend_l
= -1 * LINE_OFFSET
;
759 extend_t
= -1 * LINE_OFFSET
;
766 if (MAX_X
!= board_width
)
768 extend_r
= LINE_OFFSET
;
775 if (MAX_Y
!= board_height
)
777 extend_b
= LINE_OFFSET
;
784 last_cursor_pos
= cursor_pos
;
785 last_int_size
= intersection_size
;
789 unzoomed_int_size (void)
791 int int_size
= min ((LCD_BOARD_WIDTH
/ board_width
),
792 (LCD_BOARD_HEIGHT
/ board_height
));
804 return max(int_size
, MIN_INT_SIZE
);
808 current_zoom_display (void)
810 return (intersection_size
- unzoomed_int_size ()) / 2 + 1;
814 max_zoom_display (void)
816 return (MAX_INT_SIZE
- unzoomed_int_size ()) / 2 + 1;
820 min_zoom_display (void)
822 if (MIN_INT_SIZE
>= unzoomed_int_size())
824 return (MIN_INT_SIZE
- unzoomed_int_size ()) / 2 + 1;
833 set_zoom_display (unsigned int zoom_level
)
835 unsigned int unzoomed
= unzoomed_int_size ();
837 if (saved_circle_size
< MIN_INT_SIZE
||
838 saved_circle_size
> MAX_INT_SIZE
)
840 saved_circle_size
= MIN_DEFAULT_INT_SIZE
;
845 /* default zoom, we get to set it however we want */
846 intersection_size
= max (unzoomed
, saved_circle_size
);
850 intersection_size
= unzoomed
+ 2 * (zoom_level
- 1);
853 if (intersection_size
> MAX_INT_SIZE
)
855 intersection_size
= MAX_INT_SIZE
;
858 /* now intersection_size has been set appropriately, so set up all of
859 the derived values used for display */
861 num_x_ints
= min (LCD_BOARD_WIDTH
/ intersection_size
, board_width
);
862 num_y_ints
= min (LCD_BOARD_HEIGHT
/ intersection_size
, board_height
);
864 board_pixel_width
= num_x_ints
* intersection_size
;
865 board_pixel_height
= num_y_ints
* intersection_size
;
867 #if defined(GBN_TALL_SCREEN)
868 board_x
= (LCD_WIDTH
- board_pixel_width
) / 2;
870 #elif defined(GBN_WIDE_SCREEN)
872 board_y
= (LCD_HEIGHT
- board_pixel_height
) / 2;
874 #error screen dimensions have not been evaluated properly
879 /* Call every time the board size might have changed! */
883 set_zoom_display (0); /* 0 means set to default */
885 /* The cursor starts out in the top right of the board
886 * (on the hoshi point for most board sizes), unless the board
887 * is really small in which case the cursor starts at the center
890 int start_x
, start_y
;
891 if (board_width
>= 7)
893 start_x
= board_width
- 4;
897 start_x
= board_width
/ 2;
900 if (board_height
>= 7)
906 start_y
= board_height
/ 2;
908 cursor_pos
= POS (start_x
, start_y
);
909 last_cursor_pos
= INVALID_POS
;
912 clear_marks_display ();
916 draw_cursor (unsigned short pos
)
924 rb
->lcd_set_foreground (CURSOR_COLOR
);
926 rb
->lcd_set_drawmode (DRMODE_COMPLEMENT
);
929 rb
->lcd_drawrect (pixel_x (pos
),
930 pixel_y (pos
), intersection_size
, intersection_size
);
932 rb
->lcd_set_drawmode (DRMODE_SOLID
);
936 draw_stone_raw (int pixel_x
, int pixel_y
, bool black
)
939 rb
->lcd_set_foreground (black
? BLACK_COLOR
: WHITE_COLOR
);
943 rb
->lcd_set_drawmode (DRMODE_SOLID
);
947 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
951 draw_circle (pixel_x
+ LINE_OFFSET
,
952 pixel_y
+ LINE_OFFSET
, LINE_OFFSET
, true);
954 #if defined(OUTLINE_STONES)
956 rb
->lcd_set_foreground (black
? WHITE_COLOR
: BLACK_COLOR
);
960 rb
->lcd_set_drawmode (DRMODE_SOLID
+ DRMODE_INVERSEVID
);
964 rb
->lcd_set_drawmode (DRMODE_SOLID
);
966 #endif /* LCD_DEPTH > 1 */
970 draw_circle (pixel_x
+ LINE_OFFSET
,
971 pixel_y
+ LINE_OFFSET
, LINE_OFFSET
, false);
974 #endif /* OUTLINE_STONES */
976 rb
->lcd_set_drawmode (DRMODE_SOLID
);
981 draw_stone (unsigned short pos
, bool black
)
988 draw_stone_raw (pixel_x (pos
), pixel_y (pos
), black
);
993 draw_all_stones (void)
996 unsigned short temp_pos
;
998 for (x
= MIN_X
; x
< MAX_X
; ++x
)
1000 for (y
= MIN_Y
; y
< MAX_Y
; ++y
)
1002 temp_pos
= POS (x
, y
);
1003 if (get_point_board (temp_pos
) == EMPTY
)
1008 draw_stone (temp_pos
, get_point_board (temp_pos
) == BLACK
);
1014 draw_hoshi (unsigned short pos
)
1016 /* color and drawmode are already set before this function (all lines
1017 and hoshi and stuff are drawn together) */
1024 if ((unsigned) I (pos
) < MIN_X
||
1025 (unsigned) I (pos
) >= MAX_X
||
1026 (unsigned) J (pos
) < MIN_Y
||
1027 (unsigned) J (pos
) >= MAX_Y
)
1031 if (intersection_size
> 8)
1033 rb
->lcd_fillrect (pixel_x (pos
) + LINE_OFFSET
- 1,
1034 pixel_y (pos
) + LINE_OFFSET
- 1, 3, 3);
1038 rb
->lcd_drawpixel (pixel_x (pos
) + LINE_OFFSET
- 1,
1039 pixel_y (pos
) + LINE_OFFSET
- 1);
1040 rb
->lcd_drawpixel (pixel_x (pos
) + LINE_OFFSET
+ 1,
1041 pixel_y (pos
) + LINE_OFFSET
+ 1);
1047 draw_all_hoshi (void)
1049 if (board_width
!= board_height
)
1054 if (board_width
== 19)
1056 draw_hoshi (POS (3, 3));
1057 draw_hoshi (POS (3, 9));
1058 draw_hoshi (POS (3, 15));
1060 draw_hoshi (POS (9, 3));
1061 draw_hoshi (POS (9, 9));
1062 draw_hoshi (POS (9, 15));
1064 draw_hoshi (POS (15, 3));
1065 draw_hoshi (POS (15, 9));
1066 draw_hoshi (POS (15, 15));
1068 else if (board_width
== 9)
1070 draw_hoshi (POS (2, 2));
1071 draw_hoshi (POS (2, 6));
1073 draw_hoshi (POS (4, 4));
1075 draw_hoshi (POS (6, 2));
1076 draw_hoshi (POS (6, 6));
1078 else if (board_width
== 13)
1080 draw_hoshi (POS (3, 3));
1081 draw_hoshi (POS (3, 9));
1083 draw_hoshi (POS (6, 6));
1085 draw_hoshi (POS (9, 3));
1086 draw_hoshi (POS (9, 9));