Example #1
0
void ui_select_time(uint8_t timer_id, uint8_t default_time, uint8_t max_time)
{
	if (ui_state == UIS_FIND_KEY)
		keyleds_off();

	selected_time = default_time;
	max_selectable_time = max_time;
	selected_key = timer_id;
	ui_state = UIS_SELECT_TIME;
	enable_lcd_backlight();
	reset_ui_timer();
	ui_repaint();
}
Example #2
0
extern void Update_UI(Player *myPlayer, void *game)
{
  struct timeval ui_start;
  struct timeval ui_end;
  gettimeofday(&ui_start, NULL);

  ui_repaint(ui, game, myPlayer);

  gettimeofday(&ui_end, NULL);

  double difference = (ui_end.tv_sec*1000 + ui_end.tv_usec*0.001) - (ui_start.tv_sec*1000 + ui_start.tv_usec*0.001);
  fprintf(stderr, "Time elapsed for UI: %.f milliseconds\n", difference);
}
Example #3
0
static void call_text_ui_object_right_function (ui_object *obj, void *arg)
{

	void
		((*function) (ui_object *object, void *arg));
	
	text_ui_object
		*text;

	text = (text_ui_object *) obj->data;

	function = text->area.right_function;

	if (function)
	{

		set_ui_object_redraw (obj, TRUE);

		if ((int) arg == BUTTON_STATE_DOWN)
		{

			set_ui_object_state (obj, UI_OBJECT_STATE_ON);
		}
		else 
		{
			
			set_ui_object_state (obj, UI_OBJECT_STATE_OFF);
		}

		if (
				(get_ui_object_notify_on (obj) == (int) arg) ||
				(get_ui_object_notify_on (obj) == NOTIFY_TYPE_BUTTON_EITHER)
			)
		{

			ui_repaint ();

			function (obj, (void *) arg);
		}
	}
}
Example #4
0
void ui_poll(void)
{
	uint8_t event = get_event();

	if (event == EV_NONE)
		return;

	switch (event) {
	case EV_ENCODER_CW:
		menu_button_forward();
		break;
	case EV_ENCODER_CCW:
		menu_button_back();
		break;
	case EV_ENCODER_PUSH:
		menu_activate();
		break;
	case EV_SMAUL_PUSH:
		menu_button_smaul();
		break;
	case EV_TICK:
		key_timer();
		count_ui_timer();
		smaul_pulse_update();
		break;
	case EV_KEY_CHANGE:
		key_change();
		break;
	}

	if (event != EV_TICK && event != EV_KEY_CHANGE) {
		enable_lcd_backlight();
		reset_ui_timer();
	}

	ui_repaint();
}
Example #5
0
static void call_text_ui_object_function (ui_object *obj, void *arg)
{

	void
		((*function) (ui_object *object, void *arg));
	
	text_ui_object
		*text;

	ui_object
		*notify_obj,
		*list_parent;

	int
		mouse_state,
		mouse_graphic_state;

	text = (text_ui_object *) obj->data;

	function = text->area.function;

	if (function)
	{

		//set_ui_object_redraw (obj, TRUE);
		{

			ui_object
				*temp_obj;
	
			temp_obj = obj;
	
			while (temp_obj)
			{
	
				set_ui_object_redraw (temp_obj, TRUE);

				if (!get_ui_object_clear (temp_obj))
				{
	
					break;
				}
	
				temp_obj = get_ui_object_parent (temp_obj);
			}
		}

		if ((int) arg == BUTTON_STATE_DOWN)
		{

			set_ui_object_state (obj, UI_OBJECT_STATE_ON);
		}
		else 
		{
			
			set_ui_object_state (obj, UI_OBJECT_STATE_OFF);
		}

		//
		// if list text get lists notify type
		//

		list_parent = get_ui_object_parent (obj);

		notify_obj = obj;

		if (list_parent->type == UI_TYPE_LIST_BOX)
		{

			notify_obj = list_parent;
		}

		if
			(
				(get_ui_object_notify_on (notify_obj) == (int) arg) ||
				(get_ui_object_notify_on (notify_obj) == NOTIFY_TYPE_BUTTON_EITHER)
			)
		{

			mouse_state = get_mouse_on ();

			mouse_graphic_state = get_mouse_graphic_on ();

//			set_mouse_off ();

			ui_repaint ();

			function (obj, (void *) arg);
		}

//		if (mouse_state)
//		{
//
//			set_mouse_on ();
//		}
//
//		if (mouse_graphic_state)
//		{
//
//			set_mouse_graphic_on ();
//		}
	}
}