Skip to content
This repository has been archived by the owner on May 7, 2018. It is now read-only.

Commit

Permalink
Add stub for PhoneModeReceivingMail and cleanup some phone code
Browse files Browse the repository at this point in the history
  • Loading branch information
krofna committed Jul 27, 2014
1 parent f1e0209 commit bfe7623
Show file tree
Hide file tree
Showing 14 changed files with 97 additions and 35 deletions.
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ add_executable(steins-gate
src/phonemodedefaultoperatable.cpp
src/phonemodemailmenu.cpp
src/phonemodesendmailedit.cpp
src/phonemodereceivingmail.cpp
src/phonesd.cpp
src/sginterpreter.cpp
src/steinsgate.cpp
Expand Down
4 changes: 3 additions & 1 deletion src/phone.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
#include "phonemodedefaultoperatable.hpp"
#include "phonemodeaddressbook.hpp"
#include "phonemodemailmenu.hpp"
#include "phonemodereceivingmail.hpp"
#include "phonesd.hpp"
#include <SFML/Graphics/Texture.hpp>

Expand Down Expand Up @@ -90,6 +91,7 @@ pMode(nullptr)
PhoneModes[MODE_DEFAULT_OPERATABLE] = new PhoneModeDefaultOperatable(this);
PhoneModes[MODE_ADDRESS_BOOK] = new PhoneModeAddressBook(this);
PhoneModes[MODE_SEND_MAIL_EDIT] = new PhoneModeSendMailEdit(this);
PhoneModes[MODE_RECEIVING_MAIL] = new PhoneModeReceivingMail(this);
pSD = new PhoneSD();
}

Expand Down Expand Up @@ -129,7 +131,7 @@ void Phone::Draw(sf::RenderWindow* pWindow)
DrawableBase::Draw(pWindow);
if (State == PHONE_OPEN)
{
if (Mode != MODE_POWER_OFF)
if (Mode != MODE_POWER_OFF && Mode != MODE_RECEIVING_MAIL)
{
pWindow->draw(Wallpaper);
pWindow->draw(Header);
Expand Down
5 changes: 5 additions & 0 deletions src/phone.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#ifndef PHONE_HPP
#define PHONE_HPP

#include "text.hpp"
#include <SFML/Graphics/Sprite.hpp>
#include <string>
Expand Down Expand Up @@ -149,3 +152,5 @@ class Phone : public DrawableBase
PhoneMode* PhoneModes[MODE_INVALID];
PhoneSD* pSD;
};

#endif
10 changes: 3 additions & 7 deletions src/phonemode.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,7 @@
#ifndef PHONE_MODE_HPP
#define PHONE_MODE_HPP

#include <SFML/System/Vector2.hpp>
#include <cstdint>

namespace sf { class RenderWindow; }
class Phone;
#include "phone.hpp"

class PhoneMode
{
Expand All @@ -34,8 +30,8 @@ class PhoneMode
virtual void OnOpen(uint8_t OldMode) = 0;
virtual void Draw(sf::RenderWindow* pWindow) = 0;
virtual void MouseMoved(sf::Vector2i Pos) = 0;
virtual uint8_t LeftMouseClicked() = 0;
virtual uint8_t RightMouseClicked() = 0;
virtual uint8_t LeftMouseClicked() { return MODE_INVALID; }
virtual uint8_t RightMouseClicked() { return MODE_INVALID; }

Phone* pPhone; // TODO: static?
};
Expand Down
1 change: 0 additions & 1 deletion src/phonemodeaddressbook.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#include "phonemodeaddressbook.hpp"
#include "phone.hpp"
#include "sgexe.hpp"
#include <SFML/Window/Mouse.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
Expand Down
2 changes: 0 additions & 2 deletions src/phonemodeaddressbook.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@
#define PHONE_MODE_ADDRESS_BOOK_HPP

#include "phonemode.hpp"
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Text.hpp>
#include <list>

class Phone;
Expand Down
1 change: 0 additions & 1 deletion src/phonemodedefaultoperatable.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#include "phonemodedefaultoperatable.hpp"
#include "phone.hpp"
#include "sgexe.hpp"
#include <SFML/Window/Mouse.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
Expand Down
1 change: 0 additions & 1 deletion src/phonemodedefaultoperatable.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#define PHONE_MODE_DEFAULT_OPERATABLE_HPP

#include "phonemode.hpp"
#include <SFML/Graphics/Sprite.hpp>

class Phone;

Expand Down
6 changes: 0 additions & 6 deletions src/phonemodemailmenu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#include "phonemodemailmenu.hpp"
#include "phone.hpp"
#include <SFML/Window/Mouse.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
#include <cstring>
Expand Down Expand Up @@ -81,11 +80,6 @@ void PhoneModeMailMenu::MouseMoved(sf::Vector2i Pos)
}
}

