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

Pages: [1]
1
Graphics / Drawing to 2 views simultaniously
« on: September 30, 2014, 02:18:37 pm »
Hey,
I've got a question regarding the view-tutorial.
As far as I understood it, when I want to have a minimap, I need a normal view for my character, which will be moved when the character moves (do I really have to call Window::setView() every time I want to move it?)
And then I need one for my minimap, which simply covers the complete space of my level, instead of the monitor resolution.
To display them I call setView with the playerView, draw my 100+ level-objects, and then i call setView with the minimap-view and draw them all again?
Is that how it is?
Isn't there a way to just call draw once for every level-object? Otherwise that would mean, that the runtime depends linear on the number of views?

And another question:
can I just call draw for every object, in my level, or should I first check which one will be in the window anyway, and only call draw for those ones?

greetings Uzaku

2
Graphics / Drawing Shapes on Images
« on: October 25, 2011, 01:57:22 pm »
Hey,
I want to create an Image, with lines, Basically a very simple Chessboard.
So i created 2 sf::Shape:Line objects one vertical and one horizontal.
But then i noticed I cant copy them to the image.
And now my question is, is there any way to copy it, that i didn't see, or will i have to generate them myself by changing the certain pixel?

greetings Uzaku

3
Graphics / Flip an Image
« on: April 24, 2011, 03:31:11 pm »
Hi, for my Project I need a Background Picture, which is created at run time, due to different Screen-resolutions.
So I have my Image and want to Put a Border arround it.

Code: [Select]
BrushW = Border->GetWidth();
Cx = (Solution.x / BrushW) + 1;
for(int i = 0; i < Cx;++i)
{
BackGround->Copy(*Border, i*BrushW, 0);
BackGround->Copy(*Border, i*BrushW, Solution.y - BrushW);
}


So I have a Border and the Bottom and the Top, but I want one left and right too.
So I would like to Flip my Border Image and Copy it onto the background.
But except for creating a new Image with the swapped values of my Border Image and pixel copying to flip it, i couldnt find a way.
So I was wondering, whether there is a more elegant way.

greetings me

PS: I think flip was the wrong word, I ment a turn by 90 degree

4
Graphics / Problem with RenderWindow::Clear() (Maybe a bug)
« on: April 22, 2011, 08:44:30 pm »
Hi,
after hours of searching within my code I decided to make a minimal sample to find the Error. And I think I found a Bug.

When I run this code, and press the A-Key, my Window starts flickering between black and the choosen color.

And here is a DownloadLink to a zip archiv with all files: https://rapidshare.com/files/458689578/SFMLBug.zip

Code: [Select]
#define WIN32_LEAN_AND_MEAN
#include <windows.h>
#include <SFML/Graphics.hpp>
#include <list>


int WINAPI WinMain(HINSTANCE d1, HINSTANCE d2, LPSTR d3, int d4)
{
sf::RenderWindow *W = new sf::RenderWindow(sf::VideoMode(1024, 768, 32), "Test Window");
sf::Image I1, I2, I3, I4;

I1.LoadFromFile("Images\\CreateNetGame.png");
I2.LoadFromFile("Images\\Exit.png");
I3.LoadFromFile("Images\\JoinNetgame.png");
I4.LoadFromFile("Images\\Start.png");

sf::Sprite S1(I1, sf::Vector2f(0, 0)), S2(I2, sf::Vector2f(0, 200)), S3(I3, sf::Vector2f(0, 400)), S4(I4, sf::Vector2f(0, 600));

while (W->IsOpened())
{
// Process events
sf::Event Event;
while (W->GetEvent(Event))
{
// Close window : exit
if (Event.Type == sf::Event::Closed)
W->Close();

if(Event.Type == sf::Event::KeyPressed && Event.Key.Code == sf::Key::A)
W->Clear(sf::Color(255, 0, 255));
}

W->Draw(S1);
W->Draw(S2);
W->Draw(S3);
W->Draw(S4);

W->Display();
}

return 0;
}


greetings Uzaku

Pages: [1]