Example #1
0
void gui_init(uint32_t fcpu_hz, uint32_t fhsb_hz, uint32_t fpbb_hz, uint32_t fpba_hz)
{
  et024006_Init(fcpu_hz, fhsb_hz);
  et024006_DrawFilledRect(0, 0, ET024006_WIDTH, ET024006_HEIGHT, BLACK);
  gpio_set_gpio_pin(ET024006DHU_BL_PIN);
  load_sdram_data(fhsb_hz);
  draw_startup(0, 0);
}
Example #2
0
void startup_load()
{
    load_file();
    if (in_startup_mode == false)
    {
        end_startup();
        post_load();
    }
    else
    {
        menu_activate(0);
        draw_startup(0);
    }
}
Example #3
0
int main(int argc, char *argv[]) {
	printf("mpflow - Copyright (C) 2009 Walter de Jong <*****@*****.**>\n");
	get_options(argc, argv);

	if (lock_program() == -1) {
		printf("another instance of mpflow is already running\n");
		return 1;
	}
	init_mpd();

/* init app */
	SDK_init();

	create_window();
	set_app_icon();

	init_gl();
	draw_startup();			/* only a border */

/* note that the order of init_() functions here is important (!) */
	init_textures();
	init_text();
	init_covers();
	init_events();

	init_widget_covers();
	init_widget_about();
	init_widget_aboutbutton();
	init_widget_titlebar();

	main_widget = &w_titlebar;
	prepare_widgets();
	draw();

	for(;;) {
		SDK_handle_events();
		move_covers();

		if (!moving)
			SDL_WaitEvent(NULL);
		else
			SDK_sleep(FRAME_DELAY);
	}
	exit_program(0);
	return 0;
}
Example #4
0
int main()
{
	gfxInitDefault();
	//gfxSet3D(true); // uncomment if using stereoscopic 3D

	memset(logstring, 0, 256);

	inaddr = linearAlloc(0x100000);
	outaddr = linearAlloc(0x100000);

	if(inaddr && outaddr)
	{
		memset(inaddr, 0, 0x100000);
		memset(outaddr, 0, 0x100000);
		draw_startup();
	}

	// Main loop
	while (aptMainLoop())
	{
		gspWaitForVBlank();
		hidScanInput();

		// Your code goes here

		u32 kDown = hidKeysDown();
		if (kDown & KEY_START)
			break; // break in order to return to hbmenu
	}

	if(inaddr)linearFree(inaddr);
	if(outaddr)linearFree(outaddr);

	gfxExit();
	return 0;
}
Example #5
0
void handle_menu_choice(eMenu item_hit) {
	std::string dialogToShow;
	sf::Event dummyEvent = {sf::Event::KeyPressed};
	short i, choice;
	
	switch(item_hit) {
		case eMenu::NONE: break;
		case eMenu::FILE_OPEN:
			do_load();
			break;
		case eMenu::FILE_SAVE:
			do_save(0);
			break;
		case eMenu::FILE_SAVE_AS:
			do_save(1);
			break;
		case eMenu::FILE_NEW:
			if(overall_mode != MODE_STARTUP) {
				std::string choice = cChoiceDlog("restart-game",{"okay","cancel"}).show();
				if(choice == "cancel")
					return;
				for(i = 0; i < 6; i++)
					univ.party[i].main_status = eMainStatus::ABSENT;
				party_in_memory = false;
				reload_startup();
				overall_mode = MODE_STARTUP;
				draw_startup(0);
			}
			start_new_game();
			draw_startup(0);
			menu_activate();
			break;
		case eMenu::FILE_ABORT:
			if(overall_mode != MODE_STARTUP) {
				std::string choice = cChoiceDlog("abort-game",{"okay","cancel"}).show();
				if (choice=="cancel") return;
				reload_startup();
				overall_mode = MODE_STARTUP;
			}
			party_in_memory = false;
			draw_startup(0);
			menu_activate();
			break;
		case eMenu::PREFS:
			pick_preferences();
			break;
		case eMenu::QUIT:
			if(overall_mode == MODE_STARTUP) {
				if(party_in_memory) {
					std::string choice = cChoiceDlog("quit-confirm-save", {"save","quit","cancel"}).show();
					if(choice == "cancel") break;
					if(choice == "save") {
						fs::path file = nav_put_party();
						if(!file.empty()) break;
						save_party(file, univ);
					}
				}
				All_Done = true;
				break;
			}
			if(overall_mode > MODE_TOWN) {
				std::string choice = cChoiceDlog("quit-confirm-nosave",{"quit","cancel"}).show();
				if(choice == "cancel")
					return;
			}
			else {
				std::string choice = cChoiceDlog("quit-confirm-save",{"quit","save","cancel"}).show();
				if(choice == "cancel")
					break;
				if(choice == "save") {
					if(univ.file.empty()) {
						univ.file = nav_put_party();
						if(univ.file.empty()) break;
					}
					save_party(univ.file, univ);
				}
			}
			All_Done = true;
			break;
		case eMenu::OPTIONS_PC_GRAPHIC:
			choice = char_select_pc(1,"New graphic for who?");
			if(choice < 6)
				pick_pc_graphic(choice,1,nullptr);
			draw_terrain();
			break;
			
		case eMenu::OPTIONS_DELETE_PC:
			if(!prime_time()) {
				ASB("Finish what you're doing first.");
				print_buf();
			}
			else {
				choice = char_select_pc(1,"Delete who?");
				if(choice < 6) {
					std::string confirm = cChoiceDlog("delete-pc-confirm",{"yes","no"}).show();
					if(confirm == "yes")
						kill_pc(univ.party[choice],eMainStatus::ABSENT);
				}
				draw_terrain();
			}
			break;
			
			
		case eMenu::OPTIONS_RENAME_PC:
			choice = char_select_pc(1,"Rename who?");
			if(choice < 6)
				pick_pc_name(choice,nullptr);
			put_pc_screen();
			put_item_screen(stat_window);
			break;
			
			
		case eMenu::OPTIONS_NEW_PC:
			if(!(is_town())) {
				add_string_to_buf("Add PC: Town mode only.");
				print_buf();
				break;
			}
			for(i = 0; i < 6; i++)
				if(univ.party[i].main_status == eMainStatus::ABSENT)
					i = 20;
			if(i == 6) {
				ASB("Add PC: You already have 6 PCs.");
				print_buf();
				break;
			}
			if(univ.town->has_tavern) {
				give_help(56,0);
				create_pc(6,nullptr);
			} else {
				add_string_to_buf("Add PC: You cannot add new characters in this town. Try in the town you started in.", 2);
			}
			print_buf();
			put_pc_screen();
			put_item_screen(stat_window);
			break;
			
		case eMenu::OPTIONS_JOURNAL:
			journal();
			break;
		case eMenu::OPTIONS_TALK_NOTES:
			if(overall_mode == MODE_TALKING) {
				ASB("Talking notes: Can't read while talking.");
				print_buf();
				return;
			}
			talk_notes();
			break;
		case eMenu::OPTIONS_ENCOUNTER_NOTES:
			adventure_notes();
			break;
		case eMenu::OPTIONS_STATS:
			if(overall_mode != MODE_STARTUP)
				print_party_stats();
			break;
		case eMenu::HELP_OUT:
			dialogToShow = "help-outdoor";
			break;
		case eMenu::HELP_TOWN:
			dialogToShow = "help-town";
			break;
		case eMenu::HELP_COMBAT:
			dialogToShow = "help-combat";
			break;
		case eMenu::HELP_BARRIER:
			dialogToShow = "help-fields";
			break;
		case eMenu::HELP_HINTS:
			dialogToShow = "help-hints";
			break;
		case eMenu::HELP_SPELLS:
			dialogToShow = "help-magic";
			break;
		case eMenu::ABOUT:
			dialogToShow = "about-boe";
			break;
		case eMenu::LIBRARY_MAGE:
			display_spells(eSkill::MAGE_SPELLS,100,0);
			break;
		case eMenu::LIBRARY_PRIEST:
			display_spells(eSkill::PRIEST_SPELLS,100,0);
			break;
		case eMenu::LIBRARY_SKILLS:
			display_skills(eSkill::INVALID,0);
			break;
		case eMenu::LIBRARY_ALCHEMY:
			// TODO: Create a dedicated dialog for alchemy info
			display_alchemy();
			break;
		case eMenu::LIBRARY_TIPS:
			tip_of_day();
			break;
		case eMenu::LIBRARY_INTRO:
			dialogToShow = "welcome";
			break;
		case eMenu::ACTIONS_ALCHEMY:
			dummyEvent.key.code = sf::Keyboard::A;
			dummyEvent.key.shift = true;
			handle_keystroke(dummyEvent);
			break;
		case eMenu::ACTIONS_WAIT:
			dummyEvent.key.code = sf::Keyboard::W;
			handle_keystroke(dummyEvent);
			break;
		case eMenu::ACTIONS_AUTOMAP:
			if(!prime_time()) {
				ASB("Finish what you're doing first.");
				print_buf();
			}
			else {
				give_help(62,0);
				display_map();
			}
			make_cursor_sword();
			break;
		case eMenu::HELP_TOC:
			if(fs::is_directory(progDir/"doc"))
				launchURL("file://" + (progDir/"doc/game/Contents.html").string());
			else launchURL("https://blades.calref.net/doc/game/Contents.html");
			break;
		case eMenu::ABOUT_MAGE:
		case eMenu::ABOUT_PRIEST:
			give_help(209,0);
			break;
		case eMenu::ABOUT_MONSTERS:
			give_help(212,0);
			break;
	}
	if(!dialogToShow.empty()) {
		cChoiceDlog dlog(dialogToShow);
		dlog.show();
	}
}
Example #6
0
Boolean handle_menu (short item, HMENU)
{
    short choice,i;
    POINT x = {1001,0},pass_point;
    Boolean to_return = false;

    switch (item) {
    case 1:  // File Menu
        if (in_startup_mode == true) startup_load();
        else do_load();
        break;
    case 2:
        do_save(0);
        break;
    case 3:
        if (in_startup_mode == true) save_file(1);
        else do_save(1);
        break;
    case 4:
        if (in_startup_mode == false)
        {
            choice = FCD(1091,0);
            if (choice == 1) return false;
            for (i = 0; i < 6; i++)
                adven[i].main_status = MAIN_STATUS_ABSENT;
            party_in_memory = false;
            reload_startup();
            in_startup_mode = true;
            draw_startup(0);
        }
        start_new_game();
        draw_startup(0);
        break;
    case 6:
        pick_preferences();
        break;
    case 7:
        pick_compatibility();
        break;
    case 8:  // Quit
        if (in_startup_mode == true) {
            to_return = All_Done = true;
            break;
        }
        if (overall_mode > MODE_TOWN) {
            choice = FCD(1067,0);
            if (choice == 1) return All_Done;
        }
        else {
            choice = FCD(1066,0);
            if (choice == 3)
                break;
            if (choice == 1)
                save_file(0);
        }
        to_return = All_Done = true;
        break;

    // Options menu
    case 21:
        choice = char_select_pc(0,0,"New graphic for who?");
        if (choice < 6)
            pick_pc_graphic(choice,1,0);
        initiate_redraw();
        break;

    case 22:
        choice = select_pc(0,0);
        if (choice < 6)
            pick_pc_name(choice,0);
        put_pc_screen();
        put_item_screen(stat_window,0);
        break;


    case 23:
        if (!(is_town())) {
            add_string_to_buf("Add PC: Town mode only.");
            print_buf();
            break;
        }
        for (i = 0; i < NUM_OF_PCS; i++)
            if (adven[i].main_status == MAIN_STATUS_ABSENT)
                i = 20;
        if (i == INVALID_PC) {
            ASB("Add PC: You already have 6 PCs.");
            print_buf();
        }
        if (c_town.town_num == scenario.which_town_start) {
            give_help(56,0,0);
            create_pc(6,0);
        }
        else {
            add_string_to_buf("Add PC: You can only make new");
            add_string_to_buf("  characters in the town you ");
            add_string_to_buf("  started in.");
        }
        print_buf();
        put_pc_screen();
        put_item_screen(stat_window,0);
        break;

    case 24:
        if (prime_time() == false) {
            ASB("Finish what you're doing first.");
            print_buf();
        }
        else {
            choice = char_select_pc(0,0,"Delete who?");
            if (choice < 6) {
                if ((i = FCD(1053,0)) == 2)
                    adven[choice].kill(0);
            }
            initiate_redraw();
        }
        break;

    case 27:
        if (overall_mode == MODE_TALKING) {
            ASB("Talking notes: Can't read while talking.");
            print_buf();
            return to_return;
        }
        talk_notes();
        break;
    case 28:
        adventure_notes();
        break;
    case 29:
        if (in_startup_mode == false) print_party_stats();
        break;

    // Help menu
    case 41:
        FCD(1079,0);
        break;
    case 42:
        FCD(1080,0);
        break;
    case 43:
        FCD(1081,0);
        break;
    case 44:
        FCD(1072,0);
        break; // magic barriers
    case 46:
        FCD(1084,0);
        break;
    case 47:
        FCD(1088,0);
        break;

    // Library
    case 61:
        display_spells(0,100,0);
        break;
    case 62:
        display_spells(1,100,0);
        break;
    case 63:
        display_skills(100,0);
        break;
    case 64:
        display_help(0,0);
        break;
    case 65:
        tip_of_day();
        break;
    case 67:
        FCD(986,0);
        break;

    // Actions
    case 81:
        if (overall_mode != MODE_TOWN) {
            ASB("Alchemy: In town mode only.");
            print_buf();
            break;
        }
        pass_point.x = 1000;
        pass_point.y = 405;
        to_return = handle_action(pass_point,(WPARAM) 0,(LPARAM)-1);
        break;
    case 82:
        to_return = handle_action(x,(WPARAM) 0,(LPARAM)-1);
        break;
    case 84:
        if (prime_time() == false) {
            ASB("Finish what you're doing first.");
            print_buf();
        }
        else {
            give_help(62,0,0);
            display_map();
        }
        SetCursor(sword_curs);
        break;

    // Mage is 399
    case 399:
        give_help(209,0,0);
        party.help_received[9] = false;
        break;

    // Priest is 499
    case 499:
        give_help(209,0,0);
        party.help_received[9] = false;
        break;

    // Monsters is 599
    case 599:
        give_help(212,0,0);
        break;

    case 100: // Index
        WinHelp(mainPtr,"Blades of Exile.hlp",HELP_CONTENTS,0L);
        break;

    case 200: // About
        FCD(1062,0);
        break;

    default:
        if ((item >= 400) && (item < 500))  { // mage spell
            if (prime_time() == false) {
                ASB("Finish what you're doing first.");
                print_buf();
            }
            else handle_menu_spell(item - 400,0);
            break;
        }
        if ((item >= 500) && (item < 600))  { // priest spell
            if (prime_time() == false) {
                ASB("Finish what you're doing first.");
                print_buf();
            }
            else handle_menu_spell(item - 500,1);
            break;
        }
        if ((item >= 600) && (item < 700))  { // monster spell
            display_monst(item - 600,(creature_data_type *) NULL,1);
            break;
        }
        break;
    }
    if (in_startup_mode == true)
        menu_activate(0);
    else menu_activate(1);
    return to_return;
}
Example #7
0
Boolean handle_startup_press(POINT the_point)
{
    short i,scen;
    long dummy;

    the_point.x -= ulx;
    the_point.y -= uly;

    for (i = 0; i < 5; i++)
        if (PtInRect(&startup_button[i],the_point) == true)
        {
            draw_start_button(i,5);

            if (play_sounds == true) play_sound(37);
            else Delay(5,&dummy);

            draw_start_button(i,0);

            switch (i) {
            case 0:
                startup_load();
                break;

            case 1:
                draw_startup(0);
                start_new_game();
                draw_startup(0);
                break;

            case 2:
                // Not cross-platform.
                ShellExecute(NULL, "open", "http://spiderwebforums.ipbhost.com/index.php?/forum/12-blades-of-exile/", NULL, NULL, SW_SHOWNORMAL);
                draw_startup(0);
                break;

            case 3:
                if (party_in_memory == false) {   // check if party is loaded
                    FCD(867,0);                   //no party loaded error message
                    break;
                }

                scen = pick_prefab_scen();             // return a short in scen specifying the chosen scenario
                if (scen < 0)
                    break;

                switch (scen) {                                                  //put scenario filename in party.scen_name
                case 0:
                    sprintf(party.scen_name,"valleydy.exs");
                    break;
                case 1:
                    sprintf(party.scen_name,"stealth.exs");
                    break;
                case 2:
                    sprintf(party.scen_name,"zakhazi.exs");
                    break;
                }

                put_party_in_scen();                                              //put the party in the scenario and begin the game
                break;

            case 4: // intro
                if (party_in_memory == false) {               // check if party is loaded
                    FCD(867,0);                               //no party loaded error message
                    break;
                }
                scen = pick_a_scen();                              // return a short to scen specifying the chosen scenario

                /*   				if (scen_headers[scen].prog_make_ver[0] >= 2) { => warning if scen = -1 (no scenarios in directory), then it will crash !!!
                						FCD(912,0);
                						break;
                						}*/

                if (scen >= 0) {
                    sprintf(party.scen_name,"%s",data_store2[scen].scen_names); //put scenario filename in party.scen_name retrieving it using scen
                    put_party_in_scen();                                        //put the party in the scenario and begin the game
                }

                break;

            default:
                Delay(50,&dummy);
                return true;
            }
        }
    return false;
}
Example #8
0
LRESULT CALLBACK WndProc (HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam)
{
    PAINTSTRUCT ps;
    POINT press;
    HMENU menu;
    RECT dlg_rect;
    RECT wind_rect;

    short handled = 0;
    short store_ulx;
    short store_uly;
    short sbar_pos;
    short which_sbar;
    short old_setting;
    short smin;
    short smax;

// First, handle window size
    GetWindowRect(mainPtr,&wind_rect);

    switch (display_mode) { //case 0 is center
    case 1:
        store_ulx = 0;
        store_uly = 0;
        break;
    case 2:
        store_ulx = wind_rect.right - 550 - 21;
        store_uly = 0;
        break;
    case 3:
        store_ulx = 0;
        store_uly = wind_rect.bottom - 422 - 24 - 21;
        break;
    case 4:
        store_ulx = wind_rect.right - 550 - 21;
        store_uly = wind_rect.bottom - 422 - 24 - 21;
        break;
    case 5:
        store_ulx = 0;
        store_uly = 0;
        break;
    default:
        store_ulx = ((wind_rect.right - wind_rect.left) - 536) / 2 - 30;
        store_uly = ((wind_rect.bottom - wind_rect.top) - 478) / 2 + 8;
        break;
    }

    store_ulx -= store_ulx % 8;
    store_uly -= store_uly % 8;

    if ((store_ulx != ulx) || (store_uly != uly))
    {
        ulx = store_ulx;
        uly = store_uly;
        adjust_window_mode();
    }

    switch (message) {
    case WM_KEYDOWN:
        if (hwnd != mainPtr)
            check_cd_event(hwnd,message,wParam,lParam);
        else {
            cursor_go();
            All_Done = handle_syskeystroke(wParam,lParam,&handled);
            check_game_done();
        }
        if (handled == 1)
            FlushEvents(0);

        return 0;

    case WM_CHAR:
        if (hwnd != mainPtr)
            check_cd_event(hwnd,message,wParam,lParam);
        else {
            cursor_go();
            All_Done = handle_keystroke(wParam,lParam);
            check_game_done();
        }
        return 0;

    case WM_LBUTTONDOWN:
        cursor_stay();
        if (hwnd != mainPtr) check_cd_event(hwnd,message,wParam,lParam);
        else {
            SetFocus(hwnd);
            press = MAKEPOINT(lParam);
            if (in_startup_mode == false)
                All_Done = handle_action(press, wParam,lParam);
            else 	All_Done = handle_startup_press(press);
            change_cursor(press);
            check_game_done();
        }
        return 0;
        break;

    case WM_RBUTTONDOWN:
        cursor_stay();
        if (hwnd != mainPtr)
            check_cd_event(hwnd,message,wParam,lParam);
        else {
            SetFocus(hwnd);
            press = MAKEPOINT(lParam);
            if (in_startup_mode == false)
                All_Done = handle_action(press, wParam,-2);
            else All_Done = handle_startup_press(press);
            change_cursor(press);
            check_game_done();
        }
        return 0;
        break;

    case WM_ACTIVATE:
        if (hwnd == mainPtr)
        {
            WORD fActive = LOWORD(wParam);

            if ((fActive == WA_ACTIVE) ||(fActive == WA_CLICKACTIVE))
            {
                window_in_front = true;
                GetClientRect(hwnd,&dlg_rect);
                InvalidateRect(hwnd,&dlg_rect,false);
            }

            if (fActive == WA_INACTIVE)
            {
                cursor_stay();
                anim_onscreen = false;
                window_in_front = false;
            }
        }
        return 0;

    case WM_ERASEBKGND:
        if (hwnd != mainPtr) break;
        block_erase = false;
        return 1;

    case WM_MOUSEMOVE:
        if (store_mouse != lParam) cursor_stay();
        store_mouse = lParam;
        press = MAKEPOINT(lParam);
        if (hwnd == mainPtr) {
            change_cursor(press);
            if ((overall_mode > MODE_COMBAT) && (overall_mode < MODE_TALKING))
                draw_targeting_line(press);
        }
        return 0;

    case WM_PAINT:
        if ((block_erase == true) && (hwnd == mainPtr)) {
            block_erase = false;
        }
        BeginPaint(hwnd,&ps);
        EndPaint(hwnd,&ps);

        if (hwnd != mainPtr)
            check_cd_event(hwnd,message,wParam,lParam);
        else {
            string_added = true;
            reset_text_bar();
            if (in_startup_mode == true) draw_startup(0);
            else if (first_update == true)
            {
                first_update = false;
                if (overall_mode == MODE_OUTDOORS) redraw_screen(0);
                if ((overall_mode > MODE_OUTDOORS) & (overall_mode < MODE_COMBAT)) redraw_screen(1);
                // 1st update never combat
            }
            else refresh_screen(overall_mode);
        }
        return 0;

    case WM_TIMER:
        switch(wParam) {
        case 1:
            if ((in_startup_mode == false) && (anim_onscreen == true)
                    && (window_in_front == true) && (give_delays == false)) {
                if(PSD[SDF_NO_TER_ANIM] != 1)
                    anim_ticks++;
                initiate_redraw();
            }
            break;
        case 2:
            if ((overall_mode > MODE_COMBAT) && (overall_mode < MODE_TALKING)) {
                GetCursorPos(&press);
                press.x -= wind_rect.left + 3;
                press.y -= wind_rect.top + 41;
                draw_targeting_line(press);
            }
            if ((in_startup_mode == true) && (window_in_front == true))
                draw_startup_anim();
            break;
        }
        return 0;

    case WM_COMMAND:    // 1006 is dummy event
        // creation events 2000 spend xp 2001 pick graphic 2002 finish up
        if (hwnd == mainPtr) {
            menu = GetMenu(mainPtr);
            All_Done = handle_menu((short) LOWORD(wParam), menu);
            check_game_done();
        }
        else check_cd_event(hwnd,message,wParam,lParam);

        return 0;

    case WM_VSCROLL:
        which_sbar = GetWindowLong((HWND) lParam, GWL_ID);
        switch (which_sbar) {// 1 text  2 items  3 shop
        case 1:
            sbar_pos = GetScrollPos(text_sbar,SB_CTL);
            switch (wParam ) {
            case SB_PAGEDOWN:
                sbar_pos += 11;
                break;
            case SB_LINEDOWN:
                sbar_pos++;
                break;
            case SB_PAGEUP:
                sbar_pos -= 11;
                break;
            case SB_LINEUP:
                sbar_pos--;
                break;
            case SB_TOP:
                sbar_pos = 0;
                break;
            case SB_BOTTOM:
                sbar_pos = 57;
                break;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
                sbar_pos = LOWORD(lParam);
                break;
            }
            if (sbar_pos < 0) sbar_pos = 0;
            if (sbar_pos > 58) sbar_pos = 58;
            {
//				SetScrollPos(text_sbar,SB_CTL,sbar_pos,true);
                lpsi.nPos = sbar_pos;
                lpsi.fMask = SIF_POS;
                SetScrollInfo(text_sbar,SB_CTL,&lpsi,true);
            }
            string_added = true;
            print_buf();
            break;
        case 2:
            old_setting = sbar_pos = GetScrollPos(item_sbar,SB_CTL);
            GetScrollRange(item_sbar,SB_CTL,(int *) &smin,(int *) &smax);
            switch (wParam ) {
            case SB_PAGEDOWN:
                sbar_pos += (stat_window == 7) ? 2 : 8;
                break;
            case SB_LINEDOWN:
                sbar_pos++;
                break;
            case SB_PAGEUP:
                sbar_pos -= (stat_window == 7) ? 2 : 8;
                break;
            case SB_LINEUP:
                sbar_pos--;
                break;
            case SB_TOP:
                sbar_pos = 0;
                break;
            case SB_BOTTOM:
                sbar_pos = smax;
                break;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
                sbar_pos = LOWORD(lParam);
                break;
            }
            if (sbar_pos < 0) sbar_pos = 0;
            if (sbar_pos > smax) sbar_pos = smax;
            {
//				SetScrollPos(item_sbar,SB_CTL,sbar_pos,true);
                lpsi.nPos = sbar_pos;
                lpsi.fMask = SIF_POS;
                SetScrollInfo(item_sbar,SB_CTL,&lpsi,true);
            }
            if (sbar_pos != old_setting)
                put_item_screen(stat_window,1);
            break;
        case 3:
            old_setting = sbar_pos = GetScrollPos(shop_sbar,SB_CTL);
            GetScrollRange(shop_sbar,SB_CTL,(int *) &smin,(int *) &smax);
            switch (wParam ) {
            case SB_PAGEDOWN:
                sbar_pos += 8;
                break;
            case SB_LINEDOWN:
                sbar_pos++;
                break;
            case SB_PAGEUP:
                sbar_pos -= 8;
                break;
            case SB_LINEUP:
                sbar_pos--;
                break;
            case SB_TOP:
                sbar_pos = 0;
                break;
            case SB_BOTTOM:
                sbar_pos = smax;
                break;
            case SB_THUMBPOSITION:
            case SB_THUMBTRACK:
                sbar_pos = LOWORD(lParam);
                break;
            }
            if (sbar_pos < 0) sbar_pos = 0;
            if (sbar_pos > smax) sbar_pos = smax;
            {
//				SetScrollPos(shop_sbar,SB_CTL,sbar_pos,true);
                lpsi.nPos = sbar_pos;
                lpsi.fMask = SIF_POS;
                SetScrollInfo(shop_sbar,SB_CTL,&lpsi,true);
            }
            if (sbar_pos != old_setting)
                draw_shop_graphics(0,shop_sbar_rect);
            break;
        }

        SetFocus(mainPtr);
        return 0;

    case WM_DESTROY:
    case WM_CLOSE:
        if (hwnd == mainPtr)
        {
            lose_graphics();
            PostQuitMessage(0);
        }
        return 0;
    case WM_QUIT:
        if (hwnd == mainPtr)
            lose_graphics();
        break;
    }

    return DefWindowProc(hwnd,message,wParam,lParam);
}
Example #9
0
void gui_update(enum gui_update_view view, enum gui_update_elt *element,
                struct display_file_list *lst_str, struct file_info *info,
                struct player_info *player)
{
  static enum gui_update_view last_view = GUI_UPDATE_VIEW_NONE;
  static bool clear_in_progress_done=false;

