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 - racumin

Pages: [1]
1
Graphics / Outline inside of Shape::Rectangle
« on: November 27, 2009, 08:45:47 am »
Hi, how do I put the border (outline) of a Shape::Rectangle inside the rectangle itself?

Code: [Select]

sf::Shape rect = sf::Shape::Rectangle(0, 0, 50, 50,<color_here>, 2.0f, <color_here>);


In this code, the output was a rectangle with size 50 and its border 2.0f. making the whole rectangle bigger (with size 52). I want to just make the rectangle 50 and its "inner" border 2. Is there any method to do it?

Of course I can just recompute so that the total size is always fixed but I just want to know if this is already implemented. Thanks!

2
General / Code::Blocks generating an executable
« on: October 14, 2009, 09:17:38 am »
Hi, I created a simple game and I want to deploy it to other PC. In Code::Blocks, how do I disabled the console when running the app? When I go to the Release folder and run the exe file, it produces the main window app but also the console, I want to disable the console. Thanks!

Another question, if I copy the directory of the Release and paste it in another PC wihtout Code::Blocks installed, will it run? (please do not say "try it and see for your self" - I do not have any other PC and I do not want to uninstall Code::Blocks from this computer then try it then install again) Thanks again!

3
Window / Delayed display on Windows
« on: October 14, 2009, 05:25:50 am »
I am making a simple tetris game and developed my program in Linux. It runs smoothly - when I press a button, the state of the objects are displayed instantly. But when I compiled my code in Windows, the display is delayed. For example I pressed the left key 4 times, after some milliseconds (but I think less than a second), the object was moved 4 spaces already. In linux I can see it move 1 space every time I press the key. Why is that? The logic I used was:

Code: [Select]

int main() {
Gui gui;

while (gui.isRunning()) {
gui.clearBackground();      // window.clear()
gui.defaultMove();          // move the object 1 space down
gui.handleEvents();        // the while loop i saw in the tutorials
gui.drawGamePanel();        // draw objects here
gui.display();               // window.display()
}
return 0;
}


By the way, I initialized my window using:
Code: [Select]

VideoMode mode(GUI_WIDTH, GUI_HEIGHT, 32);
window = new RenderWindow(mode, "Falling Blocks", Style::Close);
window->SetFramerateLimit(60);

Image img_icon;
img_icon.LoadFromFile("icon.png");
window->SetIcon( img_icon.GetWidth(), img_icon.GetHeight(), img_icon.GetPixelsPtr());

if (!font.LoadFromFile("myfont.ttf")) {
cout << "failed to load font" << endl;
return;
}


Any ideas? Thanks!

[edit] Ok, I was able to disable the output from console using the option -mwindows But it still has a CPU usage of about 50.

4
Window / No title bar on RenderWindow
« on: October 08, 2009, 09:08:12 am »
Hi! I'm new to c++ and sfml. I'm creating a small window but the titlebar won't show. I tried
Code: [Select]

int main() {
       WindowSettings settings;
settings.DepthBits = 32;
settings.StencilBits = 8;
settings.AntialiasingLevel = 2;

VideoMode mode(100, 150, 32);
RenderWindow window(mode, "SFML Window", Style::Titlebar, settings);
        while (window.IsOpened()) {
window.Clear();
                //handle events here
window.Display();
}
}


in Ubuntu Hardy but the titlebar won't show. How can I fix this problem? Thanks!

Pages: [1]