git repos / blockattack-game

blame: source/code/scopeHelpers.hpp

normal view · raw

9b99cf7a sago007 2015-12-04 20:22 1
/*
9b99cf7a sago007 2015-12-04 20:22 2
===========================================================================
9b99cf7a sago007 2015-12-04 20:22 3
blockattack - Block Attack - Rise of the Blocks
9b99cf7a sago007 2015-12-04 20:22 4
Copyright (C) 2005-2012 Poul Sander
9b99cf7a sago007 2015-12-04 20:22 5
9b99cf7a sago007 2015-12-04 20:22 6
This program is free software: you can redistribute it and/or modify
9b99cf7a sago007 2015-12-04 20:22 7
it under the terms of the GNU General Public License as published by
9b99cf7a sago007 2015-12-04 20:22 8
the Free Software Foundation, either version 2 of the License, or
9b99cf7a sago007 2015-12-04 20:22 9
(at your option) any later version.
9b99cf7a sago007 2015-12-04 20:22 10
9b99cf7a sago007 2015-12-04 20:22 11
This program is distributed in the hope that it will be useful,
9b99cf7a sago007 2015-12-04 20:22 12
but WITHOUT ANY WARRANTY; without even the implied warranty of
9b99cf7a sago007 2015-12-04 20:22 13
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
9b99cf7a sago007 2015-12-04 20:22 14
GNU General Public License for more details.
9b99cf7a sago007 2015-12-04 20:22 15
9b99cf7a sago007 2015-12-04 20:22 16
You should have received a copy of the GNU General Public License
9b99cf7a sago007 2015-12-04 20:22 17
along with this program.  If not, see http://www.gnu.org/licenses/
9b99cf7a sago007 2015-12-04 20:22 18
9b99cf7a sago007 2015-12-04 20:22 19
Source information and contacts persons can be found at
9b99cf7a sago007 2015-12-04 20:22 20
http://www.blockattack.net
9b99cf7a sago007 2015-12-04 20:22 21
===========================================================================
9b99cf7a sago007 2015-12-04 20:22 22
*/
9b99cf7a sago007 2015-12-04 20:22 23
9b99cf7a sago007 2015-12-04 20:22 24
#ifndef SCOPEHELPERS_HPP
9b99cf7a sago007 2015-12-04 20:22 25
#define	SCOPEHELPERS_HPP
9b99cf7a sago007 2015-12-04 20:22 26
9b99cf7a sago007 2015-12-04 20:22 27
class SDLUnicodeScope {
9b99cf7a sago007 2015-12-04 20:22 28
private:
9b99cf7a sago007 2015-12-04 20:22 29
	int oldStatus;
9b99cf7a sago007 2015-12-04 20:22 30
public:
9b99cf7a sago007 2015-12-04 20:22 31
	SDLUnicodeScope() {
9b99cf7a sago007 2015-12-04 20:22 32
		oldStatus = SDL_EnableUNICODE(1);
9b99cf7a sago007 2015-12-04 20:22 33
	}
9b99cf7a sago007 2015-12-04 20:22 34
	
9b99cf7a sago007 2015-12-04 20:22 35
	void Release() {
9b99cf7a sago007 2015-12-04 20:22 36
		SDL_EnableUNICODE(oldStatus);
9b99cf7a sago007 2015-12-04 20:22 37
	}
9b99cf7a sago007 2015-12-04 20:22 38
	
9b99cf7a sago007 2015-12-04 20:22 39
	~SDLUnicodeScope() {
9b99cf7a sago007 2015-12-04 20:22 40
		Release();
9b99cf7a sago007 2015-12-04 20:22 41
	}
9b99cf7a sago007 2015-12-04 20:22 42
};
9b99cf7a sago007 2015-12-04 20:22 43
9b99cf7a sago007 2015-12-04 20:22 44
#endif	/* SCOPEHELPERS_HPP */
9b99cf7a sago007 2015-12-04 20:22 45
1970-01-01 00:00 46