Skip to content

Add cap to backlog entries#492

Merged
PringlesGang merged 8 commits into
masterfrom
backlog-entry-cap
Jul 21, 2026
Merged

Add cap to backlog entries#492
PringlesGang merged 8 commits into
masterfrom
backlog-entry-cap

Conversation

@PringlesGang

@PringlesGang PringlesGang commented Jun 24, 2026

Copy link
Copy Markdown
Member

Stores the backlog entries in a circular buffer and adds a maximum number of entries to the profile. When full, the oldest entry will be overwritten by the new entry.

The maximum is profile-configurable and defaulted to 400, as per the MAGES. engine.

  • Add cap to backlog entries
  • Add Boost::circular_buffer dependency
  • Turn backlog class's scrollbar from a Scrollbar* to simply a Scrollbar
  • Have scrolling down to close the backlog when at the bottom be based on a short timer, so scrolling to the bottom of the backlog does not immediately close it on high FPS

@PringlesGang PringlesGang added this to the 0.9.X Polishing milestone Jun 24, 2026
@PringlesGang PringlesGang self-assigned this Jun 24, 2026
@PringlesGang
PringlesGang force-pushed the backlog-entry-cap branch 2 times, most recently from cd16026 to a8a255a Compare June 25, 2026 01:05
@PringlesGang
PringlesGang marked this pull request as ready for review June 25, 2026 01:17

@KKhanhH KKhanhH left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of circular buffer of unique_ptrs of backlog entries (of which there is only one type tied to the game, so the polymorphism support isn't needed), could we have a circular buffer of concrete classes instead? for 400 entries I could imagine this might add some performance hit to it. If we wanna avoid code duplication we could maybe do a CRTP type class where backlog entry type is one of the template args

@PringlesGang

Copy link
Copy Markdown
Member Author

Instead of circular buffer of unique_ptrs of backlog entries (of which there is only one type tied to the game, so the polymorphism support isn't needed), could we have a circular buffer of concrete classes instead? for 400 entries I could imagine this might add some performance hit to it. If we wanna avoid code duplication we could maybe do a CRTP type class where backlog entry type is one of the template args

Yeah I was also not happy having the circular buffer store pointers, so I'd love to fix this. I've never heard of CRTP before and I don't fully understand how this would work here yet.

Your main idea is to make the backlog entry type a template parameter, right? But for the generic inline BacklogMenu* BacklogMenuPtr we cannot give generic template parameters, so I don't see how CRTP would work then either...

@KKhanhH

KKhanhH commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Your main idea is to make the backlog entry type a template parameter, right? But for the generic inline BacklogMenu* BacklogMenuPtr we cannot give generic template parameters, so I don't see how CRTP would work then either...

You would probably need an intermediate class that derives from BacklogMenu that contains the queue and has all the methods to act on the queue. Then game classes would derive from that.

template <typename Derived, typename BacklogEntry>
class BacklogMenuBase : public BacklogMenu {
 protected:
   // show entries methods, hide entries, render entries, etc,
   boost::circular_buffer<BacklogEntry> Entries;
};

class CC::BacklogMenu : public BacklogMenuBase<CC::BacklogMenu, CC::BacklogMenuEntry> {
 //...
};

@KKhanhH

KKhanhH commented Jul 17, 2026

Copy link
Copy Markdown
Collaborator

Well the derived part might not be needed if you don't need to call anything on the derived classes, it's mainly useful if you do in the form of static_cast<Derived*>(this)->method

@PringlesGang
PringlesGang requested a review from KKhanhH July 18, 2026 14:07
@PringlesGang
PringlesGang merged commit 6d8536e into master Jul 21, 2026
9 checks passed
@PringlesGang
PringlesGang deleted the backlog-entry-cap branch July 21, 2026 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants