1 // ==============================================================
2 //	This file is part of Glest (www.glest.org)
3 //
4 //	Copyright (C) 2001-2008 Marti�o Figueroa
5 //
6 //	You can redistribute this code and/or modify it under
7 //	the terms of the GNU General Public License as published
8 //	by the Free Software Foundation; either version 2 of the
9 //	License, or (at your option) any later version
10 // ==============================================================
11 
12 #ifndef _GLEST_GAME_COREDATA_H_
13 #define _GLEST_GAME_COREDATA_H_
14 
15 #include <string>
16 
17 #include "sound.h"
18 #include "font.h"
19 #include "texture.h"
20 #include "sound_container.h"
21 
22 namespace Glest{ namespace Game{
23 
24 using Shared::Graphics::Texture2D;
25 using Shared::Graphics::Texture3D;
26 using Shared::Graphics::Font2D;
27 using Shared::Sound::StrSound;
28 using Shared::Sound::StaticSound;
29 
30 // =====================================================
31 // 	class CoreData
32 //
33 /// Data shared ammont all the ProgramStates
34 // =====================================================
35 
36 class CoreData{
37 private:
38     StrSound introMusic;
39     StrSound menuMusic;
40 	StaticSound clickSoundA;
41     StaticSound clickSoundB;
42     StaticSound clickSoundC;
43 	SoundContainer waterSounds;
44 
45 	Texture2D *logoTexture;
46     Texture2D *backgroundTexture;
47     Texture2D *fireTexture;
48     Texture2D *snowTexture;
49 	Texture2D *waterSplashTexture;
50     Texture2D *customTexture;
51 	Texture2D *buttonSmallTexture;
52 	Texture2D *buttonBigTexture;
53 
54     Font2D *displayFont;
55 	Font2D *menuFontNormal;
56 	Font2D *menuFontSmall;
57 	Font2D *menuFontBig;
58 	Font2D *menuFontVeryBig;
59 	Font2D *consoleFont;
60 
61 public:
62 	static CoreData &getInstance();
63 	~CoreData();
64 
65     void load();
66 
getBackgroundTexture()67 	Texture2D *getBackgroundTexture() const		{return backgroundTexture;}
getFireTexture()68 	Texture2D *getFireTexture() const			{return fireTexture;}
getSnowTexture()69 	Texture2D *getSnowTexture() const			{return snowTexture;}
getLogoTexture()70 	Texture2D *getLogoTexture() const			{return logoTexture;}
getWaterSplashTexture()71 	Texture2D *getWaterSplashTexture() const	{return waterSplashTexture;}
getCustomTexture()72 	Texture2D *getCustomTexture() const			{return customTexture;}
getButtonSmallTexture()73 	Texture2D *getButtonSmallTexture() const	{return buttonSmallTexture;}
getButtonBigTexture()74 	Texture2D *getButtonBigTexture() const		{return buttonBigTexture;}
75 
getIntroMusic()76 	StrSound *getIntroMusic() 				{return &introMusic;}
getMenuMusic()77 	StrSound *getMenuMusic() 				{return &menuMusic;}
getClickSoundA()78     StaticSound *getClickSoundA()			{return &clickSoundA;}
getClickSoundB()79     StaticSound *getClickSoundB()			{return &clickSoundB;}
getClickSoundC()80     StaticSound *getClickSoundC()			{return &clickSoundC;}
getWaterSound()81 	StaticSound *getWaterSound()			{return waterSounds.getRandSound();}
82 
getDisplayFont()83 	Font2D *getDisplayFont() const			{return displayFont;}
getMenuFontSmall()84     Font2D *getMenuFontSmall() const		{return menuFontSmall;}
getMenuFontNormal()85     Font2D *getMenuFontNormal() const		{return menuFontNormal;}
getMenuFontBig()86     Font2D *getMenuFontBig() const			{return menuFontBig;}
getMenuFontVeryBig()87 	Font2D *getMenuFontVeryBig() const		{return menuFontVeryBig;}
getConsoleFont()88     Font2D *getConsoleFont() const			{return consoleFont;}
89 
90 private:
CoreData()91 	CoreData(){};
92 
93 	int computeFontSize(int size);
94 };
95 
96 }} //end namespace
97 
98 #endif
99