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.


Topics - scyth3s

Pages: [1]
1
Graphics / Nothing in Graphics module compiles!
« on: January 29, 2015, 04:17:26 am »
So I've been trying to get anything in the graphics module to work (window module works fine), and it just won't happen. I get a window up and running without any issues, but as soon as I even declare a Texture, ImageLoader gives me several errors. Does anyone have a clue what they mean or how to fix them?

The Texture isn't the only thing that causes this. If I change sf::Window to sf::RenderWindow, or try to use much of anything else in the Graphics module, I get the exact same errors, all originating from ImageLoader.cpp

2
Window / Hardware Position of mouse?
« on: January 27, 2015, 05:01:59 am »
Is it possible in SFML a position for the mouse that does not correspond to the position of a window or the desktop itself? For instance, in any 3D game where mouse controls camera, I need to be able to find out movement of the mouse event if it would go beyond the edge of the screen.  I didn't see anything like this in the documentation, but I've also been known to miss things now and again when perusing through.

3
Graphics / Stack around the variable "MyFont" was corrupted.
« on: May 18, 2011, 04:58:40 pm »
I have this code, which, for test purposes, I copied and pasted directly from the 1.6 tutorial.

Code: [Select]

     sf::Font MyFont = sf::Font::GetDefaultFont();

// Create a graphical string
    sf::String Hello;
    Hello.SetText("Hello !\nHow are you ?");
    Hello.SetFont(MyFont);
    Hello.SetColor(sf::Color(0, 128, 128));
    Hello.SetPosition(100.f, 100.f);
    Hello.SetRotation(15.f);
    Hello.SetSize(50.f);


And I get the runtime error in the title bar. I've tried having SFML load Xirod font, which I put in the project folder (VS 2010) and the executable folder. No dice.

4
Graphics / sf::Color linker error
« on: May 17, 2011, 06:42:36 pm »
When I try to use the following code

Code: [Select]

        this->selectedColor = sf::Color::Green;
this->deselectedColor = sf::Color::Red;


Where selectedColor and deselectedColor are variables of type sf::Color, I get the following linker error.


Error   11   error LNK2001: unresolved external symbol "public: static class sf::Color const sf::Color::Red" (?Red@Color@sf@@2V12@B)   C:\Users\Daniel\documents\visual studio 2010\Projects\Game Template\Game Template\GButton.obj


THis is followed by an equivilent error for the green color call, and any other colors I use. If I specify the colors manually (sf::Color(0,255,0)), then I get a runtime error that breakpoints me somewhere in the middle of xutility.cpp.

My linker settings are this:
Code: [Select]
sfml-graphics.lib
sfml-window.lib
sfml-system.lib
sfml-audio.lib
sfml-main.lib
opengl32.lib
glu32.lib


and I include <SFML/Graphics.hpp> in the relevant file. What am I doing wrong?

5
Window / openGL issue + window waits to draw
« on: May 16, 2011, 07:49:40 pm »
I'm currently having two issues, and I think that they are related to each other.

1st, the SFML window I create does not draw/display anything until I move the mouse over it.

Second, whenever I move the mouse, my openGL primitives get both smaller and closer together-- as long as the mouse is moving (any direction, and INSIDE the SFML window) until they disappear completely. I'll post the relevant code here, because I am currently stumped and I have no idea what to google for on this issue.

Code: [Select]


///////////////////////////////////
/// Main starts the program,
/// creates a GameManager and
/// has it loop until completion
///////////////////////////////////
int main(int argc, char** argv)
{
//constructor game manager and start looping
GameManager Manager("Template");
Manager.Loop();
}



Code: [Select]
GameManager::GameManager(string title)
{
//the dimentions of the window
int size[2] = {800, 600} ;

//creates the game window, sized to the two elements of the array declared above
window.Create(sf::VideoMode(size[0],size[1]), title);
this->initGL();
this->resize(size[0], size[1]);
}


GameManager::~GameManager(void)
{

}

const sf::Input& GameManager::GetInput()
{
return window.GetInput();
}

void GameManager::Loop()
{
//constantly loop through the window
while(window.IsOpened())
{
//go through the event processing loop
sf::Event Event;
while(window.GetEvent(Event))
{
//process event based on type
switch(Event.Type)
{
//resize if resized
case sf::Event::Resized:
resize(Event.Size.Width, Event.Size.Height);
break;

//close if closed
case sf::Event::Closed:
window.Close();
break;
}

this->update();
this->draw();

window.Display();
}
}
}

void GameManager::draw()
{
//clear the screen
glClear(GL_COLOR_BUFFER_BIT);

glMatrixMode(GL_PROJECTION);
//glLoadIdentity();
gluLookAt(0,0,1,     0,0,0,     0,1,0);
//viewport code here
//////////////////////
//////////////////////
//////////////////////
///end viewport code

//Drawing code here

glMatrixMode(GL_MODELVIEW);
        //glLoadIdentity();
//for demo purposes, we draw a triangle
glPointSize(100);
glBegin(GL_TRIANGLES);
{
glVertex2f(-1,0);
glVertex2f(1,0);
glVertex2f(0,1);
}
glEnd();

//end drawing code

glFlush();
}

void GameManager::update()
{

}

void GameManager::initGL()
{
glClearColor(0,0,1,0);
glColor3f(0,1,0);
}

void GameManager::resize(float w, float h)
{
glViewport(0,0, w, h);
glMatrixMode(GL_PROJECTION);
glLoadIdentity();
gluPerspective(60, w /h, 1, 200);

glMatrixMode(GL_MODELVIEW);
glLoadIdentity();

gluLookAt(0,0,5, 0,0,0, 0,1,0);
}


Code: [Select]


class GameManager
{
public:
//////////////////
/// Creates the game window
/// And calls the resize method to properly set the window attributes and glViewport
/// \param The title of the game's window
//////////////////
GameManager(string title);

///////////////////
///
//////////////////
~GameManager(void);

//////////////////
/// Has the GameManager loop through the window cycle,
/// as well as updating and drawing stuff
//////////////////
void Loop();

///////////////////////////
/// Gets a reference to the window's input struct
///////////////////////////
const sf::Input& GetInput();

private:
////////////////////////
/// The render window
////////////////////////
sf::RenderWindow window;

//////////////////
/// The portion of the game currently running.
/// IE: MainMenu, OptionsMenu, etc
//////////////////
GameState state;

///////////////
/// Initializes the openGL states
//////////////
void initGL();

/////////////
/// Draws the game
/////////////
void draw();

////////////////
/// Updates everythign in need of updating
///////////////
void update();

///////////////
/// Resizes the window
///////////////
void resize(float w, float h);
};


The general gist is this:

Manager creates window. Manager updates and draws window repeatedly. Whenever the mouse is moved, the primitives (the vertex2f calls) get closer to the origin, and smaller, until they disappear completely.

Any help would be AMAZING.

I have tried:

[list=]
removing, moving, and in general experimenting with the commented out calls to glLoadIdentity() in the draw method.

debugging. The code stays in these 3 files, plus of course the openGL ones which I cannot see in VS, the entire time.

Changing the primitives from GL_POINTS to GL_LINES, and GL_TRIANGLES.

Removing GL_FLUSH.
[/list]

6
Window / Storing multiple sf::Input instances possible?
« on: May 16, 2011, 07:03:36 pm »
I would like to store input states for previous game loops, and the simplest way in XNA was simply to save the input state. IE: prevKB state = Keyboard.GetState();

Is it possible to do something like that in SFML? I can't seem to figure it out correctly...

7
Window / 3D depth stuff
« on: March 08, 2011, 11:05:22 pm »
I'm currently going through the OpenGL "Redbook" (OpenGL Programming Guide), and doing all the examples in SFML as well as I can.

The book mentions that glut interfaces with openGL in such a way that

glutInitDisplayMode(GLUT_DEPTH | ......);
glEnable(GL_DEPTH_TEST);

......

while(1)
{
       glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
       get_viewing_point();
       draw_3d_object_A();
      draw_3d_object_b();
}

will make OpenGL draw objects in front of other objects correctly, so the wrong object will not be obscured.

Is there an equivalently simple way to get OpenGL to sort objects from the viewport in such a way using SFML? Is there a specific place I should look for this (be it online or in the book)?

8
General discussions / Static vs Dynamic
« on: February 23, 2011, 05:44:06 am »
What are some advantages of the different types of linking? I've done some searching, and know about the .exe only vs dll and such, but I'm curious what you peeps think.

9
Network / network
« on: February 22, 2011, 10:58:01 pm »
Are the SFML network functions compatible on cross-platform? IE: If I wrote a networked game using SFML networking, could the 3 compiled versions play with each other, or would it be Mac-only networking, Linux-only networking, and WIndows-only networking?

Edit: Sorry about misplacing. This thread was actually meant to just be a reply post, but apparently I clicked "Post New Topic" instead of "Post Reply." I did think it was a little weird that a reply post needed a topic line!

10
General discussions / Cross-platform targeting
« on: February 22, 2011, 05:13:24 am »
Before you read too far, I have no direct problem. I'm just trying to learn from the get-go how to write SFML apps that work on Mac, Linux, and Windows all from the same Code Blocks (or VS 2010) project, and I've got a few questions.

1: If I link statically, will the same .exe (compiled on Windows in C::B or VS 2010) run on all 3 platforms, or will I need to actively import the project on each platform and build it there to make it cross-platform?

2: Same as #1, but with dynamic instead of static linking.

3: Should I be trying to develop in Linux instead of Windows (I'm on Windows)?

4: Do you have any other hints or suggestions?

11
Window / Glu issues.
« on: February 22, 2011, 05:08:44 am »
I'm trying to experiment in OpenGL with SFML, but I can't seem to get ANY glu functions to work.

I have the following code:

Code: [Select]
void display()
{
    glClear(GL_COLOR_BUFFER_BIT);

    glMatrixMode(GL_MODELVIEW);

    glColor3f(0,1,0);//green

    glLineWidth(10);

    gluLookAt(0,0,5,     0,0,0,     0,1,0);
    glBegin(GL_LINES);
        glVertex3f(0,0,0);
        glVertex3f(0,0.5,0);
    glEnd();
}


The line with gluLookAt gives a compiler error every time, yet all the other openGL calls work flawlessly. I'm operating on Windows, and I have included the SFML/Window.hpp. Any hints?

Pages: [1]
anything