MCPcopy Create free account
hub / github.com/OpenStarbound/OpenStarbound / update

Method update

source/frontend/StarQuestIndicatorPainter.cpp:19–51  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

17}
18
19void QuestIndicatorPainter::update(float dt, WorldClientPtr const& world, WorldCamera const& camera) {
20 m_camera = camera;
21
22 Set<EntityId> foundIndicators;
23 for (auto const& entity : world->query<Entity>(camera.worldScreenRect())) {
24 auto indicator = m_client->questManager()->getQuestIndicator(entity);
25 if (!indicator) continue;
26
27 foundIndicators.insert(entity->entityId());
28 Vec2F screenPos = camera.worldToScreen(indicator->worldPosition);
29
30 if (auto currentIndicator = m_indicators.ptr(entity->entityId())) {
31 currentIndicator->screenPos = screenPos;
32 if (currentIndicator->indicatorName == indicator->indicatorImage) {
33 currentIndicator->animation->update(dt);
34 } else {
35 currentIndicator->indicatorName = indicator->indicatorImage;
36 currentIndicator->animation = indicatorAnimation(indicator->indicatorImage);
37 }
38 } else {
39 m_indicators[entity->entityId()] = Indicator {
40 entity->entityId(),
41 screenPos,
42 indicator->indicatorImage,
43 indicatorAnimation(indicator->indicatorImage)
44 };
45 }
46 }
47
48 m_indicators = Map<EntityId, Indicator>::from(m_indicators.pairs().filtered([&foundIndicators](pair<EntityId, Indicator> indicator) {
49 return foundIndicators.contains(indicator.first);
50 }));
51}
52
53Drawable QuestIndicatorPainter::Indicator::render(float pixelRatio) const {
54 return animation->drawable(pixelRatio);

Callers

nothing calls this directly

Calls 11

indicatorAnimationFunction · 0.85
worldScreenRectMethod · 0.80
getQuestIndicatorMethod · 0.80
entityIdMethod · 0.80
worldToScreenMethod · 0.80
questManagerMethod · 0.45
insertMethod · 0.45
ptrMethod · 0.45
filteredMethod · 0.45
pairsMethod · 0.45
containsMethod · 0.45

Tested by

no test coverage detected