It's compilers that need to be supported. Dev-C++ comes with MinGW and sfml does have libraries for it. Though you may want to try Code::Blocks. I hear it's superior to Dev-C++.
Code::Block should be superior and SFML should be more comfortable, but i cant get it runnign and the guide that should teach me how to get it running, dont say anything about the things needed. Like SFML-system.dll, where shouldi hadd it and how i add it.
If it's complaining about dlls, then the set up must have been good. dlls are in path_to_sfml_folder/bin, I think. Either move them to windows/system32 or to where your code is.
http://www.sfml-dev.org/tutorials/1.6/window-window.php
Im trying to do this tutorial, it is the first one and already im having problm swith Code::Blocks and SFML. So what dll i need to add where and what do i but under linker options in project options.
yes i read the gettign staerted. even then i messed around and hour to get it working and in the end i still didnt understand what the hell did i do to get it working. Il look for a better tutorial.
#include <SFML/Window.hpp>
int main()
{
// Create the main window
sf::Window App(sf::VideoMode(800, 600, 32), "SFML Window");
// Start main loop
bool Running = true;
while (Running)
{
App.Display();
}
return EXIT_SUCCESS;
}
This code should create a window. So i think this is a Windows window not CMD window, but i get command prompt window. and it seem that the entyre program freezes then. Btw this is the tutorial code not mine.
Been at it for hours and i simply cant get it working. I have no ide what is the problem here. It name says it should be simple and fast, but i have yet to see the simplisity. I have checked te gettign started tutorial, double checked, triple checked, still nothing. i get 50+ errors i dont know how many excactly cause the box has its lilmits.
So atleast for now, il stick to Allegro, cause atm it seems alot more simplerer than SFML.
So i got the selection working fine, so the next thing to do is to make them move.
I was thinking about a class file that gets the ID and beginngin location of the circle. And then houses the command that makes it move. SOmething like ID , destynation x, destinatyon y. And the under that command has the movement stuff. Up, Down, Left, Right, and Diagonal.
Firstly, no. This isn't syntactically correct. MoveCommand is a constructor. GetLocalion and GetDestination are functions, I assume. They don't have return types declared. Also, how can a constructor accept functions?
Secondly, no. The logic is wrong too. This is equivalent to Objectlocation = destination. To make a thing move, you need to add a little to its coordinates before redrawing.
Here is a plain example:
1 2 3 4 5 6 7 8 9 10 11 12
float px = ..., py = ...; //position
float tx = ..., ty = ...; //target
constfloat speed = 1;
while(true){//the main loop
float dist = distane(px - tx, py - ty);//distance between two points, defined as sqrt(dx*dx+dy*dy)
if(dist>speed){ //if you haven't reached your destination
px += (px-tx)/dist*speed;//equations for smooth movement on a line
py += (py-ty)/dist*speed;
}
draw_something(px, py);
}
Normally you'd put most of it in a class, so that it looks like
1 2 3 4 5
Character c(...);
while(true){
c.update();
c.draw();
}
Notice that now the speed of your character depends on frame rate. When you feel comfortable with this method and the simple maths behind it, try to figure out, how you could use a timer, to choose the right position, even if frame rate is lagging.
struct Circle{
float px, py, tx, ty, rdius;
Circle(float posx, float posy, float rad) {//for more comfortable creation of circles
px = tx = posx;//so that the circle doesn't move
py = ty = posy;
radius = rad;
}
void set_target(float x, float y){
tx = x;
ty = y;
}
void update(){
float dist = distance(px - tx, py - ty);
constfloat speed = 1;//you may want to make this a member or a static member in the future
if(dist > speed){//moves the object one step further
px +=(px-tx)/dist*speed;
py +=(py-ty)/dist*speed;
}
}
void draw(){
circlefill(buffer, px, py, radius, makecol(0, 0, 255));
}
};
Now, in your code, where you would draw a circle, instead do
Ok now only thing missing is to make it move whidout me having to click eatch time. Atm, eatch time i click it moves one step in the opposite direction.
switcher just turns the mouse of for a second, for the moment when it draws.
You may have noticed a black rectangle on some of the circles with the last example. Mostly when you try to move the mouse fast.
Here Wmz used a variable called switcher to determine wether or not the mouse cursor should be displayed. If something needs to be drawn to the screen, updateScreen() will first deactivate the mouse so that it does not interrupt the process, once the update is finished, the while loop will continue and redraw the mouse cursor directly to the screen.
Since im failry new to Allegro and anything connected to using graphics, i use allegro basic tutorial and you help.
You check mouse_b inside getMouseInfo, and if mouse_b is not 0, the screen in redrawn on line 6. Thus lines 4, 6 and 7 are not needed. Though aren't a cause either. It sounds like something due to allegro. I think you'll have to find a tutorial that has continuous motion in it, so that you see if there are any differences.
(or did that "might" imply that you didn't try yet?..)