void control_bank_init(ControlBank* cb) { cb->flags = 0x00; cb->checkboxes = 0x00; cb->bipolar_checkboxes = 0x00; for (u8 i = 0; i < GRID_SIZE; i++) { slider_init(&cb->sliders[i], 128 / GRID_SIZE, -1, 0); cb->control_numbers[i] = i + 1; cb->channel_numbers[i] = 0; } }
/** * Initialize the templ theme * @param hue [0..360] hue value from HSV color space to define the theme's base color * @param font pointer to a font (NULL to use the default) * @return pointer to the initialized theme */ lv_theme_t * lv_theme_templ_init(uint16_t hue, lv_font_t *font) { if(font == NULL) font = LV_FONT_DEFAULT; _hue = hue; _font = font; /*For backward compatibility initialize all theme elements with a default style */ uint16_t i; lv_style_t **style_p = (lv_style_t**) &theme; for(i = 0; i < sizeof(lv_theme_t) / sizeof(lv_style_t*); i++) { *style_p = &def; style_p++; } basic_init(); cont_init(); btn_init(); label_init(); img_init(); line_init(); led_init(); bar_init(); slider_init(); sw_init(); lmeter_init(); gauge_init(); chart_init(); cb_init(); btnm_init(); kb_init(); mbox_init(); page_init(); ta_init(); list_init(); ddlist_init(); roller_init(); tabview_init(); win_init(); return &theme; }
static void ui_init() { if (TTF_Init()) { FAIL("TTF_Init Error: %s\n", SDL_GetError()); } screen = SDL_SetVideoMode(layout.window.w, layout.window.h, 0, SDL_DOUBLEBUF); #ifdef UI_ALPHA_BLENDING SDL_SetAlpha(screen, SDL_SRCALPHA, SDL_ALPHA_OPAQUE); // | SDL_ANYFORMAT | SDL_FULLSCREEN | SDL_HWSURFACE); #endif if (!screen) FAIL("SDL_SetVideoMode Error: %s\n", SDL_GetError()); #define X(s, l) \ s = ui_create_surface_or_die(l.w, l.h); SURFACES #undef X slider_init(); graph_init(); ui_waveform_init(); mouse_is_down = 0; mouse_drag_fn_p = 0; mouse_drop_fn_p = 0; active_pattern = -1; active_slot = -1; active_preview = 0; if (layout.master.scale < 1.0) layout.master.scale = 1.0; int master_w = layout.master.w / layout.master.scale; int master_h = layout.master.h / layout.master.scale; master_pixels = master_w * master_h; master_xs = malloc(sizeof(float) * master_pixels); master_ys = malloc(sizeof(float) * master_pixels); master_frame = malloc(sizeof(color_t) * master_pixels); if(!master_xs) FAIL("Unable to alloc xs for master.\n"); if(!master_ys) FAIL("Unable to alloc ys for master.\n"); if(!master_frame) FAIL("Unable to alloc frame for master.\n"); int i = 0; for (int y = 0; y < master_h; y++) { for (int x = 0; x < master_w; x++) { master_xs[i] = ((float)x / (master_w - 1)) * 2 - 1; master_ys[i] = ((float)y / (master_h - 1)) * 2 - 1; i++; } } printf("Sizeof master = %d\n", i); scaled_master = ui_create_surface_or_die(master_w, master_h); int pattern_w = layout.slot.preview_w / layout.slot.preview_scale; int pattern_h = layout.slot.preview_h / layout.slot.preview_scale; scaled_pattern = ui_create_surface_or_die(pattern_w, pattern_h); }