1 /* This is a small demo of the high-performance GUIX graphics framework. */
2
3 #include <stdio.h>
4 #include "gx_api.h"
5 #include "template_resources.h"
6 #include "template_specifications.h"
7
8 /* Define the ThreadX demo thread control block and stack. */
9
10 GX_WINDOW_ROOT *root;
11
12 TX_BYTE_POOL memory_pool;
13
14 #define SCRATCHPAD_PIXELS (PRIMARY_X_RESOLUTION * PRIMARY_X_RESOLUTION)
15 GX_COLOR scratchpad[SCRATCHPAD_PIXELS];
16
17 extern GX_CONST GX_STUDIO_WIDGET child_template_screen_dynamic_child_template_define;
18
19 /* Define prototypes. */
20 VOID start_guix(VOID);
21 extern UINT win32_graphics_driver_setup_24xrgb(GX_DISPLAY *display);
22
main(int argc,char ** argv)23 int main(int argc, char ** argv)
24 {
25 tx_kernel_enter();
26 return(0);
27 }
28
memory_allocate(ULONG size)29 VOID *memory_allocate(ULONG size)
30 {
31 VOID *memptr;
32
33 if (tx_byte_allocate(&memory_pool, &memptr, size, TX_NO_WAIT) == TX_SUCCESS)
34 {
35 return memptr;
36 }
37
38 return NULL;
39 }
40
memory_free(VOID * mem)41 VOID memory_free(VOID *mem)
42 {
43 tx_byte_release(mem);
44 }
45
tx_application_define(void * first_unused_memory)46 VOID tx_application_define(void *first_unused_memory)
47 {
48 /* Create the main demo thread. */
49
50 /* create byte pool for rotate to use */
51 tx_byte_pool_create(&memory_pool, "scratchpad", scratchpad,
52 SCRATCHPAD_PIXELS * sizeof(GX_COLOR));
53
54 start_guix();
55 }
56
start_guix(void)57 VOID start_guix(void)
58 {
59 /* Initialize GUIX. */
60 gx_system_initialize();
61
62 /* install our memory allocator and de-allocator */
63 gx_system_memory_allocator_set(memory_allocate, memory_free);
64
65 gx_studio_display_configure(PRIMARY, win32_graphics_driver_setup_24xrgb,
66 LANGUAGE_ENGLISH, PRIMARY_THEME_1, &root);
67
68 gx_studio_named_widget_create("template_screen", (GX_WIDGET *)root, GX_NULL);
69
70 gx_studio_named_widget_create("child_template_screen", GX_NULL, GX_NULL);
71
72 /* Show the root window to make it and patients screen visible. */
73 gx_widget_show(root);
74
75 /* start the GUIX thread */
76 gx_system_start();
77 }