git repos / blockattack-game

blame: source/code/ShowFileState.hpp

normal view · raw

b7550ffe sago007 2018-05-19 10:08 1
/*
b7550ffe sago007 2018-05-19 10:08 2
===========================================================================
b7550ffe sago007 2018-05-19 10:08 3
blockattack - Block Attack - Rise of the Blocks
b7550ffe sago007 2018-05-19 10:08 4
Copyright (C) 2005-2018 Poul Sander
b7550ffe sago007 2018-05-19 10:08 5
This program is free software: you can redistribute it and/or modify
b7550ffe sago007 2018-05-19 10:08 6
it under the terms of the GNU General Public License as published by
b7550ffe sago007 2018-05-19 10:08 7
the Free Software Foundation, either version 2 of the License, or
b7550ffe sago007 2018-05-19 10:08 8
(at your option) any later version.
b7550ffe sago007 2018-05-19 10:08 9
This program is distributed in the hope that it will be useful,
b7550ffe sago007 2018-05-19 10:08 10
but WITHOUT ANY WARRANTY; without even the implied warranty of
b7550ffe sago007 2018-05-19 10:08 11
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
b7550ffe sago007 2018-05-19 10:08 12
GNU General Public License for more details.
b7550ffe sago007 2018-05-19 10:08 13
You should have received a copy of the GNU General Public License
b7550ffe sago007 2018-05-19 10:08 14
along with this program.  If not, see http://www.gnu.org/licenses/
b7550ffe sago007 2018-05-19 10:08 15
Source information and contacts persons can be found at
b7550ffe sago007 2018-05-19 10:08 16
https://blockattack.net
b7550ffe sago007 2018-05-19 10:08 17
===========================================================================
b7550ffe sago007 2018-05-19 10:08 18
*/
b7550ffe sago007 2018-05-19 10:08 19
b7550ffe sago007 2018-05-19 10:08 20
#ifndef SHOWFILESTATE_HPP
b7550ffe sago007 2018-05-19 10:08 21
#define SHOWFILESTATE_HPP
b7550ffe sago007 2018-05-19 10:08 22
b7550ffe sago007 2018-05-19 10:08 23
b7550ffe sago007 2018-05-19 10:08 24
#include "sago/GameStateInterface.hpp"
c2086a7e sago007 2018-05-19 14:16 25
#include "sago/SagoTextField.hpp"
c2086a7e sago007 2018-05-19 14:16 26
#include "sago/SagoTextBox.hpp"
c2086a7e sago007 2018-05-19 14:16 27
#include "sago/SagoMisc.hpp"
0471a1d3 sago007 2018-05-19 10:26 28
#include <string>
c2086a7e sago007 2018-05-19 14:16 29
#include "common.h"
b7550ffe sago007 2018-05-19 10:08 30
b7550ffe sago007 2018-05-19 10:08 31
class ShowFileState : public sago::GameStateInterface {
b7550ffe sago007 2018-05-19 10:08 32
public:
b7550ffe sago007 2018-05-19 10:08 33
	ShowFileState();
b7550ffe sago007 2018-05-19 10:08 34
	ShowFileState(const ShowFileState& orig) = delete;
b7550ffe sago007 2018-05-19 10:08 35
	virtual ~ShowFileState();
b7550ffe sago007 2018-05-19 10:08 36
	
b7550ffe sago007 2018-05-19 10:08 37
	bool IsActive() override;
b7550ffe sago007 2018-05-19 10:08 38
	void Draw(SDL_Renderer* target) override;
b7550ffe sago007 2018-05-19 10:08 39
	void ProcessInput(const SDL_Event& event, bool &processed) override;
b7550ffe sago007 2018-05-19 10:08 40
	void Update() override;
b7550ffe sago007 2018-05-19 10:08 41
0471a1d3 sago007 2018-05-19 10:26 42
	void SetData(const std::string& filename, const std::string& header) {
c2086a7e sago007 2018-05-19 14:16 43
		titleField.SetText(header);
c2086a7e sago007 2018-05-19 14:16 44
		infoBox.SetText(sago::GetFileContent(filename));
c71c4346 sago007 2018-05-19 16:30 45
		filenameField.SetText(SPrintStringF(_("Showing content of: %s"), filename.c_str()));
0471a1d3 sago007 2018-05-19 10:26 46
	}
0471a1d3 sago007 2018-05-19 10:26 47
	
b7550ffe sago007 2018-05-19 10:08 48
private:
b7550ffe sago007 2018-05-19 10:08 49
	bool isActive = true;
b7550ffe sago007 2018-05-19 10:08 50
	bool bMouseUp = true;
c2086a7e sago007 2018-05-19 14:16 51
	sago::SagoTextField titleField;
c2086a7e sago007 2018-05-19 14:16 52
	sago::SagoTextBox filenameField;
c2086a7e sago007 2018-05-19 14:16 53
	sago::SagoTextBox infoBox;
b7550ffe sago007 2018-05-19 10:08 54
};
b7550ffe sago007 2018-05-19 10:08 55
b7550ffe sago007 2018-05-19 10:08 56
#endif /* SHOWFILESTATE_HPP */
b7550ffe sago007 2018-05-19 10:08 57
1970-01-01 00:00 58