Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Moved the Message Window class into its own source files.
- Loading branch information
Yohann Ferreira
committed
Apr 8, 2014
1 parent
3f8b665
commit 2b0f118
Showing
9 changed files
with
147 additions
and
88 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2004-2011 by The Allacrost Project | ||
// Copyright (C) 2012-2014 by Bertram (Valyria Tear) | ||
// All Rights Reserved | ||
// | ||
// This code is licensed under the GNU GPL version 2. It is free software | ||
// and you may modify it and/or redistribute it under the terms of this license. | ||
// See http://www.gnu.org/copyleft/gpl.html for details. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** **************************************************************************** | ||
*** \file message_window.cpp | ||
*** \author Daniel Steuernol steu@allacrost.org | ||
*** \author Andy Gardner chopperdave@allacrost.org | ||
*** \author Nik Nadig (IkarusDowned) nihonnik@gmail.com | ||
*** \author Yohann Ferreira, yohann ferreira orange fr | ||
*** \brief Source file for a common message window. | ||
*** ***************************************************************************/ | ||
|
||
#include "utils/utils_pch.h" | ||
#include "message_window.h" | ||
|
||
#include "engine/video/video.h" | ||
|
||
namespace vt_common | ||
{ | ||
|
||
MessageWindow::MessageWindow(const vt_utils::ustring& message, float w, float h) | ||
{ | ||
float start_x = (1024 - w) / 2; | ||
float start_y = (768 - h) / 2; | ||
|
||
MenuWindow::Create(w, h); | ||
MenuWindow::SetPosition(start_x, start_y); | ||
MenuWindow::Show(); | ||
|
||
_textbox.SetPosition(30, 5); | ||
_textbox.SetDimensions(w, h); | ||
_textbox.SetTextStyle(vt_video::TextStyle("text22")); | ||
_textbox.SetDisplayMode(vt_gui::VIDEO_TEXT_INSTANT); | ||
_textbox.SetTextAlignment(vt_video::VIDEO_X_LEFT, vt_video::VIDEO_Y_CENTER); | ||
_textbox.SetDisplayText(message); | ||
_textbox.SetOwner(this); | ||
} | ||
|
||
MessageWindow::~MessageWindow() | ||
{ | ||
MenuWindow::Destroy(); | ||
} | ||
|
||
void MessageWindow::Draw() | ||
{ | ||
MenuWindow::Draw(); | ||
_textbox.Draw(); | ||
} | ||
|
||
} // namespace vt_common |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
/////////////////////////////////////////////////////////////////////////////// | ||
// Copyright (C) 2004-2011 by The Allacrost Project | ||
// Copyright (C) 2012-2014 by Bertram (Valyria Tear) | ||
// All Rights Reserved | ||
// | ||
// This code is licensed under the GNU GPL version 2. It is free software | ||
// and you may modify it and/or redistribute it under the terms of this license. | ||
// See http://www.gnu.org/copyleft/gpl.html for details. | ||
/////////////////////////////////////////////////////////////////////////////// | ||
|
||
/** **************************************************************************** | ||
*** \file message_window.h | ||
*** \author Daniel Steuernol steu@allacrost.org | ||
*** \author Andy Gardner chopperdave@allacrost.org | ||
*** \author Nik Nadig (IkarusDowned) nihonnik@gmail.com | ||
*** \author Yohann Ferreira, yohann ferreira orange fr | ||
*** \brief Header file for a common message window. | ||
*** ***************************************************************************/ | ||
|
||
#ifndef __MESSAGE_WINDOW_HEADER__ | ||
#define __MESSAGE_WINDOW_HEADER__ | ||
|
||
#include "common/gui/menu_window.h" | ||
|
||
#include "common/gui/textbox.h" | ||
|
||
namespace vt_common | ||
{ | ||
|
||
/** ************************************************************************** | ||
*** \brief A window to display a message to the player | ||
*** Displays a message to the user in the center of the screen | ||
*** This class is not private because it's a handy message box and | ||
*** it could be used else where. | ||
*** **************************************************************************/ | ||
class MessageWindow : public vt_gui::MenuWindow | ||
{ | ||
public: | ||
MessageWindow(const vt_utils::ustring& message, float w, float h); | ||
~MessageWindow(); | ||
|
||
//! \brief Set the text to display in the window | ||
void SetText(const vt_utils::ustring& message) { | ||
_textbox.SetDisplayText(message); | ||
} | ||
|
||
//! \brief Standard Window Functions | ||
//@{ | ||
void Draw(); | ||
//@} | ||
|
||
private: | ||
//! \brief used to display the message | ||
vt_gui::TextBox _textbox; | ||
}; // class MessageWindow | ||
|
||
} // namespace vt_common | ||
|
||
#endif // __MESSAGE_WINDOW_HEADER__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters