• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ graphicsLib类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中graphicsLib的典型用法代码示例。如果您正苦于以下问题:C++ graphicsLib类的具体用法?C++ graphicsLib怎么用?C++ graphicsLib使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了graphicsLib类的16个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: show_animation

void sceneShow::show_animation(int n, int repeat_n, int repeat_mode)
{
    int frame_n = 0;
    CURRENT_FILE_FORMAT::file_scene_show_animation scene = animation_list.at(n);
    long frame_timer = timer.getTimer() + scene.frame_delay;
    long started_timer = timer.getTimer();
    int repeat_times = 0;

    graphicsLib_gSurface image;
    graphLib.surfaceFromFile(FILEPATH + "images/scenes/animations/" + scene.filename, &image);
    int max_frames = image.width / scene.frame_w;

    graphicsLib_gSurface bg_image;
    graphLib.initSurface(st_size(scene.frame_w, scene.frame_h), &bg_image);
    graphLib.copy_gamescreen_area(st_rectangle(scene.x, scene.y, scene.frame_w, scene.frame_h), st_position(0, 0), &bg_image);


    std::cout << "max_frames[" << max_frames << "], image.w[" << image.width << "], scene.frame_w[" << scene.frame_w << "]" << std::endl;

    while (true) {
        input.read_input();
        int x = frame_n*scene.frame_w;


        // stop condition
        if (repeat_times > 0 && repeat_n <= 1) {
            std::cout << "sceneShow::show_animation::LEAVE#1" << std::endl;
            break;
        } else {
            if (repeat_mode == 0) { // time-mode
                if ((timer.getTimer() - started_timer) > repeat_n) {
                    std::cout << "sceneShow::show_animation::LEAVE#2" << std::endl;
                    break;
                }
            } else { // repeat number mode
                if (repeat_times > repeat_n) {
                    std::cout << "sceneShow::show_animation::LEAVE#3" << std::endl;
                    break;
                }
            }
        }
        graphLib.showSurfaceAt(&bg_image, st_position(scene.x, scene.y), false);
        std::cout << "x[" << x << "], img.w[" << image.width << "], frame.w[" << scene.frame_w << "]" << std::endl;
        graphLib.showSurfaceRegionAt(&image, st_rectangle(x, 0, scene.frame_w, scene.frame_h), st_position(scene.x, scene.y));
        graphLib.updateScreen();
        timer.delay(scene.frame_delay);


        if (frame_timer < timer.getTimer()) {
            frame_n++;
            if (frame_n >= max_frames) {
                frame_n = 0;
                repeat_times++;
            }
            frame_timer = timer.getTimer() + scene.frame_delay;
        }

    }
    // avoid leaving animation image trail if it is a repeating one
    if (repeat_n > 1) {
        graphLib.showSurfaceAt(&bg_image, st_position(scene.x, scene.y), false);
        graphLib.updateScreen();
        timer.delay(scene.frame_delay);
    }
}
开发者ID:protoman,项目名称:rockbot,代码行数:65,代码来源:sceneshow.cpp


示例2: UNUSED

