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
1899da11 sago007 2015-12-30 19:04 4
Copyright (C) 2005-2015 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
1029dfed Poul Sander 2019-03-13 17:22 20
https://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
5d601060 Poul Sander 2023-10-26 21:00 25
#define SCOPEHELPERS_HPP
9b99cf7a sago007 2015-12-04 20:22 26
078900fe sago007 2015-12-05 15:31 27
#include "common.h"
078900fe sago007 2015-12-05 15:31 28
078900fe sago007 2015-12-05 15:31 29
078900fe sago007 2015-12-05 15:31 30
class SDL_RendererHolder {
078900fe sago007 2015-12-05 15:31 31
	SDL_Renderer* ptr;
9b99cf7a sago007 2015-12-04 20:22 32
public:
1d2a7a1a sago007 2018-03-24 17:52 33
	explicit SDL_RendererHolder(SDL_Renderer* input) {
078900fe sago007 2015-12-05 15:31 34
		dieOnNullptr(input, "Failed to get render");
078900fe sago007 2015-12-05 15:31 35
		ptr = input;
9b99cf7a sago007 2015-12-04 20:22 36
	}
5d601060 Poul Sander 2023-10-26 21:00 37
078900fe sago007 2015-12-05 15:31 38
	~SDL_RendererHolder() {
078900fe sago007 2015-12-05 15:31 39
		SDL_DestroyRenderer(ptr);
9b99cf7a sago007 2015-12-04 20:22 40
	}
9b99cf7a sago007 2015-12-04 20:22 41
};
9b99cf7a sago007 2015-12-04 20:22 42
53203200 sago007 2015-12-25 13:30 43
class SDL_TextInput {
53203200 sago007 2015-12-25 13:30 44
public:
53203200 sago007 2015-12-25 13:30 45
	SDL_TextInput() {
53203200 sago007 2015-12-25 13:30 46
		SDL_StartTextInput();
53203200 sago007 2015-12-25 13:30 47
	}
5d601060 Poul Sander 2023-10-26 21:00 48
53203200 sago007 2015-12-25 13:30 49
	~SDL_TextInput() {
53203200 sago007 2015-12-25 13:30 50
		SDL_StopTextInput();
53203200 sago007 2015-12-25 13:30 51
	}
53203200 sago007 2015-12-25 13:30 52
};
53203200 sago007 2015-12-25 13:30 53
5d601060 Poul Sander 2023-10-26 21:00 54
#endif  /* SCOPEHELPERS_HPP */
9b99cf7a sago007 2015-12-04 20:22 55
1970-01-01 00:00 56