Player12
An open source football management simulator
Loading...
Searching...
No Matches
NewsScene Class Reference

World news: big transfers, managerial changes, title races, upsets, records and honours from this season and the last, built from the saved world (model/news_feed.h). Filters by country, competition and kind; every story links to its player, clubs or match report. More...

#include <news_scene.h>

Inheritance diagram for NewsScene:
ManagementScene GUIScene

Classes

struct  CompetitionOption
 
struct  Row
 

Public Member Functions

 NewsScene (GUIView *parent)
 
void update (float) override
 Updates scene logic.
 
SceneID getID () const override
 Gets the ID of the scene.
 
std::size_t storyCount () const
 
std::size_t shownCount () const
 
void filterCountry (std::optional< LeagueID > country)
 
void filterKind (std::optional< NewsKind > kind)
 
- Public Member Functions inherited from ManagementScene
 ManagementScene (GUIView *guiViewPtr)
 
void render () final
 Renders the scene.
 
void onEnter () override
 Called when the scene is entered/becomes active.
 
void onResume () override
 Called when an overlay above this scene closes and it becomes the active scene again. Screens use it to refresh cached view models after a match, a transfer or any other state change made elsewhere.
 
void handleEvent (const SDL_Event &event) override
 
std::optional< NavEntry > historyEntry () const override
 
- Public Member Functions inherited from GUIScene
 GUIScene (GUIView *guiView_ptr)
 Constructs a new GUIScene.
 
virtual ~GUIScene ()=default
 Destroys the GUIScene.
 
virtual void onExit ()
 Called when the scene is exited/becomes inactive.
 
virtual void onResize (int width, int height)
 Called when the window is resized.
 

Protected Member Functions

void renderContent () override
 Draws the page body inside the content region.
 
NavSection navSection () const override
 Sidebar entry highlighted for this screen.
 
void refresh () override
 Rebuilds cached view models from the game state.
 
- Protected Member Functions inherited from ManagementScene
virtual std::optional< EditorContext > editorContext () const
 
void showToast (std::string message, bool isError=false)
 Shows a short confirmation message in the top bar.
 
HolidayDialog & holidayDialog ()
 Holiday planner and return report of this screen.
 
- Protected Member Functions inherited from GUIScene
SDL_Renderer * getRenderer () const
 Gets the SDL renderer.
 
SDL_Window * getWindow () const
 Gets the SDL window.
 
GUIView * getGuiView () const
 Gets the associated GUIView.
 
void changeScene (std::unique_ptr< GUIScene > newScene)
 Requests a scene change.
 
void quit ()
 Requests the application to quit.
 

Private Member Functions

void rebuildCompetitions ()
 
void applyFilter ()
 
void renderFilters ()
 
void renderStory (std::size_t index)
 

Private Attributes

std::vector< NewsItem > items
 
std::vector< Row > rows
 
std::vector< std::size_t > kept
 
std::vector< std::pair< LeagueID, std::string > > countries
 
std::vector< CompetitionOption > competitions
 
NewsFilter filter
 
std::string country_label
 
std::string competition_label
 
std::size_t visible = 0
 

Additional Inherited Members

- Protected Attributes inherited from GUIScene
GUIView * guiView
 

Detailed Description

World news: big transfers, managerial changes, title races, upsets, records and honours from this season and the last, built from the saved world (model/news_feed.h). Filters by country, competition and kind; every story links to its player, clubs or match report.

Constructor & Destructor Documentation

◆ NewsScene()

NewsScene::NewsScene ( GUIView *  parent)
explicit

Member Function Documentation

◆ applyFilter()

void NewsScene::applyFilter ( )
private

◆ filterCountry()

void NewsScene::filterCountry ( std::optional< LeagueID >  country)

Keeps one country (0: continental) or every one (nullopt).

◆ filterKind()

void NewsScene::filterKind ( std::optional< NewsKind >  kind)

Keeps one kind of story or every kind (nullopt).

◆ getID()

SceneID NewsScene::getID ( ) const
inlineoverridevirtual

Gets the ID of the scene.

Returns
The SceneID of this scene.

GUIView uses this identifier to apply match-specific event and scene behavior.

Implements GUIScene.

◆ navSection()

NavSection NewsScene::navSection ( ) const
inlineoverrideprotectedvirtual

Sidebar entry highlighted for this screen.

Implements ManagementScene.

◆ rebuildCompetitions()

void NewsScene::rebuildCompetitions ( )
private

◆ refresh()

void NewsScene::refresh ( )
overrideprotectedvirtual

Rebuilds cached view models from the game state.

Reimplemented from ManagementScene.

◆ renderContent()

void NewsScene::renderContent ( )
overrideprotectedvirtual

Draws the page body inside the content region.

Implements ManagementScene.

◆ renderFilters()

void NewsScene::renderFilters ( )
private

◆ renderStory()

void NewsScene::renderStory ( std::size_t  index)
private

◆ shownCount()

std::size_t NewsScene::shownCount ( ) const
inline

◆ storyCount()

std::size_t NewsScene::storyCount ( ) const
inline

Stories in the feed, and those the filters keep.

◆ update()

void NewsScene::update ( float  deltaTime)
inlineoverridevirtual

Updates scene logic.

Parameters
deltaTimeThe time elapsed since the last update.

Implements GUIScene.

Member Data Documentation

◆ competition_label

std::string NewsScene::competition_label
private

◆ competitions

std::vector<CompetitionOption> NewsScene::competitions
private

◆ countries

std::vector<std::pair<LeagueID, std::string> > NewsScene::countries
private

Countries with stories: top league ID and name (0: continental).

◆ country_label

std::string NewsScene::country_label
private

◆ filter

NewsFilter NewsScene::filter
private

◆ items

std::vector<NewsItem> NewsScene::items
private

◆ kept

std::vector<std::size_t> NewsScene::kept
private

◆ rows

std::vector<Row> NewsScene::rows
private

◆ visible

std::size_t NewsScene::visible = 0
private

The documentation for this class was generated from the following files: