void HD66773R_Driver::WriteChar( unsigned char c, int row, int col )
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();    
    // convert to LCD pixel coordinates
    
    row *= Font_Height();
    col *= Font_Width();

 
    if(row > (g_HD66773R_Config.Height - Font_Height())) return;
    if(col > (g_HD66773R_Config.Width  - Font_Width() )) return;

    const UINT8* font = Font_GetGlyph( c );

    UINT16* ScreenBuffer = GetScreenBuffer();

    for(int y = 0; y < Font_Height(); y++)
    {
        for(int x = 0; x < Font_Width(); x+=1)
        {
            // the font data is mirrored
            if(HD66773R_GETBIT(Font_Width() - 1 - x  ,y,font,1)) 
                ScreenBuffer[(row+y)*g_HD66773R_Config.Width + (col+x)] = 0x0000;
            else
                ScreenBuffer[(row+y)*g_HD66773R_Config.Width + (col+x)] = 0xFFFF;
        }        
    }    
    Data_Trans(ScreenBuffer);
}
예제 #2
0
static void Inputs_CFG_Layout(t_app_inputs_config *app, bool setup)
{
    t_frame frame;

    // Clear
    clear_to_color(app->box->gfx_buffer, COLOR_SKIN_WINDOW_BACKGROUND);

    if (setup)
    {
        // Add closebox widget
        widget_closebox_add(app->box, Inputs_CFG_Switch);

        // Peripheral change button
        frame.pos.x = 10;
        frame.pos.y = 18;
        frame.size.x = Graphics.Inputs.InputsBase->w;
        frame.size.y = 80-2;
        widget_button_add(app->box, &frame, 1, Inputs_CFG_Peripheral_Change_Handler, WIDGET_BUTTON_STYLE_INVISIBLE, NULL);

        // Input source change button
        frame.pos.x = 170;
        frame.pos.y = 10-Font_Height(F_MIDDLE)/2;
        frame.size.x = INPUTS_CFG_FRAME_X - 5;
        frame.size.y = Font_Height(F_MIDDLE);
        widget_button_add(app->box, &frame, 1|2, Inputs_CFG_Current_Source_Change, WIDGET_BUTTON_STYLE_INVISIBLE, NULL);

        // Input map change button
        frame.pos.x = 170 /* + (INPUTS_CFG_FRAME_X / 2)*/;
        frame.pos.y = 48;
        frame.size.x = (INPUTS_CFG_FRAME_X /* / 2 */) - 10;
        frame.size.y = INPUT_MAP_MAX * (Font_Height(F_SMALL) + GUI_LOOK_LINES_SPACING_Y);
        widget_button_add(app->box, &frame, 1, Inputs_CFG_Map_Change_Handler, WIDGET_BUTTON_STYLE_INVISIBLE, NULL);

        // 'Enabled' checkbox
        frame.pos.x = 170;
        frame.pos.y = 19;
        frame.size.x = INPUTS_CFG_CHECK_X;
        frame.size.y = INPUTS_CFG_CHECK_Y;
        app->CheckBox_Enabled = widget_checkbox_add(app->box, &frame, &Inputs.Sources [app->Current_Source]->enabled, NULL);

        // Emulate Digital check need to be added before drawing source
        // because currently it is drawn on the box before having the chance
        // to be disabled... so anyway drawing source will clear it.
        frame.pos.x = 170;
        frame.pos.y = 19 + (7 * 2) + (2 + 6) * (Font_Height(F_SMALL) + GUI_LOOK_LINES_SPACING_Y);
        frame.size.x = INPUTS_CFG_CHECK_X;
        frame.size.y = INPUTS_CFG_CHECK_Y;
        app->CheckBox_Emulate_Digital = widget_checkbox_add(app->box, &frame, &app->CheckBox_Emulate_Digital_Value, Inputs_CFG_Emulate_Digital_Handler);
        widget_disable(app->CheckBox_Emulate_Digital);
    }

    // Draw input base
    draw_sprite(app->box->gfx_buffer, Graphics.Inputs.InputsBase, 10, 34);

    // Draw current peripheral
    Inputs_CFG_Peripherals_Draw();

    // Draw current input source
    Inputs_CFG_Current_Source_Draw ();
}
void A025DL02_Driver::WriteChar( unsigned char c, int row, int col )
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();
    // convert to LCD pixel coordinates
    row *= Font_Height();
    col *= Font_Width();

    if(row > (g_LcdController_Config.Height - Font_Height())) return;
    if(col > (g_LcdController_Config.Width  - Font_Width() )) return;

    const UINT8* font = Font_GetGlyph( c );

    UINT32* ScreenBuffer = LCD_GetFrameBuffer();

    for(int y = 0; y < Font_Height(); y++)
    {
        for(int x = 0; x < Font_Width(); x+=2)
        {
            UINT32 val = 0;
            // the font data is mirrored
            if(A025DL02_GETBIT( Font_Width() -  x   , y, font, 1 )) val |= 0x07e0;
            if(A025DL02_GETBIT( Font_Width() - (x+1), y, font, 1 )) val |= 0x07e00000;
            
            ScreenBuffer[(row+y) * WidthInWords() + (col+x)/2] = val;
        }
    }
}
예제 #4
0
파일: textbox.c 프로젝트: mnstrmnch/meka
void        TB_Message_Init()
{
    t_app_messages *app = &TB_Message;  // Global instance
	t_font_id font_id = (t_font_id)g_configuration.font_messages;

    app->active = true;

    // Create box
	t_frame frame;
    frame.pos.x  = 16;
    frame.pos.y  = 626;
    frame.size.x = (48 * Font_Height(font_id)) + (4*2); // 4*2=padding
    frame.size.y = (8 * Font_Height(font_id)) + (2*2); // 2*2=padding
    app->box = gui_box_new(&frame, Msg_Get(MSG_Message_BoxTitle));
	app->box->flags |= GUI_BOX_FLAGS_ALLOW_RESIZE;

    // Register to desktop
    Desktop_Register_Box("MESSAGES", app->box, true, &app->active);

    // Layout
    TB_Message_Layout(app, true);

    // Open log file
    if (app->log_filename != NULL)
    {
        app->log_file = fopen(app->log_filename, "a+t");
        if (app->log_file)
            fprintf(app->log_file, Msg_Get(MSG_Log_Session_Start), meka_date_getf());
    }
}
예제 #5
0
void ILI9328_Driver::WriteChar( unsigned char c, int row, int col )
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();    
    // convert to LCD pixel coordinates
    
    row *= Font_Height();
    col *= Font_Width();

 
    if(row > (g_ILI9328_Config.ControllerConfig.Height - Font_Height())) return;
    if(col > (g_ILI9328_Config.ControllerConfig.Width  - Font_Width() )) return;

    const UINT8* font = Font_GetGlyph( c );

    volatile UINT16 * dataReg = (UINT16 *)g_ILI9328_Config.LcdConfig.DataAddress;

    SetWindow(col, col+Font_Width()-1, row, row+Font_Height()-1);

    for(int y = 0; y < Font_Height(); y++)
    {
        for(int x = 0; x < Font_Width(); x+=1)
        {
            // the font data is mirrored
            if(ILI9328_GETBIT(Font_Width() - 1 - x  ,y,font,1))
                *dataReg = BLACK;
            else
                *dataReg = WHITE;
        }
    }    
}
예제 #6
0
void        TechInfo_Init (void)
{
    int    i;
    t_frame frame;

    frame.pos.x = 150;
    frame.pos.y = 382;
    frame.size.x = TECHINFO_COLUMNS * Font_TextLength(F_MIDDLE, " ");
    frame.size.y = TECHINFO_LINES * Font_Height(F_MIDDLE);
    
    TechInfo.active = FALSE;

    TechInfo.box = gui_box_new(&frame, Msg_Get(MSG_TechInfo_BoxTitle));
    Desktop_Register_Box("TECHINFO", TechInfo.box, 0, &TechInfo.active);
    TechInfo.box->update = TechInfo_Update;

    // Layout
    TechInfo_Layout(&TechInfo, TRUE);

    // Clear lines
    for (i = 0; i != TECHINFO_LINES; i++)
    {
        strcpy(TechInfo.lines[i], "");
        TechInfo.lines_dirty[i] = TRUE;
    }
}
예제 #7
0
static void     AboutBox_Layout(bool setup)
{
    t_app_about_box *app = &AboutBox;   // Global instance
    const int dragon_h = al_get_bitmap_height(Graphics.Misc.Dragon);

    al_set_target_bitmap(app->box->gfx_buffer);
    al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND);

    if (setup)
        widget_closebox_add(app->box, (t_widget_callback)AboutBox_Switch);

    // Draw MEKA dragon sprite
    al_draw_bitmap(Graphics.Misc.Dragon, 16, (app->box->frame.size.y - dragon_h) / 2, 0);

    // Print about information lines
    {
        int y = 12;
        Font_SetCurrent((t_font_id)g_config.font_about);
        for (int i = 0; i < 4; i ++)
        {
            char buffer[256];
            switch (i)
            {
            case 0: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Meka_Date), MEKA_NAME_VERSION, MEKA_DATE); break;
            case 1: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Authors), MEKA_AUTHORS_SHORT); break;
            case 2: snprintf(buffer, countof(buffer), Msg_Get(MSG_About_Line_Homepage), MEKA_HOMEPAGE); break;
            case 3: snprintf(buffer, countof(buffer), "Built %s, %s", MEKA_BUILD_DATE, MEKA_BUILD_TIME); break;
            }
            const int x = (( (app->box->frame.size.x - dragon_h - 18 - 6) - Font_TextWidth(FONTID_CUR, buffer) ) / 2) + dragon_h + 8 + 6;
            Font_Print(FONTID_CUR, buffer, x, y, COLOR_SKIN_WINDOW_TEXT);
            y += Font_Height() + 3;
        }
    }
}
예제 #8
0
static void     Options_Layout_AddLine(t_app_options* app, bool setup, t_frame *frame, const char *text, bool *v, void (*func)())
{
    frame->pos.x = OPTIONS_PAD_X;
    if (setup)
        widget_checkbox_add(Options.box, frame, v, (t_widget_callback)func); // FIXME: Cast
    frame->pos.x += frame->size.x + Font_TextWidth(app->font_id, " ");
    Font_Print(app->font_id, text, frame->pos.x, frame->pos.y+2, COLOR_SKIN_WINDOW_TEXT);
    frame->pos.y += (int)(Font_Height(app->font_id) * 1.3f);
}
예제 #9
0
파일: gui.c 프로젝트: mnstrmnch/meka
DrawCursor::DrawCursor(v2i _pos, int font_id)
{
	this->pos = _pos;
	this->x_base = this->pos.x;
	this->y_spacing = Font_Height((t_font_id)font_id)+2;

	ALLEGRO_BITMAP* bitmap = al_get_target_bitmap();
	this->viewport_min.Set(0,0);
	this->viewport_max.Set(al_get_bitmap_width(bitmap),al_get_bitmap_height(bitmap));
}
예제 #10
0
static void     Options_Layout(t_app_options* app, bool setup)
{
	app->font_id = (t_font_id)g_configuration.font_options;

	t_frame frame;

    al_set_target_bitmap(app->box->gfx_buffer);
	al_clear_to_color(COLOR_SKIN_WINDOW_BACKGROUND);

    if (setup)
    {
        // Add closebox widget
        widget_closebox_add(Options.box, (t_widget_callback)Options_Switch);

        // Add close button
		frame.size.x = Font_TextWidth(app->font_id, Msg_Get(MSG_Options_Close))+15;
		frame.size.y = Font_Height(app->font_id)*2;
        frame.pos.x = Options.box->frame.size.x - frame.size.x - OPTIONS_PAD_X;
        frame.pos.y = Options.box->frame.size.y - frame.size.y - OPTIONS_PAD_Y;
        widget_button_add(Options.box, &frame, 1, (t_widget_callback)Options_Switch, app->font_id, Msg_Get(MSG_Options_Close));
    }

    // Draw option lines
	frame.pos.x = Font_Height(app->font_id)-2;
	frame.pos.y = OPTIONS_PAD_Y;
    frame.size.x = Font_Height(app->font_id);
    frame.size.y = Font_Height(app->font_id);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_BIOS_Enable),				&g_configuration.enable_BIOS,					NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_DB_Display),					&g_configuration.fb_uses_DB,					Option_Switch_Uses_VLFN);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Product_Number),				&g_configuration.show_product_number,			NULL);
    //Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Bright_Palette),			&g_configuration.palette_type,					Palette_Emu_Reload);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Allow_Opposite_Directions),	&g_configuration.allow_opposite_directions,		NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Load_Close),					&g_configuration.fb_close_after_load,			NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Load_FullScreen),			&g_configuration.fullscreen_after_load,			NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_FullScreen_Messages),		&g_configuration.show_fullscreen_messages,		NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_GUI_VSync),					&g_configuration.video_mode_gui_vsync,			NULL);
	Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_Capture_Crop_Align),			&g_configuration.capture_crop_align_8x8,		NULL);
    Options_Layout_AddLine(app, setup, &frame, Msg_Get(MSG_Options_NES_Enable),					&g_configuration.enable_NES,					Option_Switch_NES_Crap);
}
예제 #11
0
파일: games.c 프로젝트: dafyddcrosby/meka
void    BreakOut_Draw_Score (void)
{
    int    i;
    char   s [20];
    static int last_score = -1;

    if (bo.score == last_score)
        return;

    Font_SetCurrent (F_MIDDLE);
    rectfill (bo.scr, 1, 1, 80, Font_Height(-1), COLOR_BLACK);
    sprintf (s, "SCORE: %d", bo.score);
    for (i = 0; i < 5; i ++)
        if (Random(2))
            s [i] += ('a' - 'A');
    Font_Print (-1, bo.scr, s, 1, 1, COLOR_WHITE);
    last_score = bo.score;
    if ((bo.score % 56) == 0)
        switch (bo.score / 56)
        {
        case 1:
            Msg (MSGT_USER, "Are you crazy or what ?");
            break;
        case 2:
            Msg (MSGT_USER, "Don't you have better things to do ?");
            break;
        case 3:
            Msg (MSGT_USER, "There are better games to play, really..");
            break;
        case 4:
            Msg (MSGT_USER, "Let me tell you a secret..");
            break;
        case 5:
            Msg (MSGT_USER, "HAHAHAHA - I have no secrets to tell you (yet)");
            break;
        case 6:
            Msg (MSGT_USER, "Still playing ?");
            break;
        case 7:
            Msg (MSGT_USER, "Ok, I'll shut up.");
            break;
        default:
            if ((bo.score / 56) >= 8) // False secret message :)
                Msg (MSGT_USER, "Xfg6_ZhDjsA_9dyAyz_dSyQA_UdEDjDy2");
            break;
        }
}
예제 #12
0
static void TechInfo_Redraw(t_app_tech_info *app)
{
    int i;
    bool dirty = FALSE;

    for (i = 0; i != TECHINFO_LINES; i++)
    {
        if (app->lines_dirty[i])
        {
            const int h = Font_Height (F_MIDDLE);
            const int y = (h * i);

            rectfill(app->box->gfx_buffer, 0, y, app->box->frame.size.x, y + h - 1, COLOR_SKIN_WINDOW_BACKGROUND);
            Font_Print(F_MIDDLE, app->box->gfx_buffer, app->lines[i], 4, y, COLOR_SKIN_WINDOW_TEXT);

            app->lines_dirty[i] = FALSE;
            dirty = TRUE;
        }
    }

    if (dirty)
        app->box->flags |= GUI_BOX_FLAGS_DIRTY_REDRAW;
}
예제 #13
0
void    Inputs_CFG_Current_Source_Draw (void)
{
    t_app_inputs_config *app = &Inputs_CFG; // Global instance
    BITMAP *bmp = app->box->gfx_buffer;

    int             i;
    int             x = 165;
    int             y = 10;
    int             font_height;
    int             frame_x = INPUTS_CFG_FRAME_X;
    int             frame_y = INPUTS_CFG_FRAME_Y;
    t_input_src *   input_src = Inputs.Sources [Inputs_CFG.Current_Source];

    // x = 165 + (i / 2) * (frame_sx + GUI_LOOK_FRAME_SPACING_X);
    // y = 10 + (i % 2) * (frame_sy + GUI_LOOK_FRAME_SPACING_Y);

    // Set update flag
    app->box->flags |= GUI_BOX_FLAGS_DIRTY_REDRAW;

    // Set font to use
    Font_SetCurrent (F_MIDDLE);
    font_height = Font_Height (-1);

    // Clear area to display on
    rectfill (app->box->gfx_buffer, x, y - font_height / 2,
        x + frame_x, y - font_height / 2 + frame_y,
        COLOR_SKIN_WINDOW_BACKGROUND);

    // Do the actual display
    {
        char buf[128];
        sprintf(buf, "%d/%d: %s >>", app->Current_Source+1, Inputs.Sources_Max, input_src->name);
        gui_rect_titled (bmp, buf, F_MIDDLE, LOOK_THIN,
            x, y, x + frame_x, y + frame_y,
            COLOR_SKIN_WIDGET_GENERIC_BORDER, COLOR_SKIN_WINDOW_BACKGROUND, /*COLOR_SKIN_WINDOW_TEXT*/COLOR_SKIN_WINDOW_TEXT_HIGHLIGHT);
    }

    // Set font to use
    Font_SetCurrent (F_SMALL);
    font_height = Font_Height (-1);
    y += GUI_LOOK_FRAME_PAD1_Y;

    // Enable Check
    Font_Print (-1, bmp, Msg_Get(MSG_Inputs_Config_Source_Enabled), x + GUI_LOOK_FRAME_PAD_X + INPUTS_CFG_CHECK_X + 3, y, COLOR_SKIN_WINDOW_TEXT);
    y += font_height + GUI_LOOK_LINES_SPACING_Y;

    // Player
    {
        char buf[64];
        snprintf(buf, sizeof(buf), Msg_Get(MSG_Inputs_Config_Source_Player), input_src->player + 1);
        Font_Print(-1, bmp, buf, x + GUI_LOOK_FRAME_PAD_X + INPUTS_CFG_CHECK_X + 3, y, COLOR_SKIN_WINDOW_TEXT);
        y += font_height + GUI_LOOK_LINES_SPACING_Y;
    }

    // Horizontal Separator
    line (bmp, x + 4, y + 3, x + frame_x - 4, y + 3, COLOR_SKIN_WINDOW_SEPARATORS);
    y += 7;

    // Mapping
    for (i = 0; i < INPUT_MAP_MAX; i++)
        if (Inputs_CFG_Current_Source_Draw_Map (i, COLOR_SKIN_WINDOW_TEXT))
            y += font_height + GUI_LOOK_LINES_SPACING_Y;

    // Quit now if it is not an analog device..
    if (!(input_src->flags & INPUT_SRC_FLAGS_ANALOG))
        return;

    // Horizontal Separator
    line (bmp, x + 4, y + 3, x + frame_x - 4, y + 3, COLOR_SKIN_WINDOW_SEPARATORS);
    y += 7;

    // Emulate Digital
    widget_checkbox_redraw (app->CheckBox_Emulate_Digital);
    Font_Print (-1, bmp, Msg_Get(MSG_Inputs_Config_Source_Emulate_Joypad), x + GUI_LOOK_FRAME_PAD_X + INPUTS_CFG_CHECK_X + 3, y, COLOR_SKIN_WINDOW_TEXT);
    y += font_height + GUI_LOOK_LINES_SPACING_Y;
}
예제 #14
0
byte        Inputs_CFG_Current_Source_Draw_Map (int i, int Color)
{
    t_app_inputs_config *app = &Inputs_CFG; // Global instance

    int         x, y;
    char *      MapName;
    char        MapValue[128];
    t_input_src *input_src = Inputs.Sources [Inputs_CFG.Current_Source];
    t_input_map *Map = &input_src->Map[i];

    MapName = Inputs_Get_MapName (input_src->type, i);
    if (MapName == NULL)
        return FALSE;

    // Set default font
    Font_SetCurrent (F_SMALL);

    x = 165;
    // Shift Y position by 2 steps for analog devices
    if (input_src->flags & INPUT_SRC_FLAGS_ANALOG && i > INPUT_MAP_ANALOG_AXIS_Y_REL)
        i -= 2;
    y = 10 + GUI_LOOK_FRAME_PAD1_Y + (2 + i) * (Font_Height(-1) + GUI_LOOK_LINES_SPACING_Y) + 7;

    if (Map->Idx == -1)
        sprintf (MapValue, "<Null>");
    else
    {
        switch (input_src->type)
        {
        case INPUT_SRC_TYPE_KEYBOARD:
            {
                const t_key_info *key_info = KeyInfo_FindByScancode (Map->Idx);
                strcpy (MapValue, key_info ? key_info->name : "error");
                break;
            }
        case INPUT_SRC_TYPE_JOYPAD:
            switch (Map->Type)
            {
            case INPUT_MAP_TYPE_JOY_AXIS:
                sprintf (MapValue, "Stick %d, Axis %d, %c",
                    INPUT_MAP_GET_STICK(Map->Idx),
                    INPUT_MAP_GET_AXIS(Map->Idx),
                    INPUT_MAP_GET_DIR_LR(Map->Idx) ? '+' : '-');
                break;
                // case INPUT_MAP_TYPE_JOY_AXIS_ANAL:
            case INPUT_MAP_TYPE_JOY_BUTTON:
                sprintf (MapValue, "Button %d", Map->Idx);
                break;
            }
            break;
        case INPUT_SRC_TYPE_MOUSE:
            switch (Map->Type)
            {
            case INPUT_MAP_TYPE_MOUSE_AXIS:
                sprintf (MapValue, "Axis %d (%c)",
                    INPUT_MAP_GET_AXIS(Map->Idx),
                    'X' + INPUT_MAP_GET_AXIS(Map->Idx));
                break;
            case INPUT_MAP_TYPE_MOUSE_BUTTON:
                sprintf (MapValue, "Button %d", Map->Idx+1);
                break;
            }
            break;
        }
    }
    Font_Print (-1, app->box->gfx_buffer, MapName, x + GUI_LOOK_FRAME_PAD_X, y, Color);
    Font_Print (-1, app->box->gfx_buffer, MapValue, x + (INPUTS_CFG_FRAME_X / 2), y, Color);
    // y += Font_Height() + GUI_LOOK_LINES_SPACING_Y;

    // Set both checkbox widgets as dirty (because we drawn over them during the clear)
    widget_set_dirty(app->CheckBox_Enabled);
    widget_set_dirty(app->CheckBox_Emulate_Digital);

    return TRUE;
}
예제 #15
0
파일: games.c 프로젝트: dafyddcrosby/meka
void    Pong_Update (void)
{
    char   score [20];

    circlefill (pong.scr, pong.ballx, pong.bally, 3, COLOR_BLACK);
    pong.ballx += pong.balldx;
    pong.bally += pong.balldy;
    circlefill (pong.scr, pong.ballx, pong.bally, 3, COLOR_WHITE);
    if (pong.balldx > 0)
    {
        if (pong.ballx > 255)
        {
            pong.p1score ++;
            circlefill (pong.scr, pong.ballx, pong.bally, 3, COLOR_BLACK);
            Pong_Init_Ball ();
        }
        if (pong.ballx > 245)
            if ((pong.bally >= pong.p2y - 1) && (pong.bally <= pong.p2y + 33))
            {
                pong.balldx =- pong.balldx;
                pong.balldy = (pong.bally - pong.p2y - 16) / 6;
            }
    }
    else
    {
        if (pong.ballx < 9)
        {
            pong.p2score ++;
            circlefill (pong.scr, pong.ballx, pong.bally, 3, COLOR_BLACK);
            Pong_Init_Ball ();
        }
        if (pong.ballx < 19)
            if ((pong.bally >= pong.p1y - 1) && (pong.bally <= pong.p1y + 33))
            {
                pong.balldx =- pong.balldx;
                pong.balldy = (pong.bally - pong.p1y - 16) / 6;
            }
    }
    if (key[KEY_W] | key[KEY_S])
    {
        rectfill (pong.scr, 9, pong.p1y, 13, pong.p1y + 32, COLOR_BLACK);
        if ((key [KEY_W]) && (pong.p1y > 12)) pong.p1y -= 3;
        if ((key [KEY_S]) && (pong.p1y < 157)) pong.p1y += 3;
        rectfill (pong.scr, 9, pong.p1y, 13, pong.p1y + 32, COLOR_WHITE);
    }
    if (key [KEY_UP] | key [KEY_DOWN])
    {
        rectfill (pong.scr, 250, pong.p2y, 254, pong.p2y + 32, COLOR_BLACK);
        if ((key[KEY_UP]) && (pong.p2y > 12)) pong.p2y -= 3;
        if ((key[KEY_DOWN]) && (pong.p2y < 157)) pong.p2y += 3;
        rectfill (pong.scr, 250, pong.p2y, 254, pong.p2y + 32, COLOR_WHITE);
    }
    if ((pong.balldy > 0) && (pong.bally > 187)) pong.balldy =- pong.balldy;
    if ((pong.balldy < 0) && (pong.bally < 14))  pong.balldy =- pong.balldy;

    Font_SetCurrent (F_MIDDLE);
    sprintf (score, "%d - %d", pong.p1score, pong.p2score);
    rectfill (pong.scr, 0, 1, 255, 1 + Font_Height(-1), COLOR_BLACK);
    Font_Print (-1, pong.scr, score, 8 + ((248 - Font_TextLength(-1, score)) / 2), 1, COLOR_WHITE);

    Games_Blit ();
}
UINT32 A025DL02_Driver::TextRows()
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();
    return (g_LcdController_Config.Height / Font_Height());
}
예제 #17
0
UINT32 ILI9328_Driver::TextRows()
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();
    return (g_ILI9328_Config.ControllerConfig.Height / Font_Height());
}
예제 #18
0
void        Inputs_CFG_Peripherals_Draw (void)
{
    t_app_inputs_config *app = &Inputs_CFG; // Global instance
    BITMAP *bmp = app->box->gfx_buffer;

    int     i;
    BITMAP *sprite = NULL;

    // Set update flag
    app->box->flags |= GUI_BOX_FLAGS_DIRTY_REDRAW;

    // Set font to use
    Font_SetCurrent (F_SMALL);

    // Clear area to display on
    rectfill(bmp, 10, 20, 10 + Graphics.Inputs.InputsBase->w, 20 + Font_Height(-1), COLOR_SKIN_WINDOW_BACKGROUND);
    rectfill(bmp, 10, 58, 10 + Graphics.Inputs.InputsBase->w, 121, COLOR_SKIN_WINDOW_BACKGROUND);

    // Print 'click to select peripheral' message
    Font_PrintCentered(-1, bmp, Msg_Get(MSG_Inputs_Config_Peripheral_Click), 
        10 + 11 + (64 / 2) + (58 / 2),
        4, COLOR_SKIN_WINDOW_TEXT);

    // Do the actual display
    for (i = 0; i < PLAYER_MAX; i++)
    {
        // Print name
        const char *name = Inputs_Peripheral_Infos [Inputs.Peripheral [i]].name;
        Font_PrintCentered(-1, bmp, name, 
            10 + 11 + (i ? 64 : 0) + (58 / 2), // X
            20, // Y
            COLOR_SKIN_WINDOW_TEXT);

        // Draw peripheral sprite
        switch (Inputs.Peripheral [i])
        {
            case INPUT_JOYPAD:        sprite = Graphics.Inputs.Joypad;          break;
            case INPUT_LIGHTPHASER:   sprite = Graphics.Inputs.LightPhaser;     break;
            case INPUT_PADDLECONTROL: sprite = Graphics.Inputs.PaddleControl;   break;
            case INPUT_SPORTSPAD:     sprite = Graphics.Inputs.SportsPad;       break;
            case INPUT_TVOEKAKI:      sprite = Graphics.Inputs.TvOekaki;        break;
        }
        if (sprite != NULL)
        {
            draw_sprite (bmp, sprite,
            10 + 11 + (i ? 64 : 0) + (58 - sprite->w) / 2, // X
            58); // Y
        }
    }

    // 3-D Glasses
    // Draw below player 2 peripheral
    if (Glasses.Enabled)
    {
        int x, y;
        BITMAP *b = Graphics.Inputs.Glasses;
        x = 10 + 11 + 64 + (58 - b->w) / 2;
        y = 58 + sprite->h + 5;
        // rectfill (bmp, x, y, x + b->w, y + b->h, COLOR_SKIN_WINDOW_BACKGROUND);
        draw_sprite (bmp, b, x, y);
    }
}
UINT32 HD66773R_Driver::TextRows()
{
    NATIVE_PROFILE_HAL_DRIVERS_DISPLAY();
    return (g_HD66773R_Config.Height / Font_Height());
}
예제 #20
0
파일: games.c 프로젝트: dafyddcrosby/meka
void    Tetris_Draw_Score (void)
{
    char          s[20];
    static int    last_score = -1;
    static int    last_level = -1;

    if (to.score == last_score)
        return;
    Font_SetCurrent (F_MIDDLE);
    rectfill (to.scr, 171, 1, 250, Font_Height(-1), COLOR_BLACK);
    sprintf (s, "Score: %d", to.score);
    Font_Print (-1, to.scr, s, 171, 1, COLOR_WHITE);
    last_score = to.score;
    if (to.level != last_level)
    {
        rectfill (to.scr, 171, 41, 250, Font_Height(-1), COLOR_BLACK);
        sprintf (s, "Level: %d", to.level);
        Font_Print (-1, to.scr, s, 171, 41, COLOR_WHITE);
        last_level = to.level;
        if (to.level > 1)
            switch (to.level)
            {
            case 2:
                Msg (MSGT_USER, "Do you enjoy wasting your time ?");
                break;
            case 3:
                Msg (MSGT_USER, "I think you should get a life !");
                break;
            case 4:
                Msg (MSGT_USER, "Ok... you must be very bored...");
                break;
            case 5:
                Msg (MSGT_USER, "...So, i'll propose you a new game.");
                break;
            case 6:
                Msg (MSGT_USER, "Find the bugs of this game :-)");
                break;
            case 7:
                Msg (MSGT_USER, "You don't have find them yet ?");
                break;
            case 8:
                Msg (MSGT_USER, "Ok, I'll tell you one...");
                break;
            case 9:
                Msg (MSGT_USER, "... play another 2147483638 levels..");
                break;
            case 10:
                Msg (MSGT_USER, "... and you'll see that the game is very slow !");
                break;
            default:
                switch (Random(3))
                {
                case 0:
                    Msg (MSGT_USER, "only %i levels to wait..", 2147483638-to.level);
                    break;
                case 1:
                    Msg (MSGT_USER, "Windows will crash before, anyway");
                    break;
                case 2:
                    Msg (MSGT_USER, "In fact, Windows have the same bug :");
                    Msg (MSGT_USER, "when the timer int overflows, Windows crash :-)");
                    break;
                }
            }
    }
}