  if (!(*element & GUI_UPDATE_ELT_IN_PROGRESS))
  {
    if (!clear_in_progress_done)
    {
      clear_in_progress_done=true;
      clear_in_progress(view);
    }
  }
  else
  {
    draw_in_progress(view);
    clear_in_progress_done=false;
    *element &= ~GUI_UPDATE_ELT_IN_PROGRESS;
  }

  switch (view)
  {
  case GUI_UPDATE_VIEW_NONE:
    break;
  case GUI_UPDATE_VIEW_IDLE:
    if (last_view != GUI_UPDATE_VIEW_IDLE)
    {
      draw_startup(0, 0);
      last_view = GUI_UPDATE_VIEW_IDLE;
      break;
    }
    call_draw_fct(*element, GUI_UPDATE_ELT_IDLE_NO_DEVICE_PRESENT, draw_device_not_present, );
    call_draw_fct(*element, GUI_UPDATE_ELT_IDLE_DEVICE_PRESENT, draw_device_present, );
    call_draw_fct(*element, GUI_UPDATE_ELT_IDLE_NOT_SUPPORTED, draw_device_not_supported, );
    break;
  case GUI_UPDATE_VIEW_NAVIGATION:
    if (last_view != GUI_UPDATE_VIEW_NAVIGATION)
    {
      switch(last_view)
      {
      case GUI_UPDATE_VIEW_IDLE_TRANSITION:
      case GUI_UPDATE_VIEW_IDLE:
        last_view = GUI_UPDATE_VIEW_IDLE_TRANSITION;
        if (!draw_transition(draw_startup, draw_navigation, TRANSITION_FROM_LEFT_TO_RIGHT))
          return;
        break;
      case GUI_UPDATE_VIEW_PLAYBACK_TRANSITION:
      case GUI_UPDATE_VIEW_PLAYBACK:
        last_view = GUI_UPDATE_VIEW_PLAYBACK_TRANSITION;
        if (!draw_transition(draw_play_view, draw_navigation, TRANSITION_FROM_RIGHT_TO_LEFT))
          return;
        break;
      default:
        break;
      }
      draw_navigation(0, 0);
      last_view = GUI_UPDATE_VIEW_NAVIGATION;
      break;
    }
    call_draw_fct(*element, GUI_UPDATE_ELT_NAVIGATION_CURSOR, draw_cursor, lst_str);
    call_draw_fct(*element, GUI_UPDATE_ELT_NAVIGATION_FILE_LIST, draw_file_list, lst_str);
    call_draw_fct(*element, GUI_UPDATE_ELT_NAVIGATION_NO_FILES, draw_no_file, lst_str);
    break;
  case GUI_UPDATE_VIEW_PLAYBACK:
    if (last_view != GUI_UPDATE_VIEW_PLAYBACK)
    {
      switch(last_view)
      {
      case GUI_UPDATE_VIEW_NAVIGATION_TRANSITION:
      case GUI_UPDATE_VIEW_NAVIGATION:
        last_view = GUI_UPDATE_VIEW_NAVIGATION_TRANSITION;
        if (!draw_transition(draw_navigation, draw_play_view, TRANSITION_FROM_LEFT_TO_RIGHT))
          return;
        break;
      case GUI_UPDATE_VIEW_CONFIG_TRANSITION:
      case GUI_UPDATE_VIEW_CONFIG:
        last_view = GUI_UPDATE_VIEW_CONFIG_TRANSITION;
        if (!draw_transition(draw_config, draw_play_view, TRANSITION_FROM_RIGHT_TO_LEFT))
          return;
        break;
      default:
        break;
      }
      draw_play_view(0, 0);
      last_view = GUI_UPDATE_VIEW_PLAYBACK;
      break;
    }
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_PLAY, draw_play_button, );
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_PAUSE, draw_pause_button, );
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_ELAPSED_TIME, draw_playtime_update, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_VOLUME, draw_volume_bar, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_FILE_NAME, draw_play_view_print_file, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_ARTIST, draw_play_view_print_artist, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_TITLE, draw_play_view_print_title, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_TOTAL_TIME, draw_play_view_print_total_time, info);
    call_draw_fct(*element, GUI_UPDATE_ELT_PLAYBACK_COVER_ART, draw_cover_art, info);
    break;
  case GUI_UPDATE_VIEW_CONFIG:
    if (last_view != GUI_UPDATE_VIEW_CONFIG)
    {
      switch(last_view)
      {
      case GUI_UPDATE_VIEW_PLAYBACK_TRANSITION:
      case GUI_UPDATE_VIEW_PLAYBACK:
        last_view = GUI_UPDATE_VIEW_PLAYBACK_TRANSITION;
        if (!draw_transition(draw_play_view, draw_config, TRANSITION_FROM_LEFT_TO_RIGHT))
          return;
        break;
      default:
        break;
      }
      draw_config(0, 0);
      last_view = GUI_UPDATE_VIEW_CONFIG;
      break;
    }
    call_draw_fct(*element, GUI_UPDATE_ELT_CONFIG_REPEAT, draw_config_view_print_repeat, player);
    call_draw_fct(*element, GUI_UPDATE_ELT_CONFIG_SHUFFLE, draw_config_view_print_shuffle, player);
    call_draw_fct(*element, GUI_UPDATE_ELT_CONFIG_CURSOR, draw_config_view_print_cursor, lst_str);
    break;
  default:
    break;
  }
}