Welcome, Guest. Please login or register. Did you miss your activation email?

Author Topic: Static Window? "static sf::Window renderWindow;"  (Read 29224 times)

0 Members and 2 Guests are viewing this topic.

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #30 on: October 28, 2012, 12:36:13 am »

Also not sure if I'm right but this is my

WindowManagment.cpp
#include "stdafx.h"
#include "WindowManagment.h"
#include "Genesis.h"

/**
Launches the render window.
*/

sf::RenderWindow& WindowManager::LaunchRenderWindow()
{
        Genesis genesis;
        if(genesis.Windowed)
        {
                create(sf::VideoMode(genesis.WindowX,genesis.WindowY,32),"Genesis");
        }else{
                short int X;
                short int Y;
                GetDesktopResolution(X,Y);
                create(sf::VideoMode(X,Y,32),"Genesis",sf::Style::Fullscreen);
        }
        return * this;
}
/**
Detects desktop resolution and adjusts the X and Y variables accordingly.
*/

void WindowManager::GetDesktopResolution(short int&X,short int&Y)
{
        RECT desktop;
        const HWND hDesktop = GetDesktopWindow();
        GetWindowRect(hDesktop, &desktop);
    X = desktop.right;
    Y = desktop.bottom;
}
/**
Recieves a true or false and enables/disables vertical sync accordingly.
*/

void WindowManager::SetVerticalSync(bool a)
{
        if(a)
                setVerticalSyncEnabled(true);
        else
                setVerticalSyncEnabled(false);
}
/**
Recieves a true or false and enables/disables showing the mouse curser.
*/

void WindowManager::ShowCourser(bool a)
{
        if(a)
                setMouseCursorVisible(true);
        else
                setMouseCursorVisible(false);
}
/**
Recieves a short int and sets the framerate limit to it. Must be between 15 - 60,
*/

void WindowManager::SetFramerateLimit(short int a)
{
        if(a>60) a=60;
        if(a<15) a=15;

        setFramerateLimit(a);
}
 

and this is it's header
#ifndef WINDOWMANAGER_H
#define WINDOWMANAGER_H
#include "stdafx.h"
class WindowManager : sf::RenderWindow{

public:
        sf::RenderWindow& LaunchRenderWindow();
        sf::RenderWindow& GetRenderWindow();

        void SetResolution(short int x,short int y);
        void SetFullscreen(bool a);
        void SetVerticalSync(bool a);
        void ShowCourser(bool a);
    void SetFramerateLimit(short int a);

private:
        void GetDesktopResolution(short int&X,short int&Y);

};
#endif
 

But when I try to launch a window with:

        WindowManager windowManager;
        sf::RenderWindow & renderWindow = windowManager.LaunchRenderWindow();
 

from my Genesis.cpp, I get the following:

Quote
Error   14   error LNK1120: 2 unresolved externals   C:\Users\Travis\Documents\Visual Studio 2012\Projects\Genesis\Debug\Genesis.exe   Genesis
Error   13   error LNK2019: unresolved external symbol __imp__sscanf referenced in function _jinit_memory_mgr   C:\Users\Travis\Documents\Visual Studio 2012\Projects\Genesis\Genesis\sfml-graphics-s-d.lib(jmemmgr.obj)   Genesis
Error   12   error LNK2019: unresolved external symbol __imp__fprintf referenced in function _output_message   C:\Users\Travis\Documents\Visual Studio 2012\Projects\Genesis\Genesis\sfml-graphics-s-d.lib(jerror.obj)   Genesis

....Not sure what I did wrong...

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #31 on: October 28, 2012, 12:47:02 am »
Quote
Also, do... I really have to make a object of Genesis while in Genesis.cpp? That seems kinda... odd. xD Or do I only have to make a object in the "main" and then run something like genesis.Initialize(); ?
What does seem 'odd'?

Oh it's ok, I think I figured out a lot of it. XD But now I'm stuck on that unresolved external symbol error, and have no idea whats causing it. >_< 

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #32 on: October 28, 2012, 01:08:56 am »
Did you recompile sfml yourself? Did you try linking to dynamic libraries, (get the dlls to your directory and remove -s from names in linker settings). I never ran into that error.
Back to C++ gamedev with SFML in May 2023

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #33 on: October 28, 2012, 01:28:47 am »
Did you recompile sfml yourself? Did you try linking to dynamic libraries, (get the dlls to your directory and remove -s from names in linker settings). I never ran into that error.

I did compile SFML myself with CMake and Visual Studio 2012.

Oddly enough, I get no error if I use regular sf::Window. But then again, that doesn't really "work"
 It does open a window, but the window is not on the screen anywhere and you cant ever see it. >_> Perhaps something in the code is not right? Maybe Its being deleted or something? Idk I'm just coming up with ideas.

Hm.... I'll go dig out the dynamic libraries and see what happens.....

So it compiles with the non static libraries. o.O; So why wont the static libraries work. ???

Also, my window isn't there. I see it in the task bar, but it never actually pops up, well, at least I never actually see it. I still am not sure why this works only with the dynamic libraries...... >_> Or why my window doesn't actually work, work. Hmm Any ideas for testing out and finding why? I'm all ears. :)

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #34 on: October 28, 2012, 01:35:04 am »
Please read the documentation of sfml and tutorials before use..
to display a window you have to call display() on it(very unintuitive, I know..)
Back to C++ gamedev with SFML in May 2023

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #35 on: October 28, 2012, 02:06:26 am »
Please read the documentation of sfml and tutorials before use..
to display a window you have to call display() on it(very unintuitive, I know..)

Mhm I even tried:

        WindowManager windowManager;
        sf::RenderWindow& renderWindow = windowManager.LaunchRenderWindow();

        while(!isClosing())
        {
                renderWindow.display();
        }
 

No visible window. It opens, but nothing is actually there, no window. I see it in the task bar, that's all.

I still am also concerned as to why the static libraries don't work. I think whatever caused those libraries not to work, and my window to glitch out, is related.

I've started to trace the cause of the static library error so far if I remove

WindowManager windowManager;
 

I can compile without error. I cant open a window mind you, but I can compile without error.

Also I found that if I don't remove the code, but empty out the WindowManager class completely, I still get the error.

The error is that

WindowManager windowManager;
 
Is making a new object of a "sf::RenderWindow" "because WindowManager was declared with " : sf::Renderwindow"" and that is whats throwing the error.  Now the question, ....why is it throwing the error? *goes back to digging through code*

So I still don't know why but I've found that it IS the combination of

class WindowManager : sf::RenderWindow

and

WindowManager windowManager;

If I change either of them the problem goes away. But that doesnt actually fix the problem. hmm..

Please tell me if I'm wrong but if I remember right the sf::RenderWindow is non copyable and wouldn't turning it into a object.....be making a copy of it since that object is "glued" to the sf::RenderWindow?

It may also be worth mentioning that sf::Window also does the same thing, and doesn't actually show up when Display is called. "Thats right sf::window doesn't throw the error :D .....still doesn't work, but it doesnt throw a error with the static libraries, but I still am clueless as to why my window wont show...."
« Last Edit: October 28, 2012, 02:27:44 am by Flash619 »

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #36 on: October 28, 2012, 02:35:00 am »
If you are having that much trouble due to trying to make a static window class handle everything when you don't have a good understanding on how to use the window normally then start with some basic window handling and then move on to your fancy class, wrappers around that kind of stuff tend to be very tricky to use (I am making an openGL with shaders wrapper that is taking far longer than I thought it would take)...

Not to mention that using a window in SFML is quite easy, you just need to know it's correct syntax and it should go smooth.
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #37 on: October 28, 2012, 02:59:51 am »
If you are having that much trouble due to trying to make a static window class handle everything when you don't have a good understanding on how to use the window normally then start with some basic window handling and then move on to your fancy class, wrappers around that kind of stuff tend to be very tricky to use (I am making an openGL with shaders wrapper that is taking far longer than I thought it would take)...

Not to mention that using a window in SFML is quite easy, you just need to know it's correct syntax and it should go smooth.

But this should work the way I have it setup though. *also the window class is not static, I went away from static stuff because it seemed unstable. ;)

In  fact. I'll try making a quickie window in the main class.

*5min later*

As I thought, normally it works just fine...

So It would appear my issue is the way in which I'm referencing from my WindowManager class..... but I took 70% of that code directly from a working example I made a few months back >_< Anything you see that looks kinda wrong, or "ify" ? To me it seems like the window may be being created, but immediately destroyed when it leaves that class. But if I make it static ..... *sigh

masskiller

  • Sr. Member
  • ****
  • Posts: 284
  • Pointers to Functions rock!
    • MSN Messenger - kyogre_jb@hotmail.com
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #38 on: October 28, 2012, 03:24:23 pm »
Quote
So It would appear my issue is the way in which I'm referencing from my WindowManager class..... but I took 70% of that code directly from a working example I made a few months back >_< Anything you see that looks kinda wrong, or "ify" ? To me it seems like the window may be being created, but immediately destroyed when it leaves that class. But if I make it static ..... *sigh

So you actually made it work in the past, but now it doesn't work?
Programmer, Artist, Composer and Storyline/Script Writer of "Origin of Magic". If all goes well this could turn into a commercial project!

Finally back into the programming world!

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #39 on: October 28, 2012, 03:31:53 pm »
Quote
So It would appear my issue is the way in which I'm referencing from my WindowManager class..... but I took 70% of that code directly from a working example I made a few months back >_< Anything you see that looks kinda wrong, or "ify" ? To me it seems like the window may be being created, but immediately destroyed when it leaves that class. But if I make it static ..... *sigh

So you actually made it work in the past, but now it doesn't work?

Well yea, only this time I inherited the whole WindowManager with sf::Window.

So I wouldn't have to use references when making the window, to make the window I could just use:

eWindow.Launch();

Which uses

//Header file
#ifndef WINDOWMANAGER_H
#define WINDOWMANAGER_H
#include "stdafx.h"
class EngineWindow : public sf::Window
{
public:
        void Launch();
};
#endif

//Class File
void EngineWindow::Launch()
{
        Log consoleLog;
        consoleLog.info("Launching Window...");
        Genesis genesis;
        if(genesis.Windowed)
        {
                create(sf::VideoMode(genesis.WindowX,genesis.WindowY,32),"Genesis");
        }else{
                short int X;
                short int Y;
                GetDesktopResolution(X,Y);
                create(sf::VideoMode(X,Y,32),"Genesis",sf::Style::Fullscreen);
        }
}
 

Inside the EngineWindow class *I renamed WindowManager to EngineWindow*

Then display it with:

       
while(true)
        {
        eWindow.display();
        }

But it never displayed because I think its being de allocated and destroyed for whatever reason, its not persisting. :/ I mean, what I have should work, shouldn't it?

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #40 on: October 28, 2012, 04:49:30 pm »
And now I'm back to the

Quote
First-chance exception at 0x776AF592 (ntdll.dll) in Genesis.exe: 0xC0000005: Access violation writing location 0x00000004.
The program '[8284] Genesis.exe' has exited with code 0 (0x0).

Error. I even reverted back ALL of my code to when it at least started up this morning, and I STILL have that error after undoing everything. So it should work, everything should work, but it doesn't. Amd oh, I'm sure it will probably work with the dynamic libraries, but I want to know why the static ones throw such a fit over everything when they were working two hours ago.

Oh, and ONCE again, the error is caused by making my WindowManager into a object like:

WindowManager windowManager;

and BAM exception.

This to me indicates for whatever reason:

class EngineWindow : public sf::Window

Does not want to be made into a object, specifically the " : public sf::Window" part.

Ok and now, figure out why this works.

        EngineWindow eWindow;
        eWindow.Launch();
 

I literally deleted, the re wrote that code, and now it works. I still don't have a window, but it doesn't throw an error.

HAHAHAha

And now visual studio is telling me

Quote
Error   1   error LNK1168: cannot open C:\Users\Travis\documents\visual studio 2012\Projects\Genesis\Debug\Genesis.exe for writing   C:\Users\Travis\documents\visual studio 2012\Projects\Genesis\Genesis\LINK   Genesis

Now I just tried it again *after getting that error 5 times in a row* and it worked without me changing anything.

Any ideas on that one? Or on just how unstable everything is all together?

ALSO, I am having an issue. I can define "Genesis::Windowed=false;" and everything in the Genesis class will read it as false "most of the time" but all other classes that make it a object read it as true. ???
« Last Edit: October 28, 2012, 05:01:04 pm by Flash619 »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #41 on: October 28, 2012, 05:02:27 pm »
That error means that you have your app open.
We can't know why things are unstable because you post one hundredth of your code every time..
Back to C++ gamedev with SFML in May 2023

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #42 on: October 28, 2012, 05:19:22 pm »
That error means that you have your app open.
We can't know why things are unstable because you post one hundredth of your code every time..

