void menuScreen(){
	//color_t colorrange[9] = {White, Yellow, Red, Blue, Magenta, SkyBlue, Orange,Lime,Black}; 
													//			0			1			2			3			4					5				6				7			8
		// Main menu Background
	gdispFillArea(433, 247, 20, 20, tetrisShapeColors[2]);
	gdispFillArea(112, 247, 20, 20, tetrisShapeColors[7]);
	gdispFillArea(455, 247, 20, 20, tetrisShapeColors[2]);
	gdispFillArea(0, 204, 20, 20, tetrisShapeColors[3]);
	gdispFillArea(23, 225, 20, 20, tetrisShapeColors[1]);
	gdispFillArea(455, 224, 20, 20, tetrisShapeColors[2]);
	gdispFillArea(91, 247, 20, 20, tetrisShapeColors[7]);
	gdispFillArea(83, 80, 20, 20, tetrisShapeColors[4]);
	gdispFillArea(432, 203, 20, 20, tetrisShapeColors[6]);
	gdispFillArea(178, 247, 20, 20, tetrisShapeColors[5]);
	gdispFillArea(134, 247, 20, 20, tetrisShapeColors[7]);
	gdispFillArea(455, 201, 20, 20, tetrisShapeColors[2]);
	gdispFillArea(22, 247, 20, 20, tetrisShapeColors[3]);
	gdispFillArea(46, 248, 20, 20, tetrisShapeColors[1]);
	gdispFillArea(46, 225, 20, 20, tetrisShapeColors[1]);
	gdispFillArea(82, 102, 21, 20, tetrisShapeColors[4]);
	gdispFillArea(70, 247, 20, 20, tetrisShapeColors[7]);
	gdispFillArea(60, 102, 20, 20, tetrisShapeColors[4]);
	gdispFillArea(410, 225, 20, 20, tetrisShapeColors[6]);
	gdispFillArea(156, 247, 20, 20, tetrisShapeColors[5]);
	gdispFillArea(134, 225, 20, 20, tetrisShapeColors[5]);
	gdispFillArea(410, 247, 20, 20, tetrisShapeColors[6]);
	gdispFillArea(0, 226, 20, 20, tetrisShapeColors[3]);
	gdispFillArea(47, 227, 20, 20, tetrisShapeColors[1]);
	gdispFillArea(60, 80, 20, 20, tetrisShapeColors[4]);
	gdispFillArea(69, 225, 20, 20, tetrisShapeColors[1]);
	gdispFillArea(0, 247, 20, 20, tetrisShapeColors[3]);
	gdispFillArea(432, 225, 20, 20, tetrisShapeColors[6]);
	gdispFillArea(157, 225, 20, 20, tetrisShapeColors[5]);
	//Button
	gdispFillArea(200,60,80,30,Grey);
	gdispFillArea(200+3,60+3,80-6,30-6,Silver);
	//text
	font16 =  gdispOpenFont("DejaVuSans16");
	gdispDrawString(225, 66, "Play", font16, tetrisShapeColors[8]);
	gdispCloseFont(font16);
	
		//Button
	gdispFillArea(200,110,96,30,Grey);
	gdispFillArea(200+3,110+3,96-6,30-6,Silver);
	//text
	font16 =  gdispOpenFont("DejaVuSans16");
	gdispDrawString(205, 116, "Dark Mode", font16, tetrisShapeColors[8]);
	gdispCloseFont(font16);
	
	
		//Button
	gdispFillArea(200,160,126,30,Grey);
	gdispFillArea(200+3,160+3,126-6,30-6,Silver);
	//text
	font16 =  gdispOpenFont("DejaVuSans16");
	gdispDrawString(205, 166, "Random Mode", font16, tetrisShapeColors[8]);
	gdispCloseFont(font16);
}
Example #2
0
bool lcd_keyframe_display_layer_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
    (void)animation;
    const char* layer_help = "1=On D=Default B=Both";
    char layer_buffer[16 + 4]; // 3 spaces and one null terminator
    gdispClear(White);
    gdispDrawString(0, 0, layer_help, state->font_fixed5x8, Black);
    format_layer_bitmap_string(state->status.default_layer, state->status.layer, layer_buffer);
    gdispDrawString(0, 10, layer_buffer, state->font_fixed5x8, Black);
    format_layer_bitmap_string(state->status.default_layer >> 16, state->status.layer >> 16, layer_buffer);
    gdispDrawString(0, 20, layer_buffer, state->font_fixed5x8, Black);
    return false;
}
void printScoreWindow() {
	char* str;
	font16 =  gdispOpenFont("DejaVuSans16");
	gdispDrawString(360, 20, "Score", font16, tetrisShapeColors[8]);
 // gdispDrawLine(365, 40, 380, 20, Purple);
	gdispFillArea(365, 35, 35, 1, Purple);
	
	//draw current score
  sprintf(str,"%d",Score);
	gdispDrawString(378, 42, str, font16, Purple);
	gdispCloseFont(font16);
}
Example #4
0
bool lcd_keyframe_display_layer_and_led_states(keyframe_animation_t* animation, visualizer_state_t* state) {
    (void)animation;
    gdispClear(White);
    uint8_t y = 10;
    if (state->status.leds) {
        char output[LED_STATE_STRING_SIZE];
        get_led_state_string(output, state);
        gdispDrawString(0, 1, output, state->font_dejavusansbold12, Black);
        y = 17;
    }
    gdispDrawString(0, y, state->layer_text, state->font_dejavusansbold12, Black);
    return false;
}
Example #5
0
bool lcd_keyframe_display_mods_bitmap(keyframe_animation_t* animation, visualizer_state_t* state) {
    (void)animation;

    const char* title = "Modifier states";
    const char* mods_header = " CSAG CSAG ";
    char status_buffer[12];

    gdispClear(White);
    gdispDrawString(0, 0, title, state->font_fixed5x8, Black);
    gdispDrawString(0, 10, mods_header, state->font_fixed5x8, Black);
    format_mods_bitmap_string(state->status.mods, status_buffer);
    gdispDrawString(0, 20, status_buffer, state->font_fixed5x8, Black);

    return false;
}
Example #6
0
File: main.c Project: DaviWei/uGFX
void drawScreen(void) {
	char *msg = "uGFX";
	font_t		font1, font2;

	font1 = gdispOpenFont("DejaVuSans24*");
	font2 = gdispOpenFont("DejaVuSans12*");

	gdispClear(White);
	gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, font1)-3, 3, msg, font1, Black);
	
	/* colors */
	gdispFillArea(0 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black);	/* Black */
	gdispFillArea(1 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Red);		/* Red */
	gdispFillArea(2 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Yellow);	/* Yellow */
	gdispFillArea(3 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Green);	/* Green */
	gdispFillArea(4 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Blue);		/* Blue */
	gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black);	/* White */

	/* pens */	
	gdispFillStringBox(OFFSET * 2, DRAW_PEN(1), PEN_SIZE, PEN_SIZE, "1", font2, White, Black, justifyCenter);
	gdispFillStringBox(OFFSET * 2, DRAW_PEN(2), PEN_SIZE, PEN_SIZE, "2", font2, White, Black, justifyCenter);
	gdispFillStringBox(OFFSET * 2, DRAW_PEN(3), PEN_SIZE, PEN_SIZE, "3", font2, White, Black, justifyCenter);
	gdispFillStringBox(OFFSET * 2, DRAW_PEN(4), PEN_SIZE, PEN_SIZE, "4", font2, White, Black, justifyCenter);
	gdispFillStringBox(OFFSET * 2, DRAW_PEN(5), PEN_SIZE, PEN_SIZE, "5", font2, White, Black, justifyCenter);
	
	gdispCloseFont(font1);
	gdispCloseFont(font2);
}
Example #7
0
bool keyframe_display_layer_text(keyframe_animation_t* animation, visualizer_state_t* state) {
    (void)animation;
    gdispClear(White);
    gdispDrawString(0, 10, state->layer_text, state->font_dejavusansbold12, Black);
    gdispFlush();
    return false;
}
void printNextBrickWindow() {
	char* str;
	int i,j;
	font16 =  gdispOpenFont("DejaVuSans16");
	gdispDrawString(360, 100, "Next", font16, tetrisShapeColors[8]);
	gdispCloseFont(font16);
	
	//draw block

    //For every piece in the next block needs to be changed to nextPiece
    for (i = 0; i < nextPiece->size; i++) {
        for (j = 0; j < nextPiece->size; j++) {
            //If this isn't a blank char then print it
            if (nextPiece->graphic[i][j] != ' ') {
               // mvprintw(currentPiece->y + i, currentPiece->x + j, "%c", currentPiece->graphic[i][j]);
							//padding
								gdispFillArea(360+(j*BLOCK_SIZE),130+(i*(BLOCK_SIZE)),BLOCK_SIZE-2, BLOCK_SIZE-2, tetrisShapeColors[0]);
							//shape
								gdispFillArea(361+(j*BLOCK_SIZE),131+(i*(BLOCK_SIZE)),BLOCK_SIZE-2, BLOCK_SIZE-2, tetrisShapeColors[nextPiece->blockID]);
							
            }

        }
    }
							
}
Example #9
0
File: main.c Project: GottZ/olvfw
int main(void) {
	coord_t		width, height;
	font_t		font1, font2, font3, font4;
	const char	*msg;

    halInit();
    chSysInit();

    /* Initialize and clear the display */
    gdispInit();
    gdispClear(Black);

    // Get the screen size
    width = gdispGetWidth();
    height = gdispGetHeight();

    // Get the fonts we want to use
	font1 = gdispOpenFont("UI2");
	font2 = gdispOpenFont("UI2 Double");
	font3 = gdispOpenFont("UI2 Narrow");
	font4 = gdispOpenFont("LargeNumbers");

	// Display large numbers on the right (measuring the string)
	msg = "123456";
	gdispDrawString(width-gdispGetStringWidth(msg, font4)-3, 3, msg, font4, Green);
	
	// Display the font name under it.
	msg = gdispGetFontName(font4);
	gdispDrawString(width-gdispGetStringWidth(msg, font1)-3, 20, msg, font1, Green);

	// Demonstrate our other fonts
	gdispDrawString(10, 10, "Writing with Font 'UI2'", font1, Yellow);
	gdispFillString(10, 35, "Writing with Font 'UI2 Double'", font2, Red, White);
	gdispDrawStringBox(0, 50, width, 40, "Writing with Font 'UI2 Narrow'", font3, Red, justifyCenter);
	gdispFillStringBox(0, 90, width, 40, "Filled Centered", font3, Pink, Gray, justifyCenter);

	// Clean up the fonts
	gdispCloseFont(font1);
	gdispCloseFont(font2);
	gdispCloseFont(font3);
	gdispCloseFont(font4);

	// Wait forever
    while(TRUE) {
        chThdSleepMilliseconds(500);
    }   
}
Example #10
0
bool lcd_keyframe_display_led_states(keyframe_animation_t* animation, visualizer_state_t* state)
{
    (void)animation;
    char output[LED_STATE_STRING_SIZE];
    get_led_state_string(output, state);
    gdispClear(White);
    gdispDrawString(0, 10, output, state->font_dejavusansbold12, Black);
    return false;
}
Example #11
0
File: gwin.c Project: bunnie/uGFX
	void gwinDrawString(GHandle gh, coord_t x, coord_t y, const char *str) {
		if (!((gh->flags & GWIN_FLG_VISIBLE)) || !gh->font)
			return;

		#if GDISP_NEED_CLIP
			gdispSetClip(gh->x, gh->y, gh->width, gh->height);
		#endif
		gdispDrawString(gh->x+x, gh->y+y, str, gh->font, gh->color);
	}
