当前位置: 首页>>代码示例>>C++>>正文


C++ BitmapRef::GetHeight方法代码示例

本文整理汇总了C++中BitmapRef::GetHeight方法的典型用法代码示例。如果您正苦于以下问题:C++ BitmapRef::GetHeight方法的具体用法?C++ BitmapRef::GetHeight怎么用?C++ BitmapRef::GetHeight使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在BitmapRef的用法示例。


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

示例1: src

Window_ShopParty::Window_ShopParty(int ix, int iy, int iwidth, int iheight) :
	Window_Base(ix, iy, iwidth, iheight) {

	SetContents(Bitmap::Create(width - 16, height - 16));
	contents->SetTransparentColor(windowskin->GetTransparentColor());

	cycle = 0;
	item_id = 0;

	const std::vector<Game_Actor*>& actors = Game_Party::GetActors();
	for (size_t i = 0; i < actors.size() && i < 4; i++) {
		Game_Actor *actor = actors[i];
		const std::string& sprite_name = actor->GetCharacterName();
		int sprite_id = actor->GetCharacterIndex();
		BitmapRef bm = Cache::Charset(sprite_name);
		int width = bm->GetWidth() / 4 / 3;
		int height = bm->GetHeight() / 2 / 4;
		for (int j = 0; j < 3; j++) {
			int sx = ((sprite_id % 4) * 3 + j) * width;
			int sy = ((sprite_id / 4) * 4 + 2) * height;
			Rect src(sx, sy, width, height);
			for (int k = 0; k < 2; k++) {
				BitmapRef bm2 = Bitmap::Create(width, height, true);
				bm2->SetTransparentColor(bm->GetTransparentColor());
				bm2->Clear();
				bm2->Blit(0, 0, *bm, src, 255);
				if (k == 0)
					bm2->ToneBlit(0, 0, *bm2, bm2->GetRect(), Tone(0, 0, 0, 255));
				bitmaps[i][j][k] = bm2;
			}
		}
	}

	Refresh();
}
开发者ID:Bonstra,项目名称:EasyRPG-Player,代码行数:35,代码来源:window_shopparty.cpp

示例2: Sprite

void Battle::Enemy::CreateSprite() {
	BitmapRef graphic = Cache::Monster(rpg_enemy->battler_name);
	bool hue_change = rpg_enemy->battler_hue != 0;
	if (hue_change) {
	    BitmapRef new_graphic = Bitmap::Create(graphic->GetWidth(), graphic->GetHeight());
		new_graphic->HueChangeBlit(0, 0, *graphic, graphic->GetRect(), rpg_enemy->battler_hue);
		graphic = new_graphic;
	}

	sprite.reset(new Sprite());
	sprite->SetBitmap(graphic);
	sprite->SetOx(graphic->GetWidth() / 2);
	sprite->SetOy(graphic->GetHeight() / 2);
	sprite->SetX(member->x);
	sprite->SetY(member->y);
	sprite->SetZ(member->y);
	sprite->SetVisible(!game_enemy->IsHidden());
}
开发者ID:sjunejo,项目名称:Player,代码行数:18,代码来源:battle_battler.cpp

示例3: OnCharsetSpriteReady

void Window_ShopParty::OnCharsetSpriteReady(FileRequestResult* /* result */, int party_index) {
	Game_Actor *actor = Main_Data::game_party->GetActors()[party_index];
	const std::string& sprite_name = actor->GetSpriteName();
	int sprite_id = actor->GetSpriteIndex();
	BitmapRef bm = Cache::Charset(sprite_name);
	int width = bm->GetWidth() / 4 / 3;
	int height = bm->GetHeight() / 2 / 4;
	for (int j = 0; j < 3; j++) {
		int sx = ((sprite_id % 4) * 3 + j) * width;
		int sy = ((sprite_id / 4) * 4 + 2) * height;
		Rect src(sx, sy, width, height);
		for (int k = 0; k < 2; k++) {
			BitmapRef bm2 = Bitmap::Create(width, height, true);
			bm2->Clear();
			bm2->Blit(0, 0, *bm, src, 255);
			if (k == 0)
				bm2->ToneBlit(0, 0, *bm2, bm2->GetRect(), Tone(128, 128, 128, 0), Opacity::opaque);
			bitmaps[party_index][j][k] = bm2;
		}
	}
}
开发者ID:EasyRPG,项目名称:Player,代码行数:21,代码来源:window_shopparty.cpp

示例4: Draw

void Text::Draw(Bitmap& dest, int x, int y, int color, std::string const& text, Text::Alignment align) {
    if (text.length() == 0) return;

    FontRef font = dest.GetFont();
    Rect dst_rect = Font::Default()->GetSize(text);

    switch (align) {
    case Text::AlignCenter:
        dst_rect.x = x - dst_rect.width / 2;
        break;
    case Text::AlignRight:
        dst_rect.x = x - dst_rect.width;
        break;
    case Text::AlignLeft:
        dst_rect.x = x;
        break;
    default:
        assert(false);
    }

    dst_rect.y = y;
    dst_rect.width += 1;
    dst_rect.height += 1; // Need place for shadow
    if (dst_rect.IsOutOfBounds(dest.GetWidth(), dest.GetHeight())) return;

    BitmapRef text_surface; // Complete text will be on this surface
    text_surface = Bitmap::Create(dst_rect.width, dst_rect.height, true);
    text_surface->SetTransparentColor(dest.GetTransparentColor());
    text_surface->Clear();

    // Load the system file for the shadow and text color
    BitmapRef system = Cache::System(Data::system.system_name);
    // Load the exfont-file
    BitmapRef exfont = Cache::Exfont();

    // Get the Shadow color
    Color shadow_color(Cache::system_info.sh_color);
    // If shadow is pure black, increase blue channel
    // so it doesn't become transparent
    if ((shadow_color.red == 0) &&
            (shadow_color.green == 0) &&
            (shadow_color.blue == 0) ) {

        if (text_surface->bytes() >= 3) {
            shadow_color.blue++;
        } else {
            shadow_color.blue += 8;
        }
    }

    // Where to draw the next glyph (x pos)
    int next_glyph_pos = 0;

    // The current char is an exfont
    bool is_exfont = false;

    // This loops always renders a single char, color blends it and then puts
    // it onto the text_surface (including the drop shadow)
    for (boost::u8_to_u32_iterator<std::string::const_iterator>
            c(text.begin(), text.begin(), text.end()),
            end(text.end(), text.begin(), text.end()); c != end; ++c) {
        Rect next_glyph_rect(next_glyph_pos, 0, 0, 0);

        boost::u8_to_u32_iterator<std::string::const_iterator> next_c_it = boost::next(c);
        uint32_t const next_c = std::distance(c, end) > 1? *next_c_it : 0;

        // ExFont-Detection: Check for A-Z or a-z behind the $
        if (*c == '$' && std::isalpha(next_c)) {
            int exfont_value = -1;
            // Calculate which exfont shall be rendered
            if (islower(next_c)) {
                exfont_value = 26 + next_c - 'a';
            } else if (isupper(next_c)) {
                exfont_value = next_c - 'A';
            } else {
                assert(false);
            }
            is_exfont = true;

            BitmapRef mask = Bitmap::Create(12, 12, true);

            // Get exfont from graphic
            Rect const rect_exfont((exfont_value % 13) * 12, (exfont_value / 13) * 12, 12, 12);

            // Create a mask
            mask->Clear();
            mask->Blit(0, 0, *exfont, rect_exfont, 255);

            // Get color region from system graphic
            Rect clip_system(8+16*(color%10), 4+48+16*(color/10), 6, 12);

            BitmapRef char_surface = Bitmap::Create(mask->GetWidth(), mask->GetHeight(), true);
            char_surface->SetTransparentColor(dest.GetTransparentColor());
            char_surface->Clear();

            // Blit gradient color background (twice because of full glyph)
            char_surface->Blit(0, 0, *system, clip_system, 255);
            char_surface->Blit(6, 0, *system, clip_system, 255);

            // Blit mask onto background
//.........这里部分代码省略.........
开发者ID:Bonstra,项目名称:EasyRPG-Player,代码行数:101,代码来源:text.cpp


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