Player12
An open source football management simulator
Loading...
Searching...
No Matches
news_scene.h
Go to the documentation of this file.
1// -----------------------------------------------------------------------------
2// Football Management Project
3// Copyright (c) 2025 - 2026 Flavio Milinanni. All Rights Reserved.
4//
5// This file is part of the Football Management Project.
6// See the LICENSE file in the project root.
7// -----------------------------------------------------------------------------
8
9#pragma once
10
11#include <cstddef>
12#include <optional>
13#include <string>
14#include <utility>
15#include <vector>
16
18#include "model/news_feed.h"
19
27{
28 public:
29 explicit NewsScene(GUIView* parent);
30
31 void update(float /*deltaTime*/) override
32 {
33 // Rendering reads current state; there is no per-frame update work.
34 }
35 [[nodiscard]] SceneID getID() const override { return SceneID::NEWS; }
36
38 [[nodiscard]] std::size_t storyCount() const { return items.size(); }
39 [[nodiscard]] std::size_t shownCount() const { return kept.size(); }
41 void filterCountry(std::optional<LeagueID> country);
43 void filterKind(std::optional<NewsKind> kind);
44
45 protected:
46 void renderContent() override;
47 [[nodiscard]] NavSection navSection() const override
48 {
49 return NavSection::NEWS;
50 }
51 void refresh() override;
52
53 private:
55 struct Row
56 {
57 std::string headline;
58 std::string date;
59 std::string meta;
60 std::string player;
61 std::string team;
62 std::string other_team;
63 };
64
70
72 void applyFilter();
73 void renderFilters();
74 void renderStory(std::size_t index);
75
76 std::vector<NewsItem> items;
77 std::vector<Row> rows;
78 std::vector<std::size_t> kept;
80 std::vector<std::pair<LeagueID, std::string>> countries;
81 std::vector<CompetitionOption> competitions;
83 std::string country_label;
84 std::string competition_label;
85 std::size_t visible = 0;
86};
Main view manager for the GUI. Handles scenes and overlays.
Definition gui_view.h:29
Base class for every in-career screen.
Definition management_scene.h:93
World news: big transfers, managerial changes, title races, upsets, records and honours from this sea...
Definition news_scene.h:27
void applyFilter()
Definition news_scene.cpp:174
void update(float) override
Updates scene logic.
Definition news_scene.h:31
std::size_t storyCount() const
Definition news_scene.h:38
std::string competition_label
Definition news_scene.h:84
SceneID getID() const override
Gets the ID of the scene.
Definition news_scene.h:35
std::vector< std::pair< LeagueID, std::string > > countries
Definition news_scene.h:80
std::vector< NewsItem > items
Definition news_scene.h:76
void filterCountry(std::optional< LeagueID > country)
Definition news_scene.cpp:193
void renderFilters()
Definition news_scene.cpp:207
void filterKind(std::optional< NewsKind > kind)
Definition news_scene.cpp:201
void rebuildCompetitions()
Definition news_scene.cpp:130
std::size_t shownCount() const
Definition news_scene.h:39
void renderStory(std::size_t index)
Definition news_scene.cpp:272
void refresh() override
Rebuilds cached view models from the game state.
Definition news_scene.cpp:68
std::string country_label
Definition news_scene.h:83
NewsFilter filter
Definition news_scene.h:82
std::vector< std::size_t > kept
Definition news_scene.h:78
std::vector< CompetitionOption > competitions
Definition news_scene.h:81
NavSection navSection() const override
Sidebar entry highlighted for this screen.
Definition news_scene.h:47
void renderContent() override
Draws the page body inside the content region.
Definition news_scene.cpp:350
std::vector< Row > rows
Definition news_scene.h:77
std::size_t visible
Definition news_scene.h:85
SceneID
Identifiers for different GUI scenes.
Definition gui_scene.h:24
NavSection
Screens of the management shell. The sidebar groups them into a few hubs (Home, Inbox,...
Definition nav_history.h:26
int index
Definition runtime_editor.cpp:94
A competition a story belongs to (id 0: none).
Definition news_feed.h:49
What the news screen shows (unset fields: everything).
Definition news_feed.h:111
Definition news_scene.h:66
NewsCompetition competition
Definition news_scene.h:67
std::string name
Definition news_scene.h:68
Definition news_scene.h:56
std::string player
Definition news_scene.h:60
std::string other_team
Definition news_scene.h:62
std::string team
Definition news_scene.h:61
std::string date
Definition news_scene.h:58
std::string meta
Definition news_scene.h:59
std::string headline
Definition news_scene.h:57