Ok, Here is some code. :P *you could have asked for more....*

I got my window working.

Turns out that the value wasn't being carried between objects for

   
 bool Windowed; //Located in Genesis.h

So I changed it to:

   
 static bool Windowed; //Located in Genesis.h

and it worked but now I have a issue........ it launches in fullscreen........... all of the time. XD

Though, I would love to have a second person look at some of this code. >.>

WindowManagment.h
#ifndef WINDOWMANAGER_H
#define WINDOWMANAGER_H
#include "stdafx.h"
class EngineWindow : public sf::Window
{
public:
        void Launch();
        sf::Window& GetRenderWindow();

        void SetResolution(short int x,short int y);
        void SetFullscreen(bool a);
        void SetVerticalSync(bool a);
        void ShowCourser(bool a);
    void SetFramerateLimit(short int a);

private:
        void GetDesktopResolution(short int&X,short int&Y);
       
};
#endif
 

WindowManagment.cpp

#include "stdafx.h"
#include "WindowManagment.h"
#include "Genesis.h"
#include "ConsoleUtils.h"
/**
Launches the render window.
*/

void EngineWindow::Launch()
{
        Log consoleLog;
        consoleLog.info("Launching Window...");
        Genesis genesis;
        if(genesis.Windowed)
        {
                consoleLog.info("Windowed Mode Detected");
                create(sf::VideoMode(genesis.WindowX,genesis.WindowY,32),"Genesis");
        }else{
                consoleLog.info("Going Fullscreen");
                short int X;
                short int Y;
                GetDesktopResolution(X,Y);
                create(sf::VideoMode(X,Y,32),"Genesis",sf::Style::Fullscreen);
        }
}
/**
Detects desktop resolution and adjusts the X and Y variables accordingly.
*/

void EngineWindow::GetDesktopResolution(short int&X,short int&Y)
{
        RECT desktop;
        const HWND hDesktop = GetDesktopWindow();
        GetWindowRect(hDesktop, &desktop);
    X = desktop.right;
    Y = desktop.bottom;
}
/**
Recieves a true or false and enables/disables vertical sync accordingly.
*/

void EngineWindow::SetVerticalSync(bool a)
{
        if(a)
                setVerticalSyncEnabled(true);
        else
                setVerticalSyncEnabled(false);
}
/**
Recieves a true or false and enables/disables showing the mouse curser.
*/

void EngineWindow::ShowCourser(bool a)
{
        if(a)
                setMouseCursorVisible(true);
        else
                setMouseCursorVisible(false);
}
/**
Recieves a short int and sets the framerate limit to it. Must be between 15 - 60,
*/

void EngineWindow::SetFramerateLimit(short int a)
{
        if(a>60) a=60;
        if(a<15) a=15;

        setFramerateLimit(a);
}
 

Genesis.h
#ifndef GENESIS_H
#define GENESIS_H
#include <string>
class Genesis{

public:
        //Command Line Arguments
         std::string flags;
         static bool SkipSplash;
         static bool Windowed;
         static bool Debug;
         static bool NoConsoleTags;
         bool WaitBeforeExit;

        short int WindowX;
        short int WindowY;

        //Core Engine States
        enum CoreEngineState{Initializing,ShowingSplash,ShowingMenuScreen,Playing,Reloading,Closing};
         CoreEngineState engineCoreState;

    //Public Functions
        void Initialize(int argc,char *argv[]);
    void ArgumentHandler(int argsl,char *args[]);

    std::string GetVersion(void);
        bool isClosing();

private:
        void ValidateFlags();
        void ClassDistributor();
};
#endif
 

Genesis.cpp
/*
Genesis and its resources are copyright of PredawnStudios LLC (C)2012 PredawnStudios.
SFML - Copyright (c) 2007-2008 Laurent Gomila
*/


// Genesis.cpp : main project file.

#include "stdafx.h"
#include "Genesis.h"
#include "ConsoleUtils.h"
#include "WindowManagment.h"

using namespace std;

//Make used objects
Font font;
Log ConsoleLog;
Validate validate;

bool Genesis::Windowed;
bool Genesis::SkipSplash;
bool Genesis::Debug;
bool Genesis::NoConsoleTags;

//Declaring our version.
const std::string GenesisVersion = "2.0.0 Pre Alpha";

/**
The main will recieve our command line arguments and bee the starting point for
the engine.
*/

int main(int argc,char *argv[])
{
        Genesis::CoreEngineState engineCoreState = Genesis::Initializing;

        const int argcc = argc;
        Genesis genesis;

        genesis.Initialize(argc,argv);
    return 0;
}
/**
This function will be our main tree for controling core engine specific paths.
*/

void Genesis::Initialize(int argc,char *argv[])
{
        //Print Genesis Command Line Header And Version
        cout << "  @@@@@@@  @@@@@@@@ @@@  @@@ @@@@@@@@  @@@@@@ @@@  @@@@@@" << endl;
        cout << " !@@       @@!      @@!@!@@@ @@!      !@@     @@! !@@    " << endl;
        cout << " !@! @!@!@ @!!!:!   @!@@!!@! @!!!:!    !@@!!  !!@  !@@!! " << endl;
        cout << " :!!   !!: !!:      !!:  !!! !!:          !:! !!:     !:!" << endl;
        cout << "  :: :: :  : :: ::: ::    :  : :: ::: ::.: :  :   ::.: : " << endl;
        cout << endl;
        font.set_color(15);
    cout <<"Version " << Genesis::GetVersion() << endl;
    font.set_color(7);
        cout << endl;
        //End Header

        //Set Flag Defaults
        Genesis::SkipSplash=false;
        Genesis::Windowed=false;
        Genesis::Debug=false;
        Genesis::NoConsoleTags=false;
        Genesis::WaitBeforeExit=false;

        short int WindowX=0;
        short int WindowY=0;

       
        if(argc>=2)
        {
                ConsoleLog.info("Command Line Arguments Detected...");
                Genesis::ArgumentHandler(argc,argv);           
        }else{
                ConsoleLog.info("No arguments found. Launching engine.");
        }

        //Validate Command Line Flags
        ValidateFlags();

        //We will make a render window but not automatically display it.
        ConsoleLog.info("Initializing Window System");
        EngineWindow eWindow;
        eWindow.Launch();

        //Ask for input so they can see what all occured if flag -wait set.
        if(Genesis::WaitBeforeExit)
        {
                cout << "Press enter to close..." << endl;
                cin.get();
        }
}
void Genesis::ClassDistributor()
{
        /*switch(CoreEngineState){
        case Genesis::Initializing:
                Genesis::CoreEngineState = Genesis::ShowingSplash;
                break;
        };*/

}
/**
Argument Handler will recieve the arguments all at once, and flip the proper
switches based on the argument. It also returns false if the argument was not
found in its database.
@arg int The Ammount of arguments being recieved.
@arg char* The array of arguments to be recieved.
*/

void Genesis::ArgumentHandler(int argsl,char *args[])
{
        for(int i=1;i<argsl;i++)
        {
                int j = 0;
                bool ProperArgument=false;
                std::string arg = args[i];

                std::string at = "Attempting to parse: \"" + arg + "\"";
                ConsoleLog.info(at);

                if(arg=="-SI")
                {
                        Genesis::SkipSplash = true;
                        ProperArgument = true;
                }
                if(arg=="-WM")
                {
                        Genesis::Windowed = true;
                        ProperArgument = true;
                }
                if(arg=="-DB")
                {
                        Genesis::Debug = true;
                        ProperArgument = true;
                }
                if(arg=="-nct")
                {
                        Genesis::NoConsoleTags = true;
                        ProperArgument = true;
                }
                if(arg=="-wait")
                {
                        Genesis::WaitBeforeExit = true;
                        ProperArgument = true;
                }
                if(arg=="-X")
                {
                        j = i;
                        j++;
                        if(validate.Digits(args[j]))
                        {
                                std::string k = args[j];
                                Genesis::WindowX = atoi(k.c_str());
                                ProperArgument = true;
                                i=j;
                                std::string m = "Windows \"-X\" value set to: " + k;
                                ConsoleLog.info(m);
                        }else{
                                ConsoleLog.error("Inproper argument for -X only INT is allowed!");
                                Genesis::WindowX = 0;
                                ProperArgument = false;
                                i=j;
                        }
                }
                if(arg=="-Y")
                {
                        j = i;
                        j++;
                        if(validate.Digits(args[j]))
                        {
                                std::string k = args[j];
                                Genesis::WindowY = atoi(k.c_str());
                                ProperArgument = true;
                                i=j;
                                std::string m = "Windows \"-Y\" value set to: " + k;
                                ConsoleLog.info(m);
                        }else{
                                ConsoleLog.error("Inproper argument for -Y only INT is allowed!");
                                Genesis::WindowY = 0;
                                ProperArgument = false;
                                i=j;
                        }
                }
                if(ProperArgument==true){
                        std::string a = "Succesfully Recognized: \""+arg+"\"";
                        ConsoleLog.info(a);
                }else{
                        std::string b = "Succesfully Recognized: "+arg;
                        ConsoleLog.error("Not a valid argument! \""+arg+"\"");
                }
        }

}
/**
If flags are dependant on other flags, checks should be added here!
*/

void Genesis::ValidateFlags()
{
        if((Genesis::WindowX > 0 && Genesis::WindowY <= 0) || (Genesis::WindowY > 0 && Genesis::WindowX <= 0)) //Checks to make sure both X and Y are correct.
        {
                ConsoleLog.error("\"-X\" and \"-Y\" must be used at the same time, have a value greater than 0, and be proper integers!");
                ConsoleLog.error("\"-X\" and \"-Y\" will be ignored.");
                if(Windowed)
                {
                        ConsoleLog.error("\"-WM\" Was dected but due to argument errors will be disabled.");
                        Windowed = false;
                }
        }
        if((Genesis::WindowX>0)&&(Genesis::WindowY>0)&&(Genesis::Windowed=false)) //Makes sure that windowed mode is enabled when X and Y are correct.
        {
                ConsoleLog.error("\"-X\" and \"-Y\" were declared but windowed mode was never set! Did you forget a \"-WM\" ?");
                ConsoleLog.error("\"-X\" and \"-Y\" will be ignored.");
        }
}
/**
Returns the defined version of Genesis running.
*/

std::string Genesis::GetVersion()
{
        return GenesisVersion;
}
bool Genesis::isClosing()
{
        if(Genesis::engineCoreState==Closing)
                return true;
        else
                return false;
}
 

There, that should be enough code for a while. ^^

Let me know your input tho. I want to do things PROPERLY. XD If someone seems very wrong, its likely I just didn't know how to do it right. ;) Just know, some parts are purposely torn apart right now in attempt to locate problems.
« Last Edit: October 28, 2012, 05:32:32 pm by Flash619 »

FRex

  • Hero Member
  • *****
  • Posts: 1848
  • Back to C++ gamedev with SFML in May 2023
    • View Profile
    • Email
Re: Static Window? "static sf::Window renderWindow;"
« Reply #43 on: October 28, 2012, 05:35:50 pm »
Globals, statics, what's going on ???
..you realize that classes can have other classes as members of themselves?
You are supposed to add genesis to engine as member, not keep recreating it.
Back to C++ gamedev with SFML in May 2023

Flash619

  • Full Member
  • ***
  • Posts: 142
    • View Profile
Re: Static Window? "static sf::Window renderWindow;"
« Reply #44 on: October 28, 2012, 05:45:36 pm »
Globals, statics, what's going on ???
..you realize that classes can have other classes as members of themselves?
You are supposed to add genesis to engine as member, not keep recreating it.

Well see, that's something I honestly didn't know! XD How do you make something a member of something else then? Sounds like it would be easy. >.>

Globals? Oh you are refering to....
bool Genesis::Windowed;
bool Genesis::SkipSplash;
bool Genesis::Debug;
bool Genesis::NoConsoleTags;
 
I assume?

I have to declare them in the file otherwise I will get unresolved externals. They also have to be on the global scope because otherwise you get "blah blah blah cannot be defined in the current scope." Basically they are just flags for command line parameters.

I made those static in attempt to fix my window error, but now its just full screen 100% of the time >_< Even when -WM is defined.

But I am interested in hearing more about this member thing. I don't think I remember that in java exactly.... So I look forward to learning. ^^ Sounds kinda similar to Inheritance.... I'm also going to take a wild guess and say that it not being a member is why nothing is getting the proper values stored in those flags unless they are static.
« Last Edit: October 28, 2012, 05:49:28 pm by Flash619 »

 

anything