Created
May 24, 2021 22:20
-
-
Save germandiagogomez/cf50439d1267c94bf66d200bd9dce107 to your computer and use it in GitHub Desktop.
Exposing C++ code to ChaiScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// C++ code | |
ChaiScript chai; | |
chai.add(user_type<IBasicGameView>(), "IBasicGameView"). | |
add(user_type<IGameMatchView>(), "IGameMatchView"). | |
add(user_type<IGameMatchView::Player>(), "IGameMatch_Player"). | |
add(user_type<OnlineRoomsView::MatchRoom>(), "OnlineRoomsView_MatchRoom"). | |
add(user_type<Guinyote::RuntimeConfig>(), "RuntimeConfig"); | |
// Support inheritance: | |
chai.add(base_class<IBasicGameView, IGameMatchView>()); | |
chai.add(base_class<IGameMatchView, GameMatchView>()); | |
chai.add(base_class<IBasicGameView, GameMenuView>()); | |
chai.add(base_class<IBasicGameView, OnlineRoomsView>()); | |
//Register global constants | |
chai.add_global_const(const_var(IGameMatchView::Player::LeftPlayer), "LeftPlayer") | |
.add_global_const(const_var(IGameMatchView::Player::FrontPlayer), "FrontPlayer") | |
.add_global_const(const_var(IGameMatchView::Player::RightPlayer), "RightPlayer") | |
.add_global_const(const_var(IGameMatchView::Player::BottomPlayer),"BottomPlayer"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment