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

Show Posts

This section allows you to view all posts made by this member. Note that you can only see posts made in areas you currently have access to.


Messages - Flash619

Pages: 1 ... 3 4 [5] 6 7 ... 10
61
SFML projects / Re: sfeMovie Project [v1.0 released]
« on: October 30, 2012, 07:09:14 pm »
Indeed sfeMovie needs the FFmpeg .lib files in order to be built so you either have to build these libraries or get a prebuilt compatible version (sfeMovie 1.0 uses FFmpeg 0.11.1). I've been asking Zeranoe to get a link to this specific build, so if you wait a little bit you'll get binaries. Otherwise you can follow the directions on the "Getting started" page.

By the way, what isn't clear about the build steps explained on this page?
I know the build process for sfeMovie is a pain at the moment but you should get it to build if you follow the directions.

Also note that I've never tested sfeMovie with VS11.
And sfeMovie cannot be compiled as static library for now.

Don't hesitate if you have any other question :) .

Ceylo

Well I'm going to be transferring back to VS 2010 because a lot with V11 seems to still be sort of a grey area as far as comparability goes. Besides, I honestly see no big difference between 2010 and 2012 with the express editions. ^^;;

I'll let you know how it goes when I try it on 2010.

62
SFML projects / Re: sfeMovie Project [v1.0 released]
« on: October 30, 2012, 05:47:58 pm »
I seem to be having some real issues trying to build this library on windows.

I'm running VS 11 with SFML 2

Cmake builds without error.

VisualStudio on the other hand...
Quote
Cannot open input file 'avdevice.lib'

SFML itself compiles just fine, I only get that error on "sfeMovie"

I think I need to compile my own library because if I use a pre compiled library and try to run my program I get the following:

Quote
The procedure entry point at av_samples_copy could not be located in the dynamic link library avcodec-54.dll.

Your website states that for Visual Studio and Cmake I have to run a .sh file, but I really don't know how to begin to run a .sh file on windows. >.>

So, if you could give me some hints as to what I'm doing wrong it would be appreciated. :)

Also, can sfeMovie be compiled as static so it doesn't need all the sfml .dll's right next to it?

63
Window / Re: Static Window? "static sf::Window renderWindow;"
« on: October 28, 2012, 06:57:45 pm »
Just thought I would say, I have everything fixed! :D

The problem had nothing to do with how I was referencing my instance well it did. But here were the issues

1, I needed my variables to be static so they would share data across instances.

2,
        if((Genesis::WindowX>0)&&(Genesis::WindowY>0)&&(Genesis::Windowed=false))

Should have been

        if((Genesis::WindowX>0)&&(Genesis::WindowY>0)&&(Genesis::Windowed==false))

^^ That explains why it always appeared at default.

And my X/Y short ints also had to be made static.

Thank you for your generous help. It is greatly appreciated. Kudos to you!

64
Window / Re: Static Window? "static sf::Window renderWindow;"
« on: October 28, 2012, 06:14:38 pm »
B is the CLASS, my_B is object or instance of that class, it's independent of other objects of class B apart for static variables that all instances of one class share. Declared like this it will be constructed just before instance of A and live as long as that instance of A does. Go read some c++ tutorial, really.
http://www.parashift.com/c++-faq/overview-class.html
http://www.parashift.com/c++-faq/overview-object.html

So you're saying if I want console utils to get

"NoConsoleTags"

From Genesis, that "NoConsoleTags" will have to be static?

Also thank you for the tutorial links...... I unfortunettely don't think I will pick up any knowledge from them. I mean sure I can read them, but whether I actually retain anything I'm reading is another story. I learn best from practical application. I mean, unless it actually says "This is how you send variables to other classes that are in other files" It's likely I wont know that that is what its for.

Its just frustrating right now because what I want, is really really simple, but I feel like you might be miss understanding what I want. Can it really be, that complicated to do this:

//MyFile
// .h
MyClass{

     bool MyVariable;

}
// .cpp
bool MyClass::MyVariable=false;
/*something in the class would happen and change that variable to true*/
/*It would then go to MyFile2 to do something else*/
//MyFile2
// .h
MyClass2{
#include MyClass;

MyClass myClass;

}
//.cpp
/*Some stuff happens in here, that gets that bool from MyClass, but it STILL RETAINS ITS VALUE of being true, and not its default of being false

It seems like it should be extremely easy stuff..... In fact... I'm pretty sure every program ever made does this at some point... >.>

65
Window / Re: Static Window? "static sf::Window renderWindow;"
« on: October 28, 2012, 06:05:30 pm »
You can treat your classes like normal types and just put variable of your class type into your other class somewhere.
#include "B.h"
#include "C.h"
class A
{
private:
B my_b;
public:
C myPublicC;
}
That's the complete basics of c++ that you're missing.
So then.... Is B a class, and my_b refers to that class?

Aslo, what would be the difference between having that reference in private or public? It seems kinda odd I mean, another class wouldn't go to that class to get a reference member of the other class would it?

Also I just tried to change it in my ConsoleUtils..... It didn't work. It compiles. But it still does not get the proper variable... -nct is set to True, but it reads it as false.....

ConsoleUtils.h
#ifndef CONSOLEUTILS_H
#define CONSOLEUTILS_H
#include <string>
#include "Genesis.h"
//Debug Console font Modifications
class Font{
public:
    void set_color(short int a);
};
//A reference class for modifying, and adding things to the debuc console.
class Log{
public:
        Genesis genesis;
        void info(std::string a);
        void error(std::string a);
    void critical(std::string a);
};
class Validate{
public:
    bool Digits(const std::string& a);
};
#endif
 

Would it be possible, for you to show me a simple example of two files, with two different classes, say.... class A needs to get a bool variable from class B, but its in another file. How does it get that? Because apparently something I'm doing is wrong because I never can get the right data from my Genesis class.

66
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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.

67
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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.

68
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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. ???

69
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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?

70
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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

71
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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...."

72
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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. :)

73
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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. >_< 

74
Window / Re: Static Window? "static sf::Window renderWindow;"
« 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...

75
Window / Re: Static Window? "static sf::Window renderWindow;"
« on: October 27, 2012, 11:27:44 pm »
There shouldn't be one class that does everything and is needed by everyone. I myself have a core class that has a stack of polymorphic game state classes and calls virtual methods run and render on the class that is on top of the stack. Game states have pointers to core so they can call for their own removal and they keep their own resources, textures, whatnot with themselves.
Quote
Simple, I'm trying to receive my arguments, "char *argv[]), and convert that char to something that I can then forward to another class. To you, that would probably take about 5 seconds and extremely easy and basic but do understand that I am NEW to this. I'm trying my best to learn all of this, but I have very little experience with these items to go off of. I still have no clue how to actually store variables with objects and have it retain its info. >_< This day in my eyes, has been a successful failure. Successful in the fact that I know the right ways of doing things, a failure in the way that nothing has been accomplished and I am more lost in C++ now than I ever was.
What do you want them to convert to? argv is something that came from C. :)
Can you provide example of what you want to do? "store variables with objects and have it retain its info" doesn't say much.

Well first, I have a question about the static stuff. You say to keep from using static functions/variables, correct?

Well a few months back I was following this tutorial:
http://www.gamefromscratch.com/page/Game-From-Scratch-CPP-Edition-Part-2.aspx

And I always used static since then because it was what I was taught to use in the tutorial.... Is what he did wrong? I'm basically making my engine off of what I learned from his, so while its a bit different, it generally has similar things. So I'm trying to do it without the static stuff, and am running into troubles because I've never done it this way. ^^;;

I basically have a main class called Genesis, that runs the backbone of the program. It handles command line arguments, sets global flags for other things to access, and has a main loop with a switch statement based off of the engine core state, that then, based on the state, goes to other functions that open different classes.

for instance if the state is EngineCoreState ShowingSplash; then it goes through the loop, catches in the correct part of the switch statement, then goes to a method called "ShowSplash" that then turns the SplashScreen class into a object "SplashScreen splashScreen" and runs it "splashScreen.ShowSplash(sf::RenderWindow& renderWindow);

Is that correct? I just worry that things that need to access global variables such as WindowManager wont be able to. Window manager has to check to see if the Fullscreen flag is set. Fullscreen is a bool in Genesis. So if it makes a object out of Genesis, it wont get the updated value, it will get the default, which is false.

See what I mean? I don't know how I would properly set that.

As for argv..... I imagine I could just change the Initialize function to accept int argc and char *argv[]
After all, I already have a function in Genesis that handles the arguments and iterates through the list of them setting the proper variables. ^^

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(); ?


Pages: 1 ... 3 4 [5] 6 7 ... 10
anything