Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- UINTN WaitIndex;
- EFI_INPUT_KEY Key;
- while(TRUE) {
- int button_y = dialog_y+dialog_h-libaroma_dp(52);
- /* clean button area */
- libaroma_draw_rect(dc, dialog_x, button_y, dialog_w, libaroma_dp(36), colorBackground, 0xff);
- if(Button1) {
- /* button1 */
- int button_w = button_width(Button1);
- int button_x = dialog_x+dialog_w-button_w-libaroma_dp(16);
- if(Selection==0) {
- libaroma_gradient_ex(dc,
- button_x,button_y,
- button_w, libaroma_dp(36),
- colorSelection,colorSelection,
- libaroma_dp(2), /* rounded 2dp */
- 0x1111, /* all corners */
- 0x40, 0x40 /* start & end alpha */
- );
- }
- button_draw(Button1, button_x, button_y-libaroma_dp(2), button_w, libaroma_dp(36));
- /* button2 */
- if(Button2) {
- button_w = button_width(Button2);
- button_x -= (libaroma_dp(8)+button_w);
- if(Selection==1) {
- libaroma_gradient_ex(dc,
- button_x,button_y,
- button_w, libaroma_dp(36),
- colorSelection,colorSelection,
- libaroma_dp(2), /* rounded 2dp */
- 0x1111, /* all corners */
- 0x40, 0x40 /* start & end alpha */
- );
- }
- button_draw(Button2, button_x, button_y-libaroma_dp(2), button_w, libaroma_dp(36));
- }
- }
- libaroma_sync();
- EFI_STATUS Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
- ASSERT_EFI_ERROR (Status);
- Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
- if(Key.ScanCode==SCAN_NULL) {
- switch(Key.UnicodeChar) {
- case CHAR_CARRIAGE_RETURN:
- RenderActiveMenu();
- mGop->SetMode(mGop, OldMode);
- return Selection;
- }
- }
- else {
- switch(Key.ScanCode) {
- case SCAN_UP:
- if(Selection>0)
- Selection--;
- else Selection = MaxSelection-1;
- break;
- case SCAN_DOWN:
- if(Selection+1<MaxSelection)
- Selection++;
- else Selection = 0;
- break;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment