amarullz

uefi loop

Jan 13th, 2016
128
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.00 KB | None | 0 0
  1. UINTN WaitIndex;
  2. EFI_INPUT_KEY Key;
  3. while(TRUE) {
  4. int button_y = dialog_y+dialog_h-libaroma_dp(52);
  5.  
  6. /* clean button area */
  7. libaroma_draw_rect(dc, dialog_x, button_y, dialog_w, libaroma_dp(36), colorBackground, 0xff);
  8.  
  9. if(Button1) {
  10. /* button1 */
  11. int button_w = button_width(Button1);
  12. int button_x = dialog_x+dialog_w-button_w-libaroma_dp(16);
  13.  
  14. if(Selection==0) {
  15. libaroma_gradient_ex(dc,
  16. button_x,button_y,
  17. button_w, libaroma_dp(36),
  18. colorSelection,colorSelection,
  19. libaroma_dp(2), /* rounded 2dp */
  20. 0x1111, /* all corners */
  21. 0x40, 0x40 /* start & end alpha */
  22. );
  23. }
  24. button_draw(Button1, button_x, button_y-libaroma_dp(2), button_w, libaroma_dp(36));
  25.  
  26. /* button2 */
  27. if(Button2) {
  28. button_w = button_width(Button2);
  29. button_x -= (libaroma_dp(8)+button_w);
  30. if(Selection==1) {
  31. libaroma_gradient_ex(dc,
  32. button_x,button_y,
  33. button_w, libaroma_dp(36),
  34. colorSelection,colorSelection,
  35. libaroma_dp(2), /* rounded 2dp */
  36. 0x1111, /* all corners */
  37. 0x40, 0x40 /* start & end alpha */
  38. );
  39. }
  40. button_draw(Button2, button_x, button_y-libaroma_dp(2), button_w, libaroma_dp(36));
  41. }
  42. }
  43. libaroma_sync();
  44.  
  45. EFI_STATUS Status = gBS->WaitForEvent (1, &gST->ConIn->WaitForKey, &WaitIndex);
  46. ASSERT_EFI_ERROR (Status);
  47.  
  48. Status = gST->ConIn->ReadKeyStroke (gST->ConIn, &Key);
  49.  
  50. if(Key.ScanCode==SCAN_NULL) {
  51. switch(Key.UnicodeChar) {
  52. case CHAR_CARRIAGE_RETURN:
  53. RenderActiveMenu();
  54. mGop->SetMode(mGop, OldMode);
  55. return Selection;
  56. }
  57. }
  58. else {
  59. switch(Key.ScanCode) {
  60. case SCAN_UP:
  61. if(Selection>0)
  62. Selection--;
  63. else Selection = MaxSelection-1;
  64. break;
  65. case SCAN_DOWN:
  66. if(Selection+1<MaxSelection)
  67. Selection++;
  68. else Selection = 0;
  69. break;
  70. }
  71. }
  72. }
Advertisement
Add Comment
Please, Sign In to add comment