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 - J-Gamer

Pages: [1]
1
Graphics / Re: Shape not placing properly
« on: November 26, 2012, 03:32:05 pm »
Found my error: it was completely unrelated to the drawing code. I'm kinda face-palming for myself right now.  :-[

2
Graphics / Re: Shape not placing properly
« on: November 25, 2012, 09:15:47 pm »
setPosition sets the top left corner, not the center.

It seems I need to dig deeper in my own code, since I made a simple program trying to demonstrate the problem that did work perfectly(ie: just drawing a circle with those coordinates, and some lines surrounding it to check correctness).

Edit: It seems like it's my math I use for calculating the coordinates is a bit off, since the circle is actually being drawn correctly. The points on my grid, however...

3
Graphics / Shape not placing properly
« on: November 25, 2012, 08:44:18 pm »
I don't really know how to phrase it otherwise. This happens with both rectangle shapes and circular shapes(haven't tested other shapes).


This is a grid in my game, with the player and zombie running across it. The big circle is an obstacle, and should be drawn right in the middle of the screen.
Here's the piece of code that draws it:
sf::Vector2f pos = circ->getCenter();
        sf::CircleShape c;
        c.setRadius(circ->getRadius());
        c.move(-c.getRadius(),-c.getRadius());
        data->win.draw(c);
circ is an object that represents a circle, with a center and a radius. data->win is a RenderWindow.
I checked in the debugger, nothing wrong with the pos variable, just 400,300. As it should be, because I put the circle right in the middle of the screen, which is 800x600. I tested the value I'm sending setRadius, and it is 200, as to be expected.
But it still is drawn incorrectly, slightly to the left and a tad bit too small. The same happens with my rectangular objects. Anyone got any ideas why this happens? I'm really out of ideas now.

Edit:
If I leave out the c.move statement, it's position is already slightly to the left from where you would excpect it to be(while the position I put it in still is 400,300, so nice in the middle of the screen).

4
General / Re: Installing 2.0 together with 1.6
« on: November 22, 2012, 06:24:49 pm »
I don't know how to notify you if I edited a post, so here's me bumping the thread.

5
General / Re: Installing 2.0 together with 1.6
« on: November 22, 2012, 04:42:53 pm »
I'm on Ubuntu 11.04, g++ 4.7.2.

SFML 1.6 came with an installation script, which put it in /usr/local/sfml. I have a cmake configuration file called FindSFML.cmake I got from here. I've been using that in my projects that use cmake to generate their makefiles to find sfml. It did succesfully find my 1.6 installation when I wanted it to for my older projects.
I now have a project that uses sfml 2, and I have downloaded compiled binaries from the Downloads section of the main site. I put them in the main project directory, and tried the command stated above in a build directory to generate makefiles. AFAIK, setting SFMLDIR should make the script search for sfml in the directory specified. It didn't, since I got this error:
Code: [Select]
SFML found but version too low (requested: 2, found: 1.x)
Quote
The variable is SFML_ROOT (read the doc!).
Still doesn't work.

Oops... It seems that I have an outdated version. SFMLDIR has been replaced with SFML_ROOT. Will edit this post after I tried it out.

EDIT: Still doesn't work. I don't get why setting SFML_ROOT doesn't change where it searches. I have tried both ways: exporting SFML_ROOT to point to the SFML 2.0 directory, and defining it as a cmake variable.

EDIT2: What directory should it actually point at? It currently points to the directory where the include and lib folders are.

6
General / Installing 2.0 together with 1.6
« on: November 22, 2012, 04:01:13 pm »
The title almost says it all: I want to have a working installation of both SFML 1.6 and 2.0 on the same configuration. I have a few old projects that need 1.6 to compile, but I'd like to use 2.0 for a new project. 1.6 is currently installed to the default install location, and afaik, sfml 2.0 would just install over it, probably causing conflicts.

I tried using the findSFML.cmake with this command: SFMLDIR=../sfml cmake .., but it said it found a 1.x version of sfml. Shouldn't that file first search in the SFMLDIR directory before checking system-wide installations?

Pages: [1]
anything