Example #1
0
Screen* meh_screen_launch_new(App* app, Screen* src_screen, Platform* platform, Executable* executable,
															WidgetImage* src_widget) {
	g_assert(app != NULL);
	g_assert(src_screen != NULL);
	g_assert(platform != NULL);
	g_assert(executable != NULL);

	Screen* screen = meh_screen_new(app->window);

	screen->name = g_strdup("Launch screen");
	screen->messages_handler = &meh_screen_launch_messages_handler;
	screen->destroy_data = &meh_screen_launch_destroy_data;

	/*
	 * custom data
	 */
	LaunchData* data = g_new(LaunchData, 1);

	data->src_screen = src_screen;
	data->image_widget = NULL;
	data->executable = executable;
	data->platform = platform;
	data->src_widget = src_widget;
	data->zoom_logo = FALSE;

	/* fading rect */
	SDL_Color black = { 0, 0, 0 ,0 };
	data->fade_widget = meh_widget_rect_new(0, 0, MEH_FAKE_WIDTH, MEH_FAKE_HEIGHT, black, TRUE);
	data->fade_widget->a = meh_transition_start(MEH_TRANSITION_LINEAR, 1, 254, app->settings.fade_duration*4);
	meh_screen_add_rect_transitions(screen, data->fade_widget);

	if (app->settings.zoom_logo && src_widget != NULL) {
		/* cover image */
		data->image_widget = meh_widget_image_new(
									src_widget->texture,
									src_widget->x.value,
									src_widget->y.value,
									src_widget->h.value,
									src_widget->w.value);

		/* starts the cover transitions */
		data->image_widget->x = meh_transition_start(MEH_TRANSITION_CUBIC, src_widget->x.value, -(MEH_FAKE_WIDTH), app->settings.fade_duration*4);
		data->image_widget->y = meh_transition_start(MEH_TRANSITION_CUBIC, src_widget->y.value, -(MEH_FAKE_HEIGHT), app->settings.fade_duration*4);
		data->image_widget->w = meh_transition_start(MEH_TRANSITION_CUBIC, src_widget->w.value, MEH_FAKE_WIDTH*3, app->settings.fade_duration*4);
		data->image_widget->h = meh_transition_start(MEH_TRANSITION_CUBIC, src_widget->h.value, MEH_FAKE_HEIGHT*3, app->settings.fade_duration*4);
		meh_screen_add_image_transitions(screen, data->image_widget);

		data->zoom_logo = TRUE;
	}

	screen->data = data;

	return screen;
}
Example #2
0
void meh_exec_selection_prepare(App* app, Screen* screen) {
	g_assert(app != NULL);
	g_assert(screen != NULL);

	ExecutableListData* data = meh_exec_list_get_data(screen);

	SDL_Color white = { 255, 255, 255, 255 };
	SDL_Color white_transparent = { 255, 255, 255, 50 };

	/* Selection */
	data->selection_widget = meh_widget_rect_new(0, -100, 415, 28, white_transparent, TRUE);
	data->selection_widget->y = meh_transition_start(MEH_TRANSITION_CUBIC, -100, 130, 500);
	meh_screen_add_rect_transitions(screen, data->selection_widget);

	/* Executables */
	for (int i = 0; i < MEH_EXEC_LIST_SIZE; i++) {
		WidgetText* text = meh_widget_text_new(app->small_font, "", 55, 130+(i*32), 350, 30, white, FALSE);
		text->uppercase = TRUE; /* executables name in uppercase */
		g_queue_push_tail(data->executable_widgets, text);
	}
}
Example #3
0
Screen* meh_screen_popup_new(App* app, Screen* src_screen, Executable* executable)  {
    g_assert(app != NULL);
    g_assert(src_screen != NULL);
    g_assert(executable != NULL);

    Screen* screen = meh_screen_new(app->window);

    screen->name = g_strdup("Popup screen");
    screen->messages_handler = &meh_screen_popup_messages_handler;
    screen->destroy_data = &meh_screen_popup_destroy_data;

    /*
     * Custom data
     */
    PopupData* data = g_new(PopupData, 1);

    data->src_screen = src_screen;
    data->executable = executable;
    data->action = 0;
    data->width = 400;
    data->height = 200;
    data->x = MEH_FAKE_WIDTH/2 - data->width/2;
    data->y = MEH_FAKE_HEIGHT/2 - data->height/2;
    data->quitting = FALSE;

    /* Popup background */

    SDL_Color white = { 255, 255, 255, 255 };
    SDL_Color black = { 0, 0, 0, 240 };
    SDL_Color gray = { 15, 15, 15, 120 };
    SDL_Color light_gray = { 90, 90, 90, 220 };
    SDL_Color very_light_gray = { 40, 40, 40, 220 };

    data->background_widget = meh_widget_rect_new(data->x, data->y, data->width, data->height, very_light_gray, TRUE);
    data->background_widget->y = meh_transition_start(MEH_TRANSITION_LINEAR, -data->height, data->background_widget->y.value, 150);
    meh_screen_add_rect_transitions(screen, data->background_widget);
    screen->data = data;

    black.a = 150;
    data->hover_widget = meh_widget_rect_new(0, 0, MEH_FAKE_WIDTH, MEH_FAKE_HEIGHT, black, TRUE);

    /* Title */
    data->title_widget = meh_widget_text_new(app->small_bold_font, "OPTIONS", data->x+10, data->y+5, data->width-10, 40, white, TRUE);
    data->title_bg_widget = meh_widget_rect_new(data->x, data->y, data->width, 45, gray, TRUE);

    data->selection_widget = meh_widget_rect_new(
                                 data->x+5,
                                 data->y+54,
                                 data->width-10,
                                 30,
                                 light_gray,
                                 TRUE);


    /* Add/Remove to favorite */
    data->favorite_widget = meh_widget_text_new(
                                app->small_font,
                                executable->favorite == 1 ? "Remove from favorite" : "Add to favorite",
                                data->x+20,
                                data->y+55,
                                data->width-20,
                                30,
                                white,
                                TRUE);

    screen->data = data;

    return screen;
}
Example #4
0
Screen* meh_screen_popup_new(App* app, Screen* src_screen, Platform* platform, Executable* executable)  {
	g_assert(app != NULL);
	g_assert(src_screen != NULL);
	g_assert(executable != NULL);

	Screen* screen = meh_screen_new(app->window);

	screen->name = g_strdup("Popup screen");
	screen->messages_handler = &meh_screen_popup_messages_handler;
	screen->destroy_data = &meh_screen_popup_destroy_data;

	/*
	 * Custom data
	 */
	PopupData* data = g_new(PopupData, 1);

	data->src_screen = src_screen;
	data->executable = executable;
	data->platform = platform;
	data->action = 0;
	data->width = 400;
	data->height = 200;
	data->x = MEH_FAKE_WIDTH/2 - data->width/2;
	data->y = MEH_FAKE_HEIGHT/2 - data->height/2;

	/* Popup background */

	SDL_Color white = { 255, 255, 255, 255 };
	SDL_Color black = { 0, 0, 0, 240 };
	SDL_Color light_gray = { 40, 40, 40, 220 };

	screen->data = data;

	black.a = 210;
	data->hover_widget = meh_widget_rect_new(0, 0, MEH_FAKE_WIDTH, MEH_FAKE_HEIGHT, black, TRUE); 

	/* Title */
	data->title_widget = meh_widget_text_new(app->small_bold_font, "OPTIONS", -300, data->y+5, data->width-10, 40, white, TRUE);
	data->title_widget->x = meh_transition_start(MEH_TRANSITION_CUBIC, -300, 300, 350);
	meh_screen_add_text_transitions(screen, data->title_widget);

	data->selection_widget = meh_widget_rect_new(
			0,
			data->y+54,
			MEH_FAKE_WIDTH,
			30,
			light_gray,
			TRUE);

	/* Add/Remove to favorite */
	data->favorite_widget = meh_widget_text_new(
			app->small_font,
			executable->favorite == 1 ? "Remove from favorite" : "Add to favorite",
			400,
			data->y+55,
			data->width-20,
			30,
			white,
			TRUE);

	/* Run random */
	data->random_widget = meh_widget_text_new(
			app->small_font,
			"Run random executable of this platform",
			400,
			data->y+87,
			data->width-20,
			30,
			white,
			TRUE);

	screen->data = data;

	return screen;
}
Example #5
0
Screen* meh_main_popup_new(App* app, Screen* src_screen)  {
	g_assert(app != NULL);
	g_assert(src_screen != NULL);

	Screen* screen = meh_screen_new(app->window);

	screen->name = g_strdup("Main popup screen");
	screen->messages_handler = &meh_main_popup_messages_handler;
	screen->destroy_data = &meh_main_popup_destroy_data;

	/*
	 * Custom data
	 */
	MainPopupData* data = g_new(MainPopupData, 1);

	data->src_screen = src_screen;
	data->action = 0;
	data->width = 400;
	data->height = 200;
	data->x = MEH_FAKE_WIDTH/2 - data->width/2;
	data->y = MEH_FAKE_HEIGHT/2 - data->height/2;

	/* Popup background */

	SDL_Color white = { 255, 255, 255, 255 };
	SDL_Color black = { 0, 0, 0, 240 };
	SDL_Color light_gray = { 40, 40, 40, 220 };

	screen->data = data;

	black.a = 210;
	data->hover_widget = meh_widget_rect_new(0, 0, MEH_FAKE_WIDTH, MEH_FAKE_HEIGHT, black, TRUE); 

	/* Title */
	data->title_widget = meh_widget_text_new(app->small_bold_font, "COMMANDS", data->x+10, data->y+5, data->width-10, 40, white, TRUE);
	data->title_widget->x = meh_transition_start(MEH_TRANSITION_CUBIC, -300, 300, 350);
	meh_screen_add_text_transitions(screen, data->title_widget);

	data->selection_widget = meh_widget_rect_new(
			0,
			data->y+54,
			MEH_FAKE_WIDTH,
			30,
			light_gray,
			TRUE);

	data->title_widget->x = meh_transition_start(MEH_TRANSITION_CUBIC, -300, 300, 350);
	meh_screen_add_text_transitions(screen, data->title_widget);


	/* Run random executable */
	data->random_widget = meh_widget_text_new(
			app->small_font,
			"Run random executable",
			400,
			data->y+55,
			data->width-20,
			30,
			white,
			TRUE);

	/* Close mehstation */
	data->close_widget = meh_widget_text_new(
			app->small_font,
			"Close mehstation",
			400,
			data->y+87,
			data->width-20,
			30,
			white,
			TRUE);

	/* Shutdown */
	data->shutdown_widget = meh_widget_text_new(
			app->small_font,
			"Shutdown",
			400,
			data->y+119,
			data->width-20,
			30,
			white,
			TRUE);
	screen->data = data;

	return screen;
}