MCPcopy Create free account
hub / github.com/EasyRPG/Player / Draw

Method Draw

src/sprite_actor.cpp:279–300  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

277}
278
279void Sprite_Actor::Draw(Bitmap& dst) {
280 auto* battler = GetBattler();
281 // "do_not_draw" is set to true if the CBA battler name is empty, this
282 // makes the sprite not being drawn. This fixes issue #1708.
283 if (battler->IsHidden() || do_not_draw) {
284 return;
285 }
286
287 SetTone(Main_Data::game_screen->GetTone());
288 SetFlashEffect(battler->GetFlashColor());
289
290 int steps = static_cast<int>(256 / images.size());
291 int opacity = steps;
292 for (auto it = images.crbegin(); it != images.crend(); ++it) {
293 Sprite_Battler::SetFixedFlipX();
294 Sprite_Battler::SetX(it->x);
295 Sprite_Battler::SetY(it->y);
296 Sprite_Battler::SetOpacity(std::min(opacity, 255));
297 Sprite_Battler::Draw(dst);
298 opacity += steps;
299 }
300}
301
302void Sprite_Actor::UpdatePosition() {
303 assert(!images.empty());

Callers

nothing calls this directly

Calls 5

minFunction · 0.85
IsHiddenMethod · 0.80
GetToneMethod · 0.45
GetFlashColorMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected