Otclient
14/8/2020
graphicalapplication.h
Go to the documentation of this file.
1
/*
2
* Copyright (c) 2010-2020 OTClient <https://github.com/edubart/otclient>
3
*
4
* Permission is hereby granted, free of charge, to any person obtaining a copy
5
* of this software and associated documentation files (the "Software"), to deal
6
* in the Software without restriction, including without limitation the rights
7
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
* copies of the Software, and to permit persons to whom the Software is
9
* furnished to do so, subject to the following conditions:
10
*
11
* The above copyright notice and this permission notice shall be included in
12
* all copies or substantial portions of the Software.
13
*
14
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20
* THE SOFTWARE.
21
*/
22
23
24
#ifndef GRAPHICALAPPLICATION_H
25
#define GRAPHICALAPPLICATION_H
26
27
#include "
application.h
"
28
#include <
framework/graphics/declarations.h
>
29
#include <
framework/core/inputevent.h
>
30
31
class
GraphicalApplication
:
public
Application
32
{
33
enum
{
34
POLL_CYCLE_DELAY = 10
35
};
36
37
public
:
38
void
init
(std::vector<std::string>& args);
39
void
deinit
();
40
void
terminate
();
41
void
run
();
42
void
poll
();
43
void
close
();
44
45
bool
willRepaint
() {
return
m_mustRepaint; }
46
void
repaint
() { m_mustRepaint =
true
; }
47
48
void
setForegroundPaneMaxFps
(
int
maxFps) { m_foregroundFrameCounter.
setMaxFps
(maxFps); }
49
void
setBackgroundPaneMaxFps
(
int
maxFps) { m_backgroundFrameCounter.
setMaxFps
(maxFps); }
50
51
int
getForegroundPaneFps
() {
return
m_foregroundFrameCounter.
getLastFps
(); }
52
int
getBackgroundPaneFps
() {
return
m_backgroundFrameCounter.
getLastFps
(); }
53
int
getForegroundPaneMaxFps
() {
return
m_foregroundFrameCounter.
getMaxFps
(); }
54
int
getBackgroundPaneMaxFps
() {
return
m_backgroundFrameCounter.
getMaxFps
(); }
55
56
bool
isOnInputEvent
() {
return
m_onInputEvent; }
57
58
protected
:
59
void
resize
(
const
Size
& size);
60
void
inputEvent
(
const
InputEvent
& event);
61
62
private
:
63
stdext::boolean<false>
m_onInputEvent;
64
stdext::boolean<false>
m_mustRepaint;
65
AdaptativeFrameCounter
m_backgroundFrameCounter;
66
AdaptativeFrameCounter
m_foregroundFrameCounter;
67
TexturePtr
m_foreground;
68
};
69
70
extern
GraphicalApplication
g_app
;
71
72
#endif
GraphicalApplication
Definition:
graphicalapplication.h:31
AdaptativeFrameCounter::getMaxFps
int getMaxFps()
Definition:
adaptativeframecounter.h:54
GraphicalApplication::run
void run()
Definition:
graphicalapplication.cpp:104
GraphicalApplication::close
void close()
Definition:
graphicalapplication.cpp:220
inputevent.h
GraphicalApplication::getBackgroundPaneMaxFps
int getBackgroundPaneMaxFps()
Definition:
graphicalapplication.h:54
stdext::boolean< false >
g_app
GraphicalApplication g_app
Definition:
consoleapplication.cpp:32
AdaptativeFrameCounter
Definition:
adaptativeframecounter.h:34
GraphicalApplication::terminate
void terminate()
Definition:
graphicalapplication.cpp:77
GraphicalApplication::willRepaint
bool willRepaint()
Definition:
graphicalapplication.h:45
InputEvent
Definition:
inputevent.h:28
GraphicalApplication::setBackgroundPaneMaxFps
void setBackgroundPaneMaxFps(int maxFps)
Definition:
graphicalapplication.h:49
GraphicalApplication::setForegroundPaneMaxFps
void setForegroundPaneMaxFps(int maxFps)
Definition:
graphicalapplication.h:48
GraphicalApplication::init
void init(std::vector< std::string > &args)
Definition:
graphicalapplication.cpp:41
AdaptativeFrameCounter::setMaxFps
void setMaxFps(int maxFps)
Definition:
adaptativeframecounter.cpp:90
AdaptativeFrameCounter::getLastFps
int getLastFps()
Definition:
adaptativeframecounter.h:52
GraphicalApplication::resize
void resize(const Size &size)
Definition:
graphicalapplication.cpp:227
GraphicalApplication::isOnInputEvent
bool isOnInputEvent()
Definition:
graphicalapplication.h:56
GraphicalApplication::deinit
void deinit()
Definition:
graphicalapplication.cpp:69
GraphicalApplication::repaint
void repaint()
Definition:
graphicalapplication.h:46
GraphicalApplication::getForegroundPaneMaxFps
int getForegroundPaneMaxFps()
Definition:
graphicalapplication.h:53
Application
Definition:
application.h:30
declarations.h
stdext::shared_object_ptr< Texture >
GraphicalApplication::getBackgroundPaneFps
int getBackgroundPaneFps()
Definition:
graphicalapplication.h:52
GraphicalApplication::poll
void poll()
Definition:
graphicalapplication.cpp:206
GraphicalApplication::inputEvent
void inputEvent(const InputEvent &event)
Definition:
graphicalapplication.cpp:241
GraphicalApplication::getForegroundPaneFps
int getForegroundPaneFps()
Definition:
graphicalapplication.h:51
TSize< int >
application.h
src
framework
core
graphicalapplication.h
Generated by
1.8.17
For more information visit
https://forum.opentibia.dev/