uint8_t PhoneModeMailMenu::LeftMouseClicked()
{
return MODE_INVALID;
}

uint8_t PhoneModeMailMenu::RightMouseClicked()
{
return MODE_DEFAULT_OPERATABLE;
Expand Down
2 changes: 0 additions & 2 deletions src/phonemodemailmenu.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@

#include "phonemode.hpp"
#include <SFML/Graphics/Text.hpp>
#include <SFML/Graphics/Sprite.hpp>

class Phone;

Expand All @@ -33,7 +32,6 @@ class PhoneModeMailMenu : PhoneMode
virtual void OnOpen(uint8_t OldMode);
virtual void Draw(sf::RenderWindow* pWindow);
virtual void MouseMoved(sf::Vector2i Pos);
virtual uint8_t LeftMouseClicked();
virtual uint8_t RightMouseClicked();

private:
Expand Down
44 changes: 44 additions & 0 deletions src/phonemodereceivingmail.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* steins-gate: Open source implementation of Steins;Gate Visual Novel
* Copyright (C) 2014 Mislav Blažević <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#include "phonemodereceivingmail.hpp"
#include <SFML/Graphics/RenderWindow.hpp>

PhoneModeReceivingMail::PhoneModeReceivingMail(Phone* pPhone) : PhoneMode(pPhone)
{
}

PhoneModeReceivingMail::~PhoneModeReceivingMail()
{
}

void PhoneModeReceivingMail::OnOpen(uint8_t OldMode)
{
}

void PhoneModeReceivingMail::Draw(sf::RenderWindow* pWindow)
{
for (int i = 0; i < 2; ++i)
{
pWindow->draw(HDots[i]);
pWindow->draw(VDots[i]);
}
}

void PhoneModeReceivingMail::MouseMoved(sf::Vector2i Pos)
{
}
41 changes: 41 additions & 0 deletions src/phonemodereceivingmail.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* steins-gate: Open source implementation of Steins;Gate Visual Novel
* Copyright (C) 2014 Mislav Blažević <[email protected]>
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#ifndef PHONE_MODE_RECEIVING_MAIL_HPP
#define PHONE_MODE_RECEIVING_MAIL_HPP

#include "phonemode.hpp"

class Phone;

class PhoneModeReceivingMail : PhoneMode
{
friend class Phone;
protected:
PhoneModeReceivingMail(Phone* pPhone);
~PhoneModeReceivingMail();

virtual void OnOpen(uint8_t OldMode);
virtual void Draw(sf::RenderWindow* pWindow);
virtual void MouseMoved(sf::Vector2i Pos);

private:
sf::Sprite HDots[2];
sf::Sprite VDots[2];
};

#endif
11 changes: 0 additions & 11 deletions src/phonemodesendmailedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@
* along with this program. If not, see <http://www.gnu.org/licenses/>.
* */
#include "phonemodesendmailedit.hpp"
#include "phone.hpp"
#include "sgexe.hpp"
#include <SFML/Graphics/RenderWindow.hpp>

Expand Down Expand Up @@ -61,16 +60,6 @@ void PhoneModeSendMailEdit::MouseMoved(sf::Vector2i Pos)
{
}

uint8_t PhoneModeSendMailEdit::LeftMouseClicked()
{
return MODE_INVALID;
}

uint8_t PhoneModeSendMailEdit::RightMouseClicked()
{
return MODE_INVALID;
}

void PhoneModeSendMailEdit::SetText(const string& Subject, const string& Sender, string Body)
{
// Fuwanovel has '\n' characters in exe
Expand Down
3 changes: 0 additions & 3 deletions src/phonemodesendmailedit.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
#define PHONE_MODE_SEND_MAIL_EDIT_HPP

#include "phonemode.hpp"
#include <SFML/Graphics/Sprite.hpp>
#include <SFML/Graphics/Text.hpp>
using std::string;

Expand All @@ -35,8 +34,6 @@ class PhoneModeSendMailEdit : PhoneMode
virtual void OnOpen(uint8_t OldMode);
virtual void Draw(sf::RenderWindow* pWindow);
virtual void MouseMoved(sf::Vector2i Pos);
virtual uint8_t LeftMouseClicked();
virtual uint8_t RightMouseClicked();

void SetText(const string& Subject, const string& Sender, string Body);
private:
Expand Down

0 comments on commit bfe7623

Please sign in to comment.