00001
00002
00003
00004
00005
00006
00007
00009
00016 #include "utils.h"
00017 #include <iostream>
00018 #include "pause.h"
00019 #include "audio.h"
00020 #include "video.h"
00021 #include "input.h"
00022 #include "system.h"
00023
00024 using namespace std;
00025 using namespace hoa_audio;
00026 using namespace hoa_video;
00027 using namespace hoa_mode_manager;
00028 using namespace hoa_input;
00029 using namespace hoa_system;
00030
00031 namespace hoa_pause {
00032
00033 bool PAUSE_DEBUG = false;
00034
00035
00036 PauseMode::PauseMode() {
00037 if (PAUSE_DEBUG) cout << "PAUSE: PauseMode constructor invoked" << endl;
00038
00039 mode_type = MODE_MANAGER_PAUSE_MODE;
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057 if (!VideoManager->CaptureScreen(_saved_screen))
00058 if (PAUSE_DEBUG) cerr << "PAUSE: ERROR: Couldn't save the screen!" << endl;
00059 }
00060
00061
00062
00063
00064 PauseMode::~PauseMode() {
00065 if (PAUSE_DEBUG) cout << "PAUSE: PauseMode destructor invoked" << endl;
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083 VideoManager->DeleteImage(_saved_screen);
00084 }
00085
00086
00087
00088 void PauseMode::Reset() {
00089
00090 VideoManager->SetCoordSys(0, 1024, 0, 768);
00091 if(!VideoManager->SetFont("default"))
00092 cerr << "MAP: ERROR > Couldn't set map font!" << endl;
00093 VideoManager->SetDrawFlags(VIDEO_X_LEFT, VIDEO_Y_BOTTOM, 0);
00094 }
00095
00096
00097
00098 void PauseMode::Update() {
00099
00100 SDL_Delay(50);
00101 }
00102
00103
00104
00105
00106 void PauseMode::Draw() {
00107
00108
00109 int32 width = VideoManager->GetWidth();
00110 int32 height = VideoManager->GetHeight();
00111 VideoManager->SetCoordSys (0.0f, static_cast<float>(width), 0.0f, static_cast<float>(height));
00112
00113 Color grayed(0.35f, 0.35f, 0.35f, 1.0f);
00114 VideoManager->SetDrawFlags(VIDEO_X_LEFT, 0);
00115 VideoManager->Move(0,0);
00116 VideoManager->DrawImage(_saved_screen, grayed);
00117
00118
00119
00120 VideoManager->SetCoordSys (0.0f, 1024.0f, 0.0f, 768.0f);
00121
00122 VideoManager->SetDrawFlags(VIDEO_X_CENTER, 0);
00123 VideoManager->Move(512, 384);
00124 VideoManager->DrawText("Paused");
00125 }
00126
00127 }