1 /* 2 * This file is part of EasyRPG Player. 3 * 4 * EasyRPG Player is free software: you can redistribute it and/or modify 5 * it under the terms of the GNU General Public License as published by 6 * the Free Software Foundation, either version 3 of the License, or 7 * (at your option) any later version. 8 * 9 * EasyRPG Player is distributed in the hope that it will be useful, 10 * but WITHOUT ANY WARRANTY; without even the implied warranty of 11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 * GNU General Public License for more details. 13 * 14 * You should have received a copy of the GNU General Public License 15 * along with EasyRPG Player. If not, see <http://www.gnu.org/licenses/>. 16 */ 17 18 #ifndef EP_BACKGROUND_H 19 #define EP_BACKGROUND_H 20 21 // Headers 22 #include <string> 23 #include "system.h" 24 #include "drawable.h" 25 #include "async_handler.h" 26 #include "tone.h" 27 28 class Background : public Drawable { 29 public: 30 Background(const std::string& name); 31 Background(int terrain_id); 32 33 void Draw(Bitmap& dst) override; 34 void Update(); 35 Tone GetTone() const; 36 void SetTone(Tone tone); 37 38 private: 39 static void Update(int& rate, int& value); 40 static int Scale(int x); 41 42 void OnBackgroundGraphicReady(FileRequestResult* result); 43 void OnForegroundFrameGraphicReady(FileRequestResult* result); 44 45 Tone tone_effect; 46 Tone current_tone; 47 BitmapRef bg_bitmap; 48 int bg_hscroll = 0; 49 int bg_vscroll = 0; 50 int bg_x = 0; 51 int bg_y = 0; 52 BitmapRef fg_bitmap; 53 int fg_hscroll = 0; 54 int fg_vscroll = 0; 55 int fg_x = 0; 56 int fg_y = 0; 57 58 FileRequestBinding request_id; 59 }; 60 GetTone()61inline Tone Background::GetTone() const { 62 return tone_effect; 63 } 64 SetTone(Tone tone)65inline void Background::SetTone(Tone tone) { 66 tone_effect = tone; 67 } 68 69 #endif 70