using namespace Msp;
-BeatCounter::BeatCounter(DataFile::Collection &resources):
- text(resources.get<GL::Font>("ikarius-48.font"), &resources.get<GL::Technique>("basic_text.tech")),
+BeatCounter::BeatCounter(Resources &resources):
+ text(resources.get_ui_font(), &resources.get_ui_text_technique()),
instance(text)
{
text.set_alignment(GL::Text::CENTER);
#include <msp/gl/objectinstance.h>
#include <msp/gl/renderable.h>
#include <msp/gl/text.h>
+#include "resources.h"
#include "action.h"
class BeatCounter: public Msp::GL::Renderable, public Action
Msp::GL::ObjectInstance instance;
public:
- BeatCounter(Msp::DataFile::Collection &);
+ BeatCounter(Resources &);
virtual void beat(int);
#include <msp/al/context.h>
#include <msp/al/device.h>
#include <msp/core/application.h>
-#include <msp/datafile/collection.h>
#include <msp/graphics/display.h>
#include <msp/graphics/glcontext.h>
#include <msp/graphics/window.h>
#include <msp/io/base.h>
#include <msp/time/timedelta.h>
#include <msp/time/timestamp.h>
+#include "resources.h"
class Demo;
class LaunchScreen;
~LauncherBase();
protected:
- virtual Msp::DataFile::Collection &get_resources() = 0;
+ virtual Resources &get_resources() = 0;
virtual Demo *create_demo() = 0;
virtual void start();
virtual void tick();
using namespace Msp;
-LaunchScreen::LaunchScreen(DataFile::Collection &resources):
- font(resources.get<GL::Font>("ikarius-48.font")),
- tech(resources.get<GL::Technique>("basic_text.tech")),
+LaunchScreen::LaunchScreen(Resources &resources):
+ font(resources.get_ui_font()),
+ tech(resources.get_ui_text_technique()),
countdown(font, &tech),
countdown_value(0),
enter_prompt(font, &tech),
#ifndef MSP_DEMOSCENE_LAUNCHSCREEN_H_
#define MSP_DEMOSCENE_LAUNCHSCREEN_H_
-#include <msp/datafile/collection.h>
#include <msp/gl/camera.h>
#include <msp/gl/font.h>
#include <msp/gl/technique.h>
#include <msp/gl/text.h>
+#include "resources.h"
class LaunchScreen
{
Msp::GL::Camera camera;
public:
- LaunchScreen(Msp::DataFile::Collection &);
+ LaunchScreen(Resources &);
void set_countdown(unsigned);
using namespace std;
using namespace Msp;
-Resources::Resources(const string &pack_name)
+Resources::Resources(const string &pack_name):
+ ui_font(0),
+ ui_text_technique(0)
{
set_default_texture_anisotropy(8);
set_srgb_conversion(true);
add_source(pack_source);
}
}
+
+const GL::Font &Resources::get_ui_font() const
+{
+ if(!ui_font)
+ throw runtime_error("no ui font");
+ return *ui_font;
+}
+
+const GL::Technique &Resources::get_ui_text_technique() const
+{
+ if(!ui_text_technique)
+ throw runtime_error("no ui text technique");
+ return *ui_text_technique;
+}
+
+void Resources::set_ui_text_resources(const string &font, const string &tech)
+{
+ ui_font = &get<GL::Font>(font);
+ ui_text_technique = &get<GL::Technique>(tech);
+}
#include <msp/datafile/directorysource.h>
#include <msp/datafile/packsource.h>
+#include <msp/gl/font.h>
#include <msp/gl/resources.h>
+#include <msp/gl/technique.h>
class Resources: public Msp::GL::Resources
{
Msp::DataFile::DirectorySource dir_source;
Msp::DataFile::PackSource pack_source;
+ const Msp::GL::Font *ui_font;
+ const Msp::GL::Technique *ui_text_technique;
+
public:
Resources(const std::string &);
+
+ const Msp::GL::Font &get_ui_font() const;
+ const Msp::GL::Technique &get_ui_text_technique() const;
+ void set_ui_text_resources(const std::string &, const std::string &);
};
#endif