Example #1
0
void preview_update(void* userdata, float dt)
{
    (void) dt;
    struct preview_context* ctx = userdata;
    /* Process input events */
    window_update(ctx->wnd);
}
Example #2
0
void gui_update_playlist(void) {
    window_draw_border(playlist_window);
    window_draw_title(playlist_window);
    window_draw_scrollbar(playlist_window);
    window_draw_list(playlist_window);
    window_update(playlist_window);
}
Example #3
0
void gui_update_filelist(void) {
	if(!filelist_window){
		return;
	}
	window_draw_border(filelist_window);
	window_draw_title(filelist_window);
	window_draw_scrollbar(filelist_window);
	window_draw_list(filelist_window);
	window_update(filelist_window);

	//Update the info window as we are updated as well
	gui_update_info();
	gui_update();
}
Example #4
0
/*
 *  Execution of the clock window
 */
int clock_loop() {
	time_t now, prev = 0;
	struct tm* tm;
	char buff[100];
	int ret;
	int clockDeli = 1;

	Window *w = window[curr_window_idx];

	while (1) {

		if ((ret = handle_input()))
			return ret;

		now = time(0);

		if (now > prev) {

			tm = localtime(&now);
			prev = now;

			clockDeli = clockDeli == 1 ? 0 : 1;

			if (clockDeli) {
				sprintf(buff, "%02d:%02d", tm->tm_hour, tm->tm_min);
			} else {
				sprintf(buff, "%02d %02d", tm->tm_hour, tm->tm_min);
			}

			picframe_load_font("/usr/share/fonts/UbuntuMono-R.ttf", 115);
			Element_t *time_disp = window_get_element_byName(w, "time");
			time_disp->surface = TTF_RenderText_Shaded(_font, buff, fg, bg);

			strftime(buff, sizeof(buff), "%a, %d %b %Y %Z", tm);

			picframe_load_font("/usr/share/fonts/Ubuntu-L.ttf", 29);
			Element_t *info_disp = window_get_element_byName(w, "info");
			info_disp->surface = TTF_RenderText_Shaded(_font, buff, fg, bg);

			window_update(window[curr_window_idx]);

		}

		SDL_Delay(1);
	}
	return 0;
}
Example #5
0
void gui_update_playback_time(void) {
	int elapsed, remaining, length, color;
	
	elapsed = engine_get_elapsed();
	if (last_elapsed != elapsed) {
		color = engine_is_paused()? conf->colors[PLAYBACK_TEXT] | A_BLINK : conf->colors[PLAYBACK_TEXT];
		last_elapsed = elapsed;
		remaining = engine_get_remaining();
		length = engine_get_length();

		wattrset(playback_window->win, color);
		if (!length) {
			mvwprintw(playback_window->win, 1, 1, " Time  : %02d:%02d:%02d                      ",
					(int) elapsed / 3600, //Aantal Uur
					(int) elapsed / 60, //Aantal Minuten
					((int) elapsed) % 60 //Aantal Seconden
			);
		} else if (length > 3600) {
			mvwprintw(playback_window->win, 1, 1, " Time  : %02d:%02d:%02d / %02d:%02d:%02d (%02d:%02d:%02d)",
					(int) elapsed / 3600, //Uren
					(int) (elapsed % 3600) / 60, //Minuten
					(int) (elapsed % 3600) % 60, //Seconden
					(int) remaining / 3600, //Uren
					(int) (remaining % 3600) / 60, //Minuten
					(int) (remaining % 3600) % 60, //Seconden
					(int) length / 3600, //Uren
					(int) (length % 3600) / 60, //Minuten
					(int) (length % 3600) % 60 //Seconden
			);
		} else {
			mvwprintw(playback_window->win, 1, 1, " Time  : %02d:%02d / %02d:%02d (%02d:%02d)         ",
					(int) elapsed / 60, //Minuten
					(int) elapsed % 60, //Seconden
					(int) remaining / 60, //Minuten
					(int) remaining % 60, //Seconden
					(int) length / 60, //Minuten
					(int) length % 60 //Seconden
			);
		}
	}
	window_update(playback_window);
}
Example #6
0
//
// weather_today_loop
//
int weather_loop() {

	char weather[200];

	Window *w = window[curr_window_idx];

	Element_t *e = window_get_element_byName(w, "weather");

	/* format weather file name */
	sprintf(weather, weatherFileTemplate, curr_window_idx - 1);

	e->surface = IMG_Load(weather);

	window_update(window[curr_window_idx]);

	SDL_FreeSurface(e->surface);

	// calling `app_loop`
	return app_loop();

}
Example #7
0
int main(int argc, char** argv) {
	init_core();
	debug_message("[hunter] initialized core");

	init_graphic();
	debug_message("[hunter] initialized graphics, mode W%d H%d", window_get_width(global_get(global_get_singleton(), GLOBAL_WINDOW)), window_get_height(global_get(global_get_singleton(), GLOBAL_WINDOW)));

	init_sound();
	debug_message("[hunter] initialized sound");

	init_systems();
	debug_message("[hunter] initialized systems");

	window* window_handle = global_get(global_get_singleton(), GLOBAL_WINDOW);
	input* input_handle = global_get(global_get_singleton(), GLOBAL_INPUT);
	syscontainer* syscontainer_handle = global_get(global_get_singleton(), GLOBAL_SYSCONTAINER);
	text* text_handle = global_get(global_get_singleton(), GLOBAL_TEXT);
	hl_render* hl_render_handle = global_get(global_get_singleton(), GLOBAL_HL_RENDER);
	shader* shader_texture_handle = global_get(global_get_singleton(), GLOBAL_SHADER_TEXTURE);
	camera* camera_handle = global_get(global_get_singleton(), GLOBAL_CAMERA);
	debug_draw* debug_draw_handle = global_get(global_get_singleton(), GLOBAL_DEBUG_DRAW);

	float delta_ref_point = time_get_elapsed(window_handle);
	float delta_accumulator = 0.0f;
	float delta_frame_time = 0.0f;

	float fps_accumulator = 0.0f;
	float fps_value = 0.0f;
	float fps_value_last = fps_value;
	unsigned int fps_counter = 0;

	unsigned int game_kill_flag = 0;

	debug_message("[hunter] posting init event to systems");
	syscontainer_post_event(syscontainer_handle, EVENT_INIT);

	while (!game_kill_flag) {
		delta_frame_time = time_get_elapsed(window_handle) - delta_ref_point;
		delta_ref_point = time_get_elapsed(window_handle);

		window_update(window_handle);

		input_state current_input_state;
		input_get_input_state(input_handle, &current_input_state);

		game_kill_flag |= window_get_should_close(window_handle);
		game_kill_flag |= current_input_state.key_dev;

		window_set_clear_color(window_handle, 1.0f, 0.0f, 1.0f, 0.0f);
		debug_draw_clear(debug_draw_handle);
		window_clear(window_handle);

		delta_accumulator += delta_frame_time;

		if (delta_accumulator < 0.0f) {
			delta_accumulator = 0.0f;
		}

		while (delta_accumulator >= 1.0f / DELTA_REFERENCE_FPS) {
			syscontainer_post_event(syscontainer_handle, EVENT_PRE_LOGIC);
			syscontainer_post_event(syscontainer_handle, EVENT_LOGIC);
			syscontainer_post_event(syscontainer_handle, EVENT_POST_LOGIC);

			delta_accumulator -= 1.0f / DELTA_REFERENCE_FPS;
		}

		syscontainer_post_event(syscontainer_handle, EVENT_DRAW);

		window_set_blend_mode(window_handle, WINDOW_BLEND_ALPHA);

		debug_draw_render_all(debug_draw_handle);

		hl_render_draw(hl_render_handle, shader_texture_handle, camera_handle);
		hl_render_clear(hl_render_handle);

		fps_counter++;
		fps_accumulator += delta_frame_time;

		if (fps_accumulator >= 1.0f) {
			fps_value_last = fps_value;
			fps_value = (float) fps_counter / fps_accumulator;
			fps_counter = 0;
			fps_accumulator = 0.0f;
		}

		text_batch fps_batch = {20, 20, 0.2f, 0.8f, 1.0f, 1.0f, "", "monospace", 12};
		sprintf(fps_batch.text_data, "FPS : %3.2f (%3.2f)", fps_value, fps_value - fps_value_last);

		text_submit_batch(text_handle, &fps_batch);

		text_render_all(text_handle);
		text_flush_batch(text_handle);

		window_swap_buffers(window_handle);
	}

	debug_message("[hunter] posting destroy event to systems");
	syscontainer_post_event(syscontainer_handle, EVENT_DESTROY);

	free_systems();
	free_sound();
	free_graphic();
	free_core();

	h_free_all();

	debug_message("[hunter] terminated cleanly");
	return 0;
}
Example #8
0
File: info.c Project: thexa4/mjs
void gui_update_info(void) {
	info_window->file = active_window->list->selected;
	window_draw_info(info_window);
	window_update(info_window);
}
void update()
{
	window_update(window);
}
Example #10
0
 inline void window::update()
 {
   window_update(hwnd);
 }
Example #11
0
void gled_update()
{
  window_update(main_win);
  window_redraw(main_win);
}
Example #12
0
File: bar.c Project: debolk/mjs
void gui_update_bar(void) {
	gui_draw_bar();
	window_update(bar_window);
}