Hello
I'm having trouble with classes. Basically I want ExistenceClientMainLogin(etc) to have access to ExistenceClinet functions and variables, both read and write.
I tried ineheritance but when the function was instantiated create it built ExistenceeApp clasds and up. Basically destroying or overwritting the base class. I'm assuming copied a new set of information losing context.
I tried friendhship keywords but confused a little of setting it up. Do anyone have a example based on this allowing access.
Vivienne
class ExistenceClient : public ExistenceApp
{
OBJECT(ExistenceClient);
public:
/// Construct.
ExistenceClient(Context* context);
virtual ~ExistenceClient();
/// Setup after engine initialization and before running the main loop.
virtual void Start();
/// Return XML patch instructions for screen joystick layout for a specific sample app, if any.
https://github.com/urho3d/Urho3D/tree/master/Source/Samples
virtual String GetScreenJoystickPatchString() const
{
return
"<patch>"
" <add sel=\"/element/element[./attribute[@name='Name' and @value='Hat0']]\">"
" <attribute name=\"Is Visible\" value=\"false\" />"
" </add>"
"</patch>";
}
void Init(Context * context);
/// Diaplay login screen
void SetupScreenViewport(void);
void SetupScreenUI(void);
/// Subscribe to application-wide logic update events.
void SubscribeToEvents();
/// Handle the logic update event.
void HandleUpdate(StringHash eventType, VariantMap& eventData);
/// Events Keyboard
void HandleKeyDown(StringHash eventType, VariantMap& eventData);
void HandleInput(const String& input);
void eraseScene(void);
void AddLogoViewport(void);
int CreateCursor(void);
void MoveCamera(float timeStep);
void Print(const String& output);
void HandlePostUpdates(StringHash eventType, VariantMap& eventData);
/// Render related functions
int LoadCharacterMesh(int mode, String nodename, unsigned int alienrace, unsigned int gender);
int loadplayerMesh(Node * playermeshNode, int alienrace, int gender,int mode);
/// File related functions
void LoadAccount(void);
void SaveAccount(accountinformation account);
void SavePlayer(bool activeplayer);
int LoadAccountPlayers(void);
int LoadPlayer(int player) ;
int LoadTemporaryPlayer(int player);
int GenerateSceneLoadDifferential(const char *filename=NULL);
int LoadEnvironmentSettings(const char *environment);
/// Console related functions
void InitializeConsole(void);
void HandleConsoleCommand(StringHash eventType, VariantMap& eventData);
int ConsoleActionEnvironment(const char * lineinput);
int ConsoleActionCamera(const char * lineinput);
int ConsoleActionDebug(const char * lineinput);
int ConsoleActionCharacter(const char * lineinput);
int ConsoleActionRenderer(const char * lineinput);
int ConsoleActionBuild(const char * lineinput);
/// UI Related Functions
void loadSceneUI(void);
bool loadHUDFile(const char * filename, const int positionx, const int positiony);
void loadUIXMLClosePressed(StringHash eventType, VariantMap& eventData);
bool loadUIXML(int windowtype, const int positionx, const int positiony, int selected);
void QuickMenuPressed(StringHash eventType, VariantMap& eventData);
void UpdateUI(float timestep);
void PlayerWindowUpdateUI(int selected);
void PlayerWindowHandleDisplaySelection(StringHash eventType, VariantMap& eventData);
int UpdateUISceneLoader(void);
void UpdatePlayerInfoBar(void);
void SceneLoaderHanderPress(StringHash eventType, VariantMap& eventData);
int GenerateSceneUpdateEnvironment(terrain_rule terrainrule);
/// Temporary online
bool IsClientConnected(void);
bool ClientConnect(void);
bool SetServerSettings(void);
/// Get subsubsystems
Renderer * GetRenderSubsystems(void) const;
UI * GetUISubsystems(void) const;
Graphics * GetGraphicsSubsystems(void) const;
ResourceCache * GetResourceCacheSubsystems(void) const;
Window * GetSharedWindow(void) const;
int GetTestString(void)
{
return testvalue;
}
friend class ExistenceClientStateMainScreen;
protected:
/// Urho3D window shared pointers
SharedPtr<Window> window_;
SharedPtr<Window> window2_;
/// Urho3D UIelement root, viewport, and render path
SharedPtr<UIElement> uiRoot_;
SharedPtr<Viewport> viewport;
SharedPtr<RenderPath> effectRenderPath;
/// Urho3D Shared pointer for input
SharedPtr<Input> input_;
/// Existence Weak pointer for a single character
WeakPtr<Character> character_;
/// Existence player structure class and variable declation for character/player related information
Player TemporaryPlayer;
Player * TemporaryAccountPlayerList;
unsigned int TemporaryAccountPlayerSelected;
unsigned int TemporaryAccountPlayerListLimit;
http://www.themonitor.com/news/local/spacex-requests-more-wetlands-covered-for-rocket-launch-site-public/article_6dfe84de-0de6-11e5-a61d-930f216a22ef.html
/// Existence class and variable declaration for alien race alliance information
vector<string> aliensarray;
vector<string> tempaliensarray;
/// This is temoporarily the necessary code
bool accountexist;
/// Server connection related
bool ServerConnection;
int testvalue;
private:
};
class ExistenceClient;
/// Login State
class ExistenceClientStateSingleton : public LogicComponent
{
OBJECT(ExistenceClientStateSingleton);
public:
ExistenceClientStateSingleton(Context * context);
virtual ~ExistenceClientStateSingleton();
virtual void Enter();
virtual void Exit();
virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
private:
void Singleton(void);
protected:
};
/// Login State
class ExistenceClientStateLogin : public ExistenceClientStateSingleton
{
OBJECT(ExistenceClientStateLogin);
public:
ExistenceClientStateLogin(Context * context);
virtual ~ExistenceClientStateLogin();
virtual void Enter();
virtual void Exit();
virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
private:
void LoginScreen(void);
void LoginScreenUI(void);
void LoginScreenUINewAccountHandleClosePressed(StringHash eventType, VariantMap& eventData);
void LoginScreenUILoginHandleClosePressed(StringHash eventType, VariantMap& eventData);
protected:
};
/// Main Screen State
class ExistenceClientStateMainScreen: public ExistenceClientStateSingleton
{
OBJECT(ExistenceClientStateMainScreen);
public:
ExistenceClientStateMainScreen(Context * context);
virtual ~ExistenceClientStateMainScreen();
virtual void Enter();
virtual void Exit();
virtual void OnUpdate(Urho3D::StringHash eventType, Urho3D::VariantMap& eventData );
private:
void MainScreen(void);
void MainScreenUI(void);
void MainScreenUIHandleClosePressed(StringHash eventType, VariantMap& eventData);
void HandleCharacterStartButtonReleased(StringHash eventType, VariantMap& eventData);
void HandleCharacterSelectedReleased(StringHash eventType, VariantMap& eventData);
void HandleCharacterSelectedInfoButtonReleased(StringHash eventType, VariantMap& eventData);
protected:
};