void draw::show_boss_intro_sprites(short boss_id, bool show_fall)
{
    UNUSED(show_fall);
    unsigned int intro_frames_n = 0;
    //int intro_frames_rollback = 0;
    st_position boss_pos(20, -37);
    st_position sprite_size;
    graphicsLib_gSurface bgCopy, boss_graphics;


    std::string graph_filename = FILEPATH + "data/images/sprites/enemies/" + std::string(game_data.game_npcs[boss_id].graphic_filename);
    sprite_size.x = game_data.game_npcs[boss_id].frame_size.width;
    sprite_size.y = game_data.game_npcs[boss_id].frame_size.height;
    graphLib.surfaceFromFile(graph_filename.c_str(), &boss_graphics);

    graphLib.initSurface(st_size(RES_W, RES_H), &bgCopy);
    graph_filename = FILEPATH + "data/images/backgrounds/stage_boss_intro.png";
    graphLib.surfaceFromFile(graph_filename.c_str(), &bgCopy);
    st_position bg_pos(0, (RES_H/2)-(bgCopy.height/2));
    graphLib.copyArea(bg_pos, &bgCopy, &graphLib.gameScreen);

    update_screen();

    int sprite_pos_y = RES_H/2 - sprite_size.y/2;

    for (int i=0; i<ANIM_FRAMES_COUNT; i++) {
        if (game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].used == true) {
            intro_frames_n++;
        }
    }

    // fall into position
    while (boss_pos.y < sprite_pos_y) {
        boss_pos.y += 4;
        graphLib.copyArea(bg_pos, &bgCopy, &graphLib.gameScreen);
        graphLib.copyArea(st_rectangle(0, 0, sprite_size.x, sprite_size.y), st_position(boss_pos.x, boss_pos.y), &boss_graphics, &graphLib.gameScreen);
        graphLib.wait_and_update_screen(5);
    }
    graphLib.wait_and_update_screen(500);


    // show intro sprites
    if (intro_frames_n > 1) {
        for (int i=0; i<ANIM_FRAMES_COUNT; i++) {
            if (game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].used == true) {
                //std::cout << "i: " << i << ", used: " << game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].used << ", duration: " << game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].duration << std::endl;
                graphLib.copyArea(bg_pos, &bgCopy, &graphLib.gameScreen);
                graphLib.copyArea(st_rectangle(sprite_size.x * game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].sprite_graphic_pos_x, 0, sprite_size.x, sprite_size.y), st_position(boss_pos.x, boss_pos.y), &boss_graphics, &graphLib.gameScreen);
                graphLib.wait_and_update_screen(game_data.game_npcs[boss_id].sprites[ANIM_TYPE_INTRO][i].duration);
            }
        }
    } else { // just frow first sprite
        graphLib.copyArea(bg_pos, &bgCopy, &graphLib.gameScreen);
        graphLib.copyArea(st_rectangle(0, 0, sprite_size.x, sprite_size.y), st_position(boss_pos.x, boss_pos.y), &boss_graphics, &graphLib.gameScreen);
        graphLib.wait_and_update_screen(200);
    }
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:57,代码来源:draw.cpp


示例3: create_credits_text

