git repos / blockattack-game

blame: source/code/ReadKeyboard.h

normal view · raw

89c4a3a6 sago007 2008-08-29 14:32 1
/*
c53e6443 sago007 2012-04-17 11:04 2
===========================================================================
c53e6443 sago007 2012-04-17 11:04 3
blockattack - Block Attack - Rise of the Blocks
c53e6443 sago007 2012-04-17 11:04 4
Copyright (C) 2005-2012 Poul Sander
c53e6443 sago007 2012-04-17 11:04 5
c53e6443 sago007 2012-04-17 11:04 6
This program is free software: you can redistribute it and/or modify
c53e6443 sago007 2012-04-17 11:04 7
it under the terms of the GNU General Public License as published by
c53e6443 sago007 2012-04-17 11:04 8
the Free Software Foundation, either version 2 of the License, or
c53e6443 sago007 2012-04-17 11:04 9
(at your option) any later version.
c53e6443 sago007 2012-04-17 11:04 10
c53e6443 sago007 2012-04-17 11:04 11
This program is distributed in the hope that it will be useful,
c53e6443 sago007 2012-04-17 11:04 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
c53e6443 sago007 2012-04-17 11:04 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
c53e6443 sago007 2012-04-17 11:04 14
GNU General Public License for more details.
c53e6443 sago007 2012-04-17 11:04 15
c53e6443 sago007 2012-04-17 11:04 16
You should have received a copy of the GNU General Public License
c53e6443 sago007 2012-04-17 11:04 17
along with this program.  If not, see http://www.gnu.org/licenses/
c53e6443 sago007 2012-04-17 11:04 18
c53e6443 sago007 2012-04-17 11:04 19
Source information and contacts persons can be found at
021de090 sago007 2015-12-30 18:56 20
http://blockattack.net
c53e6443 sago007 2012-04-17 11:04 21
===========================================================================
89c4a3a6 sago007 2008-08-29 14:32 22
*/
89c4a3a6 sago007 2008-08-29 14:32 23
89c4a3a6 sago007 2008-08-29 14:32 24
/*
89c4a3a6 sago007 2008-08-29 14:32 25
Added to project 5/11-2004
89c4a3a6 sago007 2008-08-29 14:32 26
*/
89c4a3a6 sago007 2008-08-29 14:32 27
59dcb571 sago007 2016-02-14 15:34 28
#ifndef READKEYBOARD_HPP
59dcb571 sago007 2016-02-14 15:34 29
#define READKEYBOARD_HPP
59dcb571 sago007 2016-02-14 15:34 30
89c4a3a6 sago007 2008-08-29 14:32 31
#include "SDL.h"
f6707482 sago007 2015-12-04 22:55 32
#include <string>
89c4a3a6 sago007 2008-08-29 14:32 33
89c4a3a6 sago007 2008-08-29 14:32 34
class ReadKeyboard
89c4a3a6 sago007 2008-08-29 14:32 35
{
89c4a3a6 sago007 2008-08-29 14:32 36
private:
8ff26872 sago007 2016-03-25 09:46 37
	int maxLength = 0;
d26562ba sago007 2015-12-04 23:29 38
	std::string::iterator position;
f6707482 sago007 2015-12-04 22:55 39
	std::string text_string;
c53e6443 sago007 2012-04-17 11:04 40
	void removeChar();
89c4a3a6 sago007 2008-08-29 14:32 41
public:
c53e6443 sago007 2012-04-17 11:04 42
	ReadKeyboard(void);
c53e6443 sago007 2012-04-17 11:04 43
	~ReadKeyboard(void);
80b830cd sago007 2012-08-19 17:51 44
	ReadKeyboard(const char*);
0e1e83de sago007 2015-12-25 13:30 45
	int CharsBeforeCursor(); //Where should the cursor be placed?
afe1bac4 Poul Sander 2020-05-24 18:34 46
	void putchar(const std::string& );
078900fe sago007 2015-12-05 15:31 47
	bool ReadKey(const SDL_Event&);
078900fe sago007 2015-12-05 15:31 48
	bool ReadKey(SDL_Keycode); //true if key accepted
0e1e83de sago007 2015-12-25 13:30 49
	const std::string& GetString(void) const;
89c4a3a6 sago007 2008-08-29 14:32 50
};
59dcb571 sago007 2016-02-14 15:34 51
59dcb571 sago007 2016-02-14 15:34 52
#endif //READKEYBOARD_HPP