Example #12
0
File: main.c Project: GottZ/olvfw
void drawScreen(void) {
	char *msg = "ChibiOS/GFX";
	font_t		font1, font2;

	font1 = gdispOpenFont("UI2 Double");
	font2 = gdispOpenFont("LargeNumbers");

	gdispClear(White);
	gdispDrawString(gdispGetWidth()-gdispGetStringWidth(msg, font1)-3, 3, msg, font1, Black);
	
	/* colors */
	gdispFillArea(0 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black);	/* Black */
	gdispFillArea(1 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Red);		/* Red */
	gdispFillArea(2 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Yellow);	/* Yellow */
	gdispFillArea(3 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Green);	/* Green */
	gdispFillArea(4 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Blue);		/* Blue */
	gdispDrawBox (5 * COLOR_SIZE + 3, 3, COLOR_SIZE, COLOR_SIZE, Black);	/* White */

	/* pens */	
	gdispDrawString(OFFSET * 2, DRAW_PEN(1), "1", font2, Black);
	gdispDrawString(OFFSET * 2, DRAW_PEN(2), "2", font2, Black);
	gdispDrawString(OFFSET * 2, DRAW_PEN(3), "3", font2, Black);
	gdispDrawString(OFFSET * 2, DRAW_PEN(4), "4", font2, Black);
	gdispDrawString(OFFSET * 2, DRAW_PEN(5), "5", font2, Black);

	gdispCloseFont(font1);
	gdispCloseFont(font2);
}
Example #13
0
/// \method text(str, x, y, colour)
///
/// Draw the given text to the position `(x, y)` using the given colour.
///
STATIC mp_obj_t pyb_ugfx_text(mp_uint_t n_args, const mp_obj_t *args) {
    // extract arguments
    //pyb_ugfx_obj_t *self = args[0];
    mp_uint_t len;
    const char *data = mp_obj_str_get_data(args[1], &len);
    int x0 = mp_obj_get_int(args[2]);
    int y0 = mp_obj_get_int(args[3]);
    int col = mp_obj_get_int(args[4]);

    //font_t font = gdispOpenFont("ui2");  //TODO: save fotn handle globally or in lcd object
	gdispDrawString(x0, y0, data, default_font, col);	
	//gdispCloseFont(font);
    return mp_const_none;
}
Example #14
0
int main(void) {
	font_t font1;

    // Initialize uGFX and the underlying system
    gfxInit();

    // Get the fonts we want to use
	font1 = gdispOpenFont("Archangelsk Regular 12");

	// Demonstrate our other fonts
	gdispDrawString(10, 10, "привет мир", font1, Yellow);

	// Wait forever
    while(TRUE) {
    	gfxSleepMilliseconds(500);
    }   
}
Example #15
0
int main(void)
{
	GEventMouse ev;
#if !JG10_SHOW_SPLASH
	font_t font;
#endif

    gfxInit();

    ginputGetMouse(0);
    jg10Init();

#if JG10_SHOW_SPLASH
    jg10ShowSplash();
#else
    font = gdispOpenFont("DejaVuSans16_aa");
    gdispDrawString((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, "Touch to start!", font, White);
    gdispCloseFont(font);
#endif

    while (TRUE) {
        ginputGetMouseStatus(0, &ev);
        if (ev.buttons & GINPUT_MOUSE_BTN_LEFT) {
            while (ev.buttons & GINPUT_MOUSE_BTN_LEFT) {            // Wait until release
                ginputGetMouseStatus(0, &ev);
            }

#if !JG10_SHOW_SPLASH
            font = gdispOpenFont("DejaVuSans16");
            gdispFillArea((gdispGetWidth()/2)-(gdispGetStringWidth("Touch to start!", font)/2), gdispGetHeight()/2, gdispGetWidth()/2, 17, Black);
            gdispCloseFont(font);
#endif

            jg10Start();
        }
    }
}