Divide Framework 0.1
A free and open-source 3D Framework under heavy development
Loading...
Searching...
No Matches
GameScript.h
Go to the documentation of this file.
1/*
2Copyright (c) 2018 DIVIDE-Studio
3Copyright (c) 2009 Ionut Cava
4
5This file is part of DIVIDE Framework.
6
7Permission is hereby granted, free of charge, to any person obtaining a copy
8of this software
9and associated documentation files (the "Software"), to deal in the Software
10without restriction,
11including without limitation the rights to use, copy, modify, merge, publish,
12distribute, sublicense,
13and/or sell copies of the Software, and to permit persons to whom the
14Software is furnished to do so,
15subject to the following conditions:
16
17The above copyright notice and this permission notice shall be included in
18all copies or substantial portions of the Software.
19
20THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21IMPLIED,
22INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
23PARTICULAR PURPOSE AND NONINFRINGEMENT.
24IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM,
25DAMAGES OR OTHER LIABILITY,
26WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR
27IN CONNECTION WITH THE SOFTWARE
28OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
29
30*/
31
32#pragma once
33#ifndef DVD_SCRIPTING_GAME_SCRIPT_H_
34#define DVD_SCRIPTING_GAME_SCRIPT_H_
35
38
39namespace Divide {
41public:
42 void frameStarted() {}
46 void frameEnded() {}
47};
48
49 class GameScript final : public Script,
50 public FrameListener {
51 public:
52 explicit GameScript(const string& sourceCode, FrameListenerManager& parent, U32 callOrder);
53 explicit GameScript(const string& scriptPath, FileType fileType, FrameListenerManager& parent, U32 callOrder);
54
55 protected:
56 bool frameStarted(const FrameEvent& evt) override;
57 bool framePreRender(const FrameEvent& evt) override;
58 bool frameRenderingQueued(const FrameEvent& evt) override;
59 bool framePostRender(const FrameEvent& evt) override;
60 bool frameEnded(const FrameEvent& evt) override;
61
62 private:
63 void addGameInstance() const;
64};
65
66} //namespace Divide
67
68#endif //DVD_SCRIPTING_GAME_SCRIPT_H_
bool framePostRender(const FrameEvent &evt) override
Definition: GameScript.cpp:58
bool frameEnded(const FrameEvent &evt) override
frameEnded is called after the buffers have been swapped
Definition: GameScript.cpp:63
bool frameStarted(const FrameEvent &evt) override
Definition: GameScript.cpp:46
bool framePreRender(const FrameEvent &evt) override
framePreRenderStarted is called when we need to start processing the visual aspect of a scene
Definition: GameScript.cpp:50
void addGameInstance() const
Definition: GameScript.cpp:26
bool frameRenderingQueued(const FrameEvent &evt) override
Definition: GameScript.cpp:54
Handle console commands that start with a forward slash.
Definition: AIProcessor.cpp:7
Project & parent
Definition: DefaultScene.h:41
uint32_t U32