void draw::create_credits_text(graphicsLib_gSurface &surface)
{
    if (credits_list.size() > 0) {
        return;
    }
    credits_list.push_back("--- COPYRIGHT NOTICE ---");
    credits_list.push_back("MEGAMAN AND ROCKMAN ARE TRADEMARKS");
    credits_list.push_back("OF CAPCOM INC. SOME OF THE GRAPHICS");
    credits_list.push_back("AND SOUND EFFECTS USED IN THIS GAME");
    credits_list.push_back("ARE PROPERTY OF CAPCOM INC.");
    credits_list.push_back("");
    credits_list.push_back("THIS FANGAME IS A TRIBUTE TO MEGAMAN,");
    credits_list.push_back("FREE AND OPEN-SOURCE");
    credits_list.push_back("");
    credits_list.push_back("WE THANK CAPCOM FOR CREATING MEGAMAN");
    credits_list.push_back("AND ITS CLASSIC GAMES, ALSO FOR");
    credits_list.push_back("BEING FRIENDLY TOWARDS FANGAMES.");
    credits_list.push_back("");
    credits_list.push_back("");
    credits_list.push_back("");
    credits_list.push_back("");
    credits_list.push_back("");


    credits_list.push_back("--- PLANNER ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("");


    credits_list.push_back("--- CHARACTER DESIGN ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("ARIS KSF");
    credits_list.push_back("");

    credits_list.push_back("--- PIXEL GRAPHICS ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("GIO AKIRA FAGANELLO");
    credits_list.push_back("RODRIGO M. HAHN");
    credits_list.push_back("HUNTER TRAMMELL");
    credits_list.push_back("BOBERATU");
    credits_list.push_back("PROF. CHRIS");
    credits_list.push_back("");


    credits_list.push_back("--- DERIVATED GRAPHICS ---");
    credits_list.push_back("CAPCOM");
    credits_list.push_back("");


    credits_list.push_back("--- ILLUSTRATION ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("ARIS KSF");
    credits_list.push_back("");

    credits_list.push_back("--- MUSIC COMPOSE ---");
    credits_list.push_back("MODARCHIVE.ORG");
    credits_list.push_back("");

    credits_list.push_back("--- SOUND EFFECTS ---");
    credits_list.push_back("CAPCOM");
    credits_list.push_back("");


    credits_list.push_back("--- PROGRAMMER ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("DEMETRIO NETO");
    credits_list.push_back("");

    credits_list.push_back("--- PORTING ---");
    credits_list.push_back("DINGUX: SHIN-NIL");
    credits_list.push_back("PANDORA: SIGMA NL");
    credits_list.push_back("PS2: RAGNAROK2040");
    credits_list.push_back("PS2: WOON-YUNG LIU");
    credits_list.push_back("PS2: SP193");
    credits_list.push_back("ANDROID: PELYA");
    credits_list.push_back("");

    credits_list.push_back("--- TESTING ---");
    credits_list.push_back("IURI FIEDORUK");
    credits_list.push_back("ARIS KSF");
    credits_list.push_back("LUIS AGUIRRE");
    credits_list.push_back("BENOITREN (PSP)");
    credits_list.push_back("BATANEN (PSP)");
    credits_list.push_back("SAIYAN X (PSP)");
    credits_list.push_back("AGENT 13 (PS2)");
    credits_list.push_back("MK2ESCORT (PS2)");
    credits_list.push_back("FOUADTJUHMASTER (ANDROID)");
    credits_list.push_back("");

    credits_list.push_back("--- SPECIAL THANKS ---");
    credits_list.push_back("FREE SDK DEVELOPERS");
    credits_list.push_back("LIBSDL PORTERS");
    credits_list.push_back("DEVIANTART COMMUNITY");
    credits_list.push_back("PIXELJOIN COMMUNITY");
    credits_list.push_back("VENOM");
    credits_list.push_back("JERONIMO");
    credits_list.push_back("");

    credits_list.push_back("--- DEVELOPMENT TOOLS ---");
    credits_list.push_back("LIBSDL");
//.........这里部分代码省略.........
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:101,代码来源:draw.cpp


示例4: execute_ingame_menu

bool class_config::execute_ingame_menu()
{
    st_position old_pos;


    if (input.p1_input[BTN_START] == 1) {
        input.clean();
        input.waitTime(300);
        // leaving menu, removes pause
        if (ingame_menu_active == true) {
            timer.unpause();
        }
        ingame_menu_active = !ingame_menu_active;

        if (ingame_menu_active) {
            timer.pause();
            generate_weapons_matrix();
            draw_ingame_menu();
        } else {
            // change player color/weapon
            if (ingame_menu_pos.y != 6) {
                player_ref->set_weapon(convert_menu_pos_to_weapon_n(ingame_menu_pos));
            } else {
                // use item
                use_tank(ingame_menu_pos.x);
                ingame_menu_active = !ingame_menu_active; // keep itself inside the menu
                generate_weapons_matrix();
                draw_ingame_menu();
            }
        }
    }

    if (ingame_menu_active) {
        old_pos.x = ingame_menu_pos.x;
        old_pos.y = ingame_menu_pos.y;
        if (input.p1_input[BTN_UP] == 1) {
            move_cursor(0, -1);
        } else if (input.p1_input[BTN_DOWN] == 1) {
            move_cursor(0, 1);
        } else if (input.p1_input[BTN_LEFT] == 1) {
            move_cursor(-1, 0);
        } else if (input.p1_input[BTN_RIGHT] == 1) {
            move_cursor(1, 0);
        } else if (input.p1_input[BTN_R] == 1) {
            if (gameControl.show_config(game_save.stages[gameControl.currentStage]) == true) { // player picked "leave stage" option
                ingame_menu_active = false;
                timer.unpause();
                return true;
            }
            draw_ingame_menu();
        }
        if (old_pos.x != ingame_menu_pos.x || old_pos.y != ingame_menu_pos.y) {
            //std::cout << ">> old_pos.y: " << old_pos.y << ", ingame_menu_pos.y: " << ingame_menu_pos.y << std::endl;
            if (old_pos.y != 6) {
                graphLib.draw_weapon_cursor(old_pos, player_ref->get_weapon_value(convert_menu_pos_to_weapon_n(old_pos)), -1);
                graphLib.draw_weapon_icon(convert_menu_pos_to_weapon_n(old_pos), old_pos, false);
            } else {
                graphLib.erase_menu_item(old_pos.x);
            }
            if (ingame_menu_pos.y != 6) {
                graphLib.draw_weapon_cursor(ingame_menu_pos, player_ref->get_weapon_value(convert_menu_pos_to_weapon_n(ingame_menu_pos)), player_ref->get_number());
                graphLib.draw_weapon_icon(convert_menu_pos_to_weapon_n(ingame_menu_pos), ingame_menu_pos, true);
                change_player_frame_color();
            } else {
                graphLib.draw_menu_item(ingame_menu_pos.x);
            }
        }
        input.clean();
        input.waitTime(MENU_CHANGE_DELAY);
    }
    return ingame_menu_active;
}
开发者ID:eduardok,项目名称:rockbot,代码行数:72,代码来源:class_config.cpp


示例5: draw_screen

void key_map::draw_screen()
{
    bool finished = false;
    st_position config_text_pos;
    st_position cursor_pos;
    short _pick_pos = 0;

    config_text_pos.x = graphLib.get_config_menu_pos().x + 74;
    config_text_pos.y = graphLib.get_config_menu_pos().y + 40;
    cursor_pos = config_text_pos;

    graphLib.clear_area(config_text_pos.x-1, config_text_pos.y-1, 180,  180, 0, 0, 0);
    input.clean();
    input.waitTime(300);

    for (unsigned int i=0; i<_keys_list.size(); i++) {
        graphLib.draw_text(config_text_pos.x, config_text_pos.y + i*CURSOR_SPACING, _keys_list[i].c_str());
        redraw_line(i);
    }
    graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING, "RETURN");
    draw_lib.update_screen();

    //cout << "scenesLib::option_picker::START\n";
    graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));

    while (finished == false) {
        input.readInput();
        if (input.p1_input[BTN_START]) {
            if (_pick_pos == (short)_keys_list.size()) {
                std::cout << "key_map::draw_screen - FINISHED #1" << std::endl;
                finished = true;
            } else {
                graphLib.draw_text(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2, "PRESS NEW KEY/BUTTON"); //input code (number)
                draw_lib.update_screen();
                //CURRENT_FILE_FORMAT::st_key_config new_key = input.get_pressed_key();
                graphLib.clear_area(config_text_pos.x, config_text_pos.y + _keys_list.size()*CURSOR_SPACING+CURSOR_SPACING*2-1, 180,  CURSOR_SPACING+1, 0, 0, 0);
                ///@TODO - key_config[_pick_pos].key_type = new_key.key_type;
                ///@TODO - key_config[_pick_pos].key_number = new_key.key_number;
                redraw_line(_pick_pos);
                draw_lib.update_screen();
            }
        }
        if (input.p1_input[BTN_DOWN]) {
                soundManager.play_sfx(SFX_CURSOR);
                graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
                _pick_pos++;
                if (_pick_pos >= (short)_keys_list.size()+1) {
                    _pick_pos = 0;
                }
                graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
        }
        if (input.p1_input[BTN_UP]) {
                soundManager.play_sfx(SFX_CURSOR);
                graphLib.eraseCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
                _pick_pos--;
                if (_pick_pos < 0) {
                    _pick_pos = _keys_list.size();
                }
                graphLib.drawCursor(st_position(cursor_pos.x-CURSOR_SPACING, cursor_pos.y+(_pick_pos*CURSOR_SPACING)));
        }
        if (input.p1_input[BTN_QUIT]) {
            std::cout << "key_map::draw_screen - FINISHED #2" << std::endl;
            finished = true;
        }
        input.clean();
        input.waitTime(10);
        draw_lib.update_screen();
    }
}
开发者ID:farleyknight,项目名称:rockbot,代码行数:69,代码来源:key_map.cpp


示例6: use_tank

void class_config::use_tank(int tank_type)
{
	int n = 0;

    // check tank number
    if (tank_type == TANK_ENERGY && game_save.items.energy_tanks == 0) {
        return;
    }
    if (tank_type == TANK_WEAPON && game_save.items.weapon_tanks == 0) {
        return;
    }
    if (tank_type == TANK_SPECIAL && game_save.items.special_tanks == 0) {
        return;
    }

	// no need for tank usage
	if (tank_type == TANK_ENERGY && player_ref->get_hp().current == player_ref->get_hp().total) {
		return;
	}
	if (tank_type == TANK_ENERGY || tank_type == TANK_SPECIAL) {
		while (player_ref->get_hp().current < player_ref->get_hp().total) {
			player_ref->set_current_hp(1);
			if (n == 0 || n % 6 == 0) {
				soundManager.play_sfx(SFX_GOT_ENERGY);
			}
			n++;
			//graphLib.draw_horizontal_hp_bar(WPN_COLUMN_Y, 2, player_ref->get_hp().current);
			graphLib.draw_weapon_cursor(st_position(0, 0), player_ref->get_hp().current, -1);
            draw_lib.update_screen();
			input.waitTime(50);
		}
	}
	if (tank_type == TANK_SPECIAL || tank_type == TANK_WEAPON) {
		st_position weapon_pos(0, 0);
		for (int i=0; i<WEAPON_COUNT; i++) {
			n = 0;
			short unsigned int value = player_ref->get_weapon_value(i);
			if (value < player_ref->get_hp().total) {
				while (value < player_ref->get_hp().total) {
					value++;
					player_ref->set_weapon_value(i, value);
					if (n == 0 || n % 6 == 0) {
						soundManager.play_sfx(SFX_GOT_ENERGY);
					}
					n++;
					graphLib.draw_weapon_cursor(weapon_pos, player_ref->get_weapon_value(i), -1);
                    draw_lib.update_screen();
					input.waitTime(50);
				}
			}
			weapon_pos.y = weapon_pos.y+1;
			if (weapon_pos.y > 5) {
				weapon_pos.y = 1;
				weapon_pos.x = 1;
			}
		}
	}
    // consume tank
    if (tank_type == TANK_ENERGY) {
        game_save.items.energy_tanks--;
    }
    if (tank_type == TANK_WEAPON) {
        game_save.items.weapon_tanks--;
    }
    if (tank_type == TANK_SPECIAL) {
        game_save.items.special_tanks--;
    }
}
开发者ID:eduardok,项目名称:rockbot,代码行数:68,代码来源:class_config.cpp


示例7: loadMap

// ********************************************************************************************** //
//                                                                                                //
// ********************************************************************************************** //
void classMap::loadMap(std::map<std::string, object> &game_object_list)
{
	if (stage_number == -1) {
		cout << "ERROR::map::loadMap - stage number was not set, can't load it before setting the number.\n";
		return;
	}
	if (number == -1) {
		cout << "ERROR::map::loadMap - map number was not set, can't load it before setting the number.\n";
		return;
	}
	game_data.stages[stage_number].maps[number].backgrounds[0].speed = 0.0; // background #1 is ALWAYS static
/*
	//#ifdef DINGUX
		game_data.stages[stage_number].maps[number].backgrounds[0].speed = 0.0;
		game_data.stages[stage_number].maps[number].backgrounds[1].speed = 0.0;
	//#endif
*/

	clean_map();

	//std::cout << "loading map[" << number << "] from stage[" << stage_number << "]" << std::endl;
	for (int i=0; i<MAP_W; i++) {
		for (int j=0; j<MAP_H; j++) {
			map_tiles.tiles[i][j].locked = game_data.stages[stage_number].maps[number].tiles[i][j].locked;
			map_tiles.tiles[i][j].tile1.x = game_data.stages[stage_number].maps[number].tiles[i][j].tile1.x;
			map_tiles.tiles[i][j].tile1.y = game_data.stages[stage_number].maps[number].tiles[i][j].tile1.y;
			map_tiles.tiles[i][j].tile2.x = game_data.stages[stage_number].maps[number].tiles[i][j].tile2.x;
			map_tiles.tiles[i][j].tile2.y = game_data.stages[stage_number].maps[number].tiles[i][j].tile2.y;
			map_tiles.tiles[i][j].tile3.x = game_data.stages[stage_number].maps[number].tiles[i][j].tile3.x;
			map_tiles.tiles[i][j].tile3.y = game_data.stages[stage_number].maps[number].tiles[i][j].tile3.y;
		}
	}
	bool column_locked = true;
	for (int i=0; i<MAP_W; i++) {
		column_locked = true;
		for (int j=0; j<MAP_H; j++) {
			if (map_tiles.tiles[i][j].locked != 1 && map_tiles.tiles[i][j].locked != TERRAIN_DOOR && map_tiles.tiles[i][j].locked != TERRAIN_SCROLL_LOCK) {
				column_locked = false;
				break;
			}
		}
		wall_scroll_lock[i] = column_locked;
	}

	load_map_npcs();

	load_map_objects(game_object_list);

	if (strlen(game_data.stages[stage_number].maps[number].backgrounds[0].filename) > 0) {
		std::string bg1_filename(FILEPATH+"data/images/map_backgrounds/" + game_data.stages[stage_number].maps[number].backgrounds[0].filename);
		//std::cout << "stage_number: " << stage_number << ", map_number: " << number << ", bg1_filename: " << bg1_filename.c_str() << std::endl;
		graphLib.surfaceFromFile(bg1_filename, &bg1_surface);
	}
	if (strlen(game_data.stages[stage_number].maps[number].backgrounds[1].filename) > 0) {
		std::string bg2_filename(FILEPATH+"data/images/map_backgrounds/"+ game_data.stages[stage_number].maps[number].backgrounds[1].filename);
		std::cout << "classmap::loadMap - loading bg2: '" << bg2_filename << std::endl;
		std::cout << "bg2_filename: " << bg2_filename.c_str() << std::endl;
		graphLib.surfaceFromFile(bg2_filename, &bg2_surface);
	}


	drawMap();
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:66,代码来源:classmap.cpp


示例8: config_input

void key_map::config_input()
{
    CURRENT_FILE_FORMAT::st_game_config game_config_copy = game_config;
    int selected_option = 0;

    while (selected_option != -1) {
        selected_option = draw_config_keys();

        std::cout << "key_map::config_input - selected_option: " << selected_option << std::endl;

        if (selected_option == 0) {
            game_config.set_default_keys();
            std::cout << "key_map::config_input - LEAVE #1" << std::endl;
        } else if (selected_option == -1) {
            std::cout << "key_map::config_input - LEAVE #2" << std::endl;
            // apply changes to game-config
            apply_key_codes_changes(game_config_copy);
            return;

        // -- NEW -- //
        } else if (selected_option == 8) {
            if (game_config.input_mode == INPUT_MODE_DIGITAL) {
                game_config.input_mode = INPUT_MODE_ANALOG;
            } else {
                game_config.input_mode = INPUT_MODE_DIGITAL;
            }
        // -- NEW -- //


        } else {
            std::cout << "key_map::config_input - PICK KEY #1" << std::endl;
            INPUT_COMMANDS selected_key = BTN_JUMP;
            if (selected_option == 1) {
                selected_key = BTN_JUMP;
            } else if (selected_option == 2) {
                selected_key = BTN_ATTACK;
            } else if (selected_option == 3) {
                selected_key = BTN_SHIELD;
            } else if (selected_option == 4) {
                selected_key = BTN_DASH;
            } else if (selected_option == 5) {
                selected_key = BTN_L;
            } else if (selected_option == 6) {
                selected_key = BTN_R;
            } else if (selected_option == 7) {
                selected_key = BTN_START;
            } else if (selected_option == 9) {
                selected_key = BTN_UP;
            } else if (selected_option == 10) {
                selected_key = BTN_DOWN;
            } else if (selected_option == 11) {
                selected_key = BTN_LEFT;
            } else if (selected_option == 12) {
                selected_key = BTN_RIGHT;
            }

            st_position menu_pos(graphLib.get_config_menu_pos().x + 74, graphLib.get_config_menu_pos().y + 40);
            graphLib.clear_area(menu_pos.x, menu_pos.y, 180,  180, 0, 0, 0);
            graphLib.draw_text(menu_pos.x, menu_pos.y, "PRESS A KEY OR BUTTON");
            input.clean();
            input.waitTime(20);
            bool is_joystick = input.pick_key_or_button(game_config_copy, selected_key);
            check_key_duplicates(game_config_copy, selected_key, is_joystick);
        }
    }
    // apply changes to game-config
    apply_key_codes_changes(game_config_copy);
}
开发者ID:farleyknight,项目名称:rockbot,代码行数:68,代码来源:key_map.cpp


示例9: main

int main(int argc, char *argv[])
#endif
{


#ifdef PSP
    SetupCallbacks();
    scePowerSetClockFrequency(333, 333, 166);
#endif

    for (int i=0; i<FLAG_COUNT; i++) {
		GAME_FLAGS[i] = false;
	}
	UNUSED(argc);

    string argvString = "";
#ifndef WII
    argvString = string(argv[0]);
#else
    if (!fatInitDefault()) {
        printf("fatInitDefault ERROR #1");
        std::fflush(stdout);
        timer.delay(500);
        exit(-1);
    }
#endif


    get_filepath();
    // fallback in case getcwd returns null
    if (FILEPATH.size() == 0) {
        std::cout << "Could not read path, fallback to using argv" << std::endl;
        FILEPATH = argvString.substr(0, argvString.size()-EXEC_NAME.size());
    }
    std::cout << "main - argvString: '" << argvString << "', FILEPATH: '" << FILEPATH << "'" << std::endl; std::fflush(stdout);



#ifdef PLAYSTATION2
    std::cout << "PS2.DEBUG #1" << std::endl; std::fflush(stdout);

    #ifndef PS2LINK
    SifIopReset(NULL, 0); // clean previous loading of irx by apps like ulaunchElf. Comment this line to get cout on ps2link
    #endif

    printf("DEBUG.PS2 #1.1\n");

	/* SP193: Being creative (Do something while waiting for the slow IOP to be reset). =D */
	int main_id = GetThreadId();
    ChangeThreadPriority(main_id, 72);
    std::cout << "PS2.DEBUG #1.1" << std::endl; std::fflush(stdout);
    printf("DEBUG.PS2 #1.2\n");

    #ifndef PS2LINK
    while(SifIopSync()) {
        std::cout << "PS2.SifIopSync()" << std::endl;
    }
    #endif
	/* Initialize and connect to all SIF services on the IOP. */
	SifInitRpc(0);
	SifInitIopHeap();
	SifLoadFileInit();
	fioInit();
    printf("DEBUG.PS2 #1.3\n");

	/* Apply the SBV LMB patch to allow modules to be loaded from a buffer in EE RAM. */
	sbv_patch_enable_lmb();

    // --- DEBUG --- //
    //FILEPATH = "cdfs:/";
    // --- DEBUG --- //

    std::cout << "PS2.DEBUG #2" << std::endl; std::fflush(stdout);

    if (FILEPATH.find("mass:") != std::string::npos) {
        printf("DEBUG.PS2 #1.4\n");
        std::cout << "PS2.DEBUG Load USB" << std::endl; std::fflush(stdout);
        PS2_load_USB();
    }

    if (FILEPATH.find("cdfs") != std::string::npos || FILEPATH.find("cdrom") != std::string::npos) {
        printf("DEBUG.PS2 #1.5\n");
        std::cout << "PS2.DEBUG Load CDROM" << std::endl; std::fflush(stdout);
        FILEPATH = "cdfs:";
        PS2_load_CDROM();
    }
    printf("DEBUG.PS2 #2\n");




    std::cout << "PS2.DEBUG #3" << std::endl; std::fflush(stdout);
#endif




	// check command-line paramethers
	if (argc > 1) {
		for (int i=1; i<argc; i++) {
//.........这里部分代码省略.........
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:101,代码来源:main.cpp


示例10: clear_screen

void sceneShow::clear_screen()
{
    graphLib.clear_area(0, 0, RES_W, RES_H, 0, 0, 0);
    graphLib.updateScreen();
}
开发者ID:eduardok,项目名称:rockbot,代码行数:5,代码来源:sceneshow.cpp


示例11: run_text

void sceneShow::run_text(CURRENT_FILE_FORMAT::file_scene_show_text text)
{

    int lines_n = 0;
    int max_line_w = 0;

    // this part is used to calculate text/lines size for positioning
    /// @TODO: optimize using a vector
    std::vector<int> string_id_list;
    for (int i=0; i<SCENE_TEXT_LINES_N; i++) {
        string_id_list.push_back(text.line_string_id[i]);
    }

    std::vector<std::string> text_lines;
    for (int i=0; i<SCENE_TEXT_LINES_N; i++) {

        std::string line = fio_str.get_scenes_string(text.line_string_id[i]);

        if (line.size() > 0) {
            text_lines.push_back(line);
            if (line.size() > max_line_w) {
                max_line_w = line.size();
            }
            // only count as line if not empty
            lines_n = i+1;
        } else {
            text_lines.push_back(std::string(" "));
        }
    }

    int center_x = (RES_W * 0.5) - (max_line_w/2 * FONT_SIZE);
    int center_y = (RES_H * 0.5) - (lines_n * (SCENES_LINE_H_DIFF * 0.5));
    int pos_x = 0;
    int pos_y = 0;

    if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_dialogbottom) {
        pos_x = 10;
        pos_y = SCENES_TEXT_BOTTOM_POSY;
    } else if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_dialogtop) {
        pos_x = 10;
        pos_y = 10;
    } else if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_centered) {
        pos_x = center_x;
        pos_y = center_y;

    } else if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_center_x) {
        pos_x = center_x;
        pos_y = text.y;

    } else if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_center_y) {
        pos_x = text.x;
        pos_y = center_y;

    } else if (text.position_type == CURRENT_FILE_FORMAT::text_position_type_user_defined) {
        pos_x = text.x;
        pos_y = text.y;
    }

    std::vector<std::string> lines;
    int max_w = 0;
    for (int i=0; i<text_lines.size(); i++) {
        std::string line = std::string(text_lines.at(i));
        if (line.length() < 1) {
            break;
        }
        lines.push_back(line);
        if (line.length() * FONT_SIZE > max_w) {
            max_w = line.length() * (FONT_SIZE+5);
        }
    }
    // clear text area
    int max_h = lines.size()*SCENES_LINE_H_DIFF;
    std::cout << "lines[" << lines.size() << "], max_w[" << max_w << "], max_h[" << max_h << "]" << std::endl;
    graphLib.clear_area(pos_x, pos_y, max_w, max_h, 0, 0, 0);


    for (int i=0; i<lines.size(); i++) {
        if (input.p1_input[BTN_START] == 1) {
            _interrupt_scene = true;
            break;
        }
        std::string line = std::string(lines.at(i));
        int adjusted_y = pos_y+(SCENES_LINE_H_DIFF*i);
        graphLib.clear_area(pos_x, adjusted_y, line.length()*9, 8, 0, 0, 0);
        if (graphLib.draw_progressive_text(pos_x, adjusted_y, line, false, 30) == 1) {
            _interrupt_scene = true;
            break;
        }
    }
    std::cout << "run_text::DONE" << std::endl;
}
开发者ID:protoman,项目名称:rockbot,代码行数:91,代码来源:sceneshow.cpp


示例12: update_colorcycle

void draw::update_colorcycle() const
{
    graphLib.execute_colorcycle();
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:4,代码来源:draw.cpp


示例13: show_teleport_small

void draw::show_teleport_small(int x, int y)
{
    graphLib.showSurfaceAt(&_teleport_small_gfx, st_position(x+_teleport_small_gfx.width/2, y+_teleport_small_gfx.height/2), false);
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:4,代码来源:draw.cpp


示例14: set_teleport_small_colors

void draw::set_teleport_small_colors(st_color color1, st_color color2)
{
    graphLib.change_surface_color(graphLib.get_colorkey_n(COLOR_KEY_GREEN), color1, &_teleport_small_gfx);
    graphLib.change_surface_color(graphLib.get_colorkey_n(COLOR_KEY_PURPLE), color2, &_teleport_small_gfx);
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:5,代码来源:draw.cpp


示例15: reset_teleporter_colors

void draw::reset_teleporter_colors()
{
    graphLib.reset_image_colormap(_teleport_small_gfx);
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:4,代码来源:draw.cpp


示例16: show_ready

void draw::show_ready()
{
    st_position dest_pos((RES_W/2)-26, (RES_H/2)-6);
    graphLib.copyArea(dest_pos, &ready_message, &graphLib.gameScreen);
    graphLib.updateScreen();
}
开发者ID:DavidKnight247,项目名称:Rockbot-GCW0-port,代码行数:6,代码来源:draw.cpp



注:本文中的graphicsLib类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ group类代码示例发布时间:2022-05-31
下一篇:
C++ graphchi_vertex类代码示例发布时间:2022-05-31
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap