Ejemplo n.º 1
0
/**
 *
 *  rct2: 0x006EA41D
 */
static void window_tooltip_paint(rct_window *w, rct_drawpixelinfo *dpi)
{
	int left = w->x;
	int top = w->y;
	int right = w->x + w->width - 1;
	int bottom = w->y + w->height - 1;

	// Background
	gfx_fill_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, 0x0200002D);
	gfx_fill_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, 0x02000084);

	// Sides
	gfx_fill_rect(dpi, left  + 0, top    + 2, left  + 0, bottom - 2, 0x0200002F);
	gfx_fill_rect(dpi, right + 0, top    + 2, right + 0, bottom - 2, 0x0200002F);
	gfx_fill_rect(dpi, left  + 2, bottom + 0, right - 2, bottom + 0, 0x0200002F);
	gfx_fill_rect(dpi, left  + 2, top    + 0, right - 2, top    + 0, 0x0200002F);

	// Corners
	gfx_draw_pixel(dpi, left  + 1, top    + 1, 0x0200002F);
	gfx_draw_pixel(dpi, right - 1, top    + 1, 0x0200002F);
	gfx_draw_pixel(dpi, left  + 1, bottom - 1, 0x0200002F);
	gfx_draw_pixel(dpi, right - 1, bottom - 1, 0x0200002F);

	// Text
	left = w->x + ((w->width + 1) / 2) - 1;
	top = w->y + 1;
	draw_string_centred_raw(dpi, left, top, RCT2_GLOBAL(RCT2_ADDRESS_TOOLTIP_TEXT_HEIGHT, uint16), (char *)gTooltip_text_buffer);
}
Ejemplo n.º 2
0
/**
 * 
 *  rct2: 0x006EA41D
 */
static void window_tooltip_paint()
{
	rct_window *w;
	rct_drawpixelinfo *dpi;

	__asm mov w, esi
	__asm mov dpi, edi

	int left = w->x;
	int top = w->y;
	int right = w->x + w->width - 1;
	int bottom = w->y + w->height - 1;

	// Background
	gfx_fill_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, 0x0200002D);
	gfx_fill_rect(dpi, left + 1, top + 1, right - 1, bottom - 1, 0x02000084);

	// Sides
	gfx_fill_rect(dpi, left  + 0, top    + 2, left  + 0, bottom - 2, 0x0200002F);
	gfx_fill_rect(dpi, right + 0, top    + 2, right + 0, bottom - 2, 0x0200002F);
	gfx_fill_rect(dpi, left  + 2, bottom + 0, right - 2, bottom + 0, 0x0200002F);
	gfx_fill_rect(dpi, left  + 2, top    + 0, right - 2, top    + 0, 0x0200002F);

	// Corners
	gfx_draw_pixel(dpi, left  + 1, top    + 1, 0x0200002F);
	gfx_draw_pixel(dpi, right - 1, top    + 1, 0x0200002F);
	gfx_draw_pixel(dpi, left  + 1, bottom - 1, 0x0200002F);
	gfx_draw_pixel(dpi, right - 1, bottom - 1, 0x0200002F);
	
	// Text
	RCT2_CALLPROC_X(0x006C1DB7, 0, 0, w->x + ((w->width + 1) / 2) - 1, w->y + 1, 0x0141FE44, dpi, RCT2_GLOBAL(0x01420044, uint16));
}
Ejemplo n.º 3
0
/**
 * \internal
 * \brief Helper function that draws a character from a font in progmem
 *        to the display
 *
 * This function will first calculate the start offset in the font character
 * data before iterating over the specific character data.
 *
 * Only pixels in the character that should be enabled are done so, the caller
 * is required to prepare the drawing area before printing a character to it.
 * This is done by the gfx_draw_string() and gfx_draw_progmem_string()
 * functions.
 *
 * \param ch       Character to be drawn
 * \param x        X coordinate on screen.
 * \param y        Y coordinate on screen.
 * \param font     Font to draw character in
 * \param color    Foreground color to draw the character in
 */
static void gfx_draw_inverted_char_progmem(const char ch, const gfx_coord_t x,
		const gfx_coord_t y, const struct font *font,
		const gfx_color_t color)
{
	uint8_t PROGMEM_PTR_T glyph_data;
	uint16_t glyph_data_offset;
	uint8_t char_row_size;
	uint8_t rows_left;
	uint8_t i;

	/* Sanity check on parameters, assert if font is NULL. */
	Assert(font != NULL);

	gfx_coord_t inc_x = x;
	gfx_coord_t inc_y = y;

//	char_row_size = font->width / CONFIG_FONT_PIXELS_PER_BYTE;
//	if (font->width % CONFIG_FONT_PIXELS_PER_BYTE) {
//		char_row_size++;
//	}

	char_row_size = font->height / CONFIG_FONT_PIXELS_PER_BYTE;
	
	if (font->height % CONFIG_FONT_PIXELS_PER_BYTE) {
		char_row_size++;
	}

	glyph_data_offset = char_row_size * font->width *
			((uint8_t)ch - font->first_char);
	glyph_data = font->data.progmem + glyph_data_offset;
	rows_left = font->width;

	do {
		uint8_t glyph_byte = 0;
		uint8_t pixelsToDraw = font->height;

		for (i = pixelsToDraw; i >0; i--) {
			if (i % CONFIG_FONT_PIXELS_PER_BYTE == 0) {
				glyph_byte = PROGMEM_READ_BYTE(glyph_data);
				glyph_data++;
			}

			if ((glyph_byte & 0x80)) {
				gfx_draw_pixel(inc_x, inc_y, color);
			//	gfx_draw_pixel(inc_y, inc_x, color);
			}

//			inc_x += 1;
			inc_y += 1;
			glyph_byte <<= 1;
		}

		inc_x += 1;
		inc_y = y;
		rows_left--;
	} while (rows_left > 0);
}
Ejemplo n.º 4
0
/**
 * \internal
 * \brief Helper function that draws a character from a font in hugemem
 *        to the display.
 *
 * This function will first calculate the start offset in the font character
 * data before iterating over the specific character data.
 *
 * Only pixels in the character that should be enabled are done so, the caller
 * is required to prepare the drawing area before printing a character to it.
 * This is done by the gfx_draw_string() and gfx_draw_progmem_string()
 * functions.
 *
 * \param ch       Character to be drawn
 * \param x        X coordinate on screen.
 * \param y        Y coordinate on screen.
 * \param font     Font to draw character in
 * \param color    Foreground color to draw the character in
 */
static void gfx_draw_char_hugemem(const char ch, const gfx_coord_t x,
		const gfx_coord_t y, const struct font *font,
		const gfx_color_t color)
{
	uint8_t i;
	uint8_t char_row_size;
	uint8_t glyph_size;
	uint16_t glyph_data_offset;
	uint8_t char_buff[EXTMEM_BUF_SIZE];
	uint8_t buffer_pos;
	uint8_t rows_left;

	/* Sanity check on parameters, assert if font is NULL. */
	Assert(font != NULL);

	gfx_coord_t inc_x = x;
	gfx_coord_t inc_y = y;

	char_row_size = font->width / CONFIG_FONT_PIXELS_PER_BYTE;
	if (font->width % CONFIG_FONT_PIXELS_PER_BYTE) {
		char_row_size++;
	}

	glyph_size = char_row_size * font->height;
	glyph_data_offset = glyph_size * ((uint8_t)ch - font->first_char);
	buffer_pos = EXTMEM_BUF_SIZE;
	rows_left = font->height;

	do {
		static uint8_t glyph_byte = 0;
		uint8_t pixelsToDraw = font->width;

		for (i = 0; i < pixelsToDraw; i++) {
			if (i % CONFIG_FONT_PIXELS_PER_BYTE == 0) {
				/* Read another byte from hugemem */
				if (buffer_pos >= EXTMEM_BUF_SIZE) {
					hugemem_ptr_t source
						= font->data.hugemem;
					source = (hugemem_ptr_t)
							((uint32_t)source +
							glyph_data_offset);

					hugemem_read_block(char_buff, source,
							EXTMEM_BUF_SIZE);

					glyph_data_offset += EXTMEM_BUF_SIZE;
					buffer_pos = 0;
				}

				glyph_byte = char_buff[buffer_pos];
				buffer_pos++;
			}

			/* Draw bit of glyph to screen */
			if ((glyph_byte & 0x80)) {
				gfx_draw_pixel(inc_x, inc_y, color);
			}

			inc_x += 1;
			glyph_byte <<= 1;
		}

		inc_y += 1;
		inc_x = x;
	} while (--rows_left > 0);
}