Split Splash Loading Into Own Function
This commit is contained in:
parent
db22caa50f
commit
d86018717e
5
mods/include/mods/title-screen/title-screen.h
Normal file
5
mods/include/mods/title-screen/title-screen.h
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
#pragma once
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
void title_screen_load_splashes(std::vector<std::string> &splashes);
|
@ -9,6 +9,7 @@
|
|||||||
#include <mods/init/init.h>
|
#include <mods/init/init.h>
|
||||||
#include <mods/compat/compat.h>
|
#include <mods/compat/compat.h>
|
||||||
#include <mods/touch/touch.h>
|
#include <mods/touch/touch.h>
|
||||||
|
#include <mods/title-screen/title-screen.h>
|
||||||
|
|
||||||
// Improved Title Screen Background
|
// Improved Title Screen Background
|
||||||
static void StartMenuScreen_render_Screen_renderBackground_injection(Screen *screen) {
|
static void StartMenuScreen_render_Screen_renderBackground_injection(Screen *screen) {
|
||||||
@ -49,6 +50,20 @@ static void StartMenuScreen_buttonClicked_injection(StartMenuScreen *screen, But
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Add Splashes
|
// Add Splashes
|
||||||
|
void title_screen_load_splashes(std::vector<std::string> &splashes) {
|
||||||
|
std::ifstream stream("data/splashes.txt");
|
||||||
|
if (stream.good()) {
|
||||||
|
std::string line;
|
||||||
|
while (std::getline(stream, line)) {
|
||||||
|
if (line.length() > 0) {
|
||||||
|
splashes.push_back(line);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
stream.close();
|
||||||
|
} else {
|
||||||
|
WARN("Unable To Load Splashes");
|
||||||
|
}
|
||||||
|
}
|
||||||
static Screen *last_screen = nullptr;
|
static Screen *last_screen = nullptr;
|
||||||
static std::string current_splash;
|
static std::string current_splash;
|
||||||
static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) {
|
static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x, int y, float param_1) {
|
||||||
@ -62,18 +77,7 @@ static void StartMenuScreen_render_Screen_render_injection(Screen *screen, int x
|
|||||||
// Mark As Loaded
|
// Mark As Loaded
|
||||||
splashes_loaded = true;
|
splashes_loaded = true;
|
||||||
// Load
|
// Load
|
||||||
std::ifstream stream("data/splashes.txt");
|
title_screen_load_splashes(splashes);
|
||||||
if (stream.good()) {
|
|
||||||
std::string line;
|
|
||||||
while (std::getline(stream, line)) {
|
|
||||||
if (line.length() > 0) {
|
|
||||||
splashes.push_back(line);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
stream.close();
|
|
||||||
} else {
|
|
||||||
WARN("Unable To Load Splashes");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Display Splash
|
// Display Splash
|
||||||
|
Loading…
Reference in New Issue
Block a user