UEFIStarter
a simple UEFI framework
|
This application showcases a few ways to use the graphics output. More...
#include <Uefi.h>
#include <Library/UefiLib.h>
#include <Library/ShellCEntryLib.h>
#include <Library/UefiBootServicesTableLib.h>
#include <Library/BaseMemoryLib.h>
#include <UEFIStarter/core.h>
#include <UEFIStarter/graphics.h>
Macros | |
#define | ARG_SKIP_BARS _argument_list[0].value.uint64 |
helper macro to access the "-skip-bars" command-line argument | |
#define | ARG_SKIP_IMAGES _argument_list[1].value.uint64 |
helper macro to access the "-skip-images" command-line argument | |
#define | ARG_SKIP_FONT _argument_list[2].value.uint64 |
helper macro to access the "-skip-font" command-line argument | |
#define | ARG_SKIP_OBJECTS _argument_list[3].value.uint64 |
helper macro to access the "-skip-objects" command-line argument | |
#define | ARG_SKIP_ANIM _argument_list[4].value.uint64 |
helper macro to access the "-skip-anim" command-line argument | |
#define | REG(NAME) register long NAME asm (#NAME); |
shortcut macro to access a CPU register | |
Typedefs | |
typedef image_t * | image_parser_f(file_contents_t *) |
data type for image parser function pointers | |
Functions | |
UINT8 | ramp (UINTN val) |
Produces a triangular waveform going from 0 to 255 and back to 0 again. More... | |
void | draw_progress_bar (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, unsigned int screen_w, unsigned int screen_h, float value) |
Draws a single frame of the progress bar. More... | |
void | draw_moving_objects (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) |
Draws an animation with objects moving across the screen. More... | |
void | draw_prepared_fs_anim (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) |
Draws an animated progress bar, then a full-screen animation. More... | |
void | draw_image (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop, CHAR16 *filename, image_parser_f parser) |
Loads an image and then draws it to the screen. More... | |
void | draw_bars (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) |
Draws a few vertical bars onto the screen. More... | |
void | draw_font (EFI_GRAPHICS_OUTPUT_PROTOCOL *gop) |
Draws white text on a blue background. More... | |
void | do_graphics_stuff () |
Performs all the enabled graphics demonstrations. | |
INTN EFIAPI | ShellAppMain (UINTN argc, CHAR16 **argv) |
Main function, gets invoked by UEFI shell. More... | |
Variables | |
static cmdline_argument_t | _argument_list [] |
list of command-line arguments More... | |
static cmdline_argument_group_t | _arguments ={ L"Application-specific options" ,sizeof( _argument_list )/sizeof(cmdline_argument_t), _argument_list } |
command-line arguments group | |
This application showcases a few ways to use the graphics output.
There are a few command-line options you can use to skip individual demos or change graphics settings.
You'll need to run this application in a graphics-capable UEFI environment. Virtual machines created with the Vagrantfile included in this repository don't support graphics: the application will still run and expect a few keystrokes but you'll just see a text hint on the console.
If you have QEMU installed on a system with e.g. the X11 server (or are using it on Windows) you can execute the target image (target/*.img) there - see the Makefile's "run" target on how to do that.
If you're using VirtualBox the easiest way to run this application is probably by creating a new VM (no harddisk required), enabling EFI (Machine Settings / System / Enable EFI) and mounting the generated ISO image (target/*.iso). Booting this VM should take you to the UEFI shell as usual.
UINT8 ramp | ( | UINTN | val | ) |
Produces a triangular waveform going from 0 to 255 and back to 0 again.
val | the position in the triangle function |
void draw_progress_bar | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop, |
unsigned int | screen_w, | ||
unsigned int | screen_h, | ||
float | value | ||
) |
Draws a single frame of the progress bar.
gop | the UEFI graphics output protocol to draw with |
screen_w | the screen's width |
screen_h | the screen's height |
value | the progress to draw, within [0..1] |
void draw_moving_objects | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop | ) |
Draws an animation with objects moving across the screen.
This also limits the frame rate (and waits for vsync if enabled in the command line) to reduce flickering.
gop | the UEFI graphics protocol to draw with |
void draw_prepared_fs_anim | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop | ) |
Draws an animated progress bar, then a full-screen animation.
This actually prepares a background buffer that's twice the screen height and then scrolls down to simulate movement.
gop | the UEFI graphics protocol to draw with |
void draw_image | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop, |
CHAR16 * | filename, | ||
image_parser_f | parser | ||
) |
Loads an image and then draws it to the screen.
gop | the UEFI graphics protocol to draw with |
filename | the image's filename |
parser | the image parser function |
void draw_bars | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop | ) |
Draws a few vertical bars onto the screen.
gop | the UEFI graphics protocol to draw with |
void draw_font | ( | EFI_GRAPHICS_OUTPUT_PROTOCOL * | gop | ) |
Draws white text on a blue background.
gop | the UEFI graphics protocol to draw with |
INTN EFIAPI ShellAppMain | ( | UINTN | argc, |
CHAR16 ** | argv | ||
) |
Main function, gets invoked by UEFI shell.
argc | the number of command-line arguments passed |
argv | the command-line arguments passed |
|
static |
list of command-line arguments