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

Pages: 1 ... 16 17 [18]
256
Graphics / [solved]SFML Color probs
« on: April 12, 2010, 10:11:05 pm »
Quote from: "panithadrum"
What do you mean? The compare method works fine.


Yeah, I put in a simple 4 color image to check it, but I forgot to check if the color switched back on the next swap.

257
Graphics / [solved]SFML Color probs
« on: April 12, 2010, 09:53:04 pm »
Quote from: "Ashenwraith"
Hi, here's an example of my probs, any help would be great:

Code: [Select]
sf::Color c1,c2;

c1=img.GetPixel(0,0);

if(c1!=c2) // doesn't compare colors
{

}


Nevermind, I forgot another check.

258
Graphics / [mostly solved]Clear() for sprites/images too?
« on: April 12, 2010, 01:00:51 am »
Quote from: "bullno1"
Quote
The question is what OpenGL/SFML does for drawing/clean up.

For cleaning up: You can have a look at RenderTarget.cpp. It calls glClear, which basically fill a color across the backbuffer.
For drawing: It uses the 3D hardware to draw a textured quad. The whole copying of pixels, rotating, scaling ... is left to the GPU.

Quote
When you are blitting the pixels are copied into an image to give the appearance of a stack. If you don't copy clear (or bg colored) pixels into the image than it remains 'dirty'.

You can choose not to call Clear. Instead, you can draw a blank image on top of the part you need to clear. However, I recommend using an sf::RenderImage


Thanks a lot. This seems to do what I need/want.

I'll have to see how it affects performance.

259
Graphics / [solved]Copying pixels/image to a larger image?
« on: April 12, 2010, 12:52:22 am »
Quote from: "Laurent"
Wow, you really haven't practiced C++ for 12 years, this is amazing :D

The header is <iostream> and you must use std::cout (but you can use std::cerr as well if you want).


Yeah, I got tired of dll/lib hell so I stopped, but now I'm back because I want my tools/apps fast.

SFML is a lot nicer than the GLUT/DirectX bastard projects I used to make.

260
Graphics / [solved]Copying pixels/image to a larger image?
« on: April 12, 2010, 12:26:07 am »
Thanks again.

The syntax is quite a bit different than the C++ of 10 years ago.

I keep getting warnings <iostream.h> is deprecated and I guess I'm not supposed to use cout << anymore, but std::cerr (or something like that)?

261
Graphics / [solved]Copying pixels/image to a larger image?
« on: April 11, 2010, 10:49:57 pm »
Quote from: "Laurent"
sf::Image::Copy ?


Oh wow, thanks--Sorry about that, I don't know how I missed that.

I was just thinking 'shouldn't this have a rect'.

Btw, can you give me a bit of help with the Rect constructor, I have:

Code: [Select]
sf::Rect<int> rct=sf::Rect(1,1,1,1); //doesn't work

NVM, i just got the template code to work...

sf::Rect<int> rct=sf::Rect<int>(1,1,1,1);

looks different than the doc:

sf::Rect< T >::Rect  ( T  LeftCoord,  
  T  TopCoord,  
  T  RightCoord,  
  T  BottomCoord  
 )

262
Graphics / [solved]Copying pixels/image to a larger image?
« on: April 11, 2010, 09:16:28 pm »
How do you copy an image (NOT RESIZE) to a larger one?

I tried copying pixels onto a larger image and it overwrites it or errors out.

263
Graphics / sprite.GetPosition and Vector2f
« on: April 11, 2010, 08:29:07 am »
Quote from: "Ashenwraith"
I'm just starting on this myself.

It should go like this:

-load resources into memory

-instantiate classes that use these resources (make sure they have an id string)

-place in an array

-modify/update through array

264
Graphics / sprite.GetPosition and Vector2f
« on: April 11, 2010, 08:27:49 am »
I'm just starting on this myself.

It should go like this:

-load resources into memory

-instantiate classes that use these sources (make sure they have an id string)

-place in an array

-modify/update through array

265
General / 50% CPU usage... thoughts on improvement
« on: April 11, 2010, 05:58:29 am »
loops eat CPU

It's better to use function calls with a threaded timer to delay.

266
Graphics / [mostly solved]Clear() for sprites/images too?
« on: April 11, 2010, 02:57:48 am »
Quote from: "Spidyy"
Why clear the images?

You can clear the screen with App.Clear(), read the tutorials.

You can also clear a sf::RenderImage.


Hi, thanks for the tips.

I'm aware of App.Clear(), that's why I used 'too'.

The question is what OpenGL/SFML does for drawing/clean up.

When you are blitting the pixels are copied into an image to give the appearance of a stack. If you don't copy clear (or bg colored) pixels into the image than it remains 'dirty'.

I haven't checked the source, but 'App.Clear()' appears to effect everything to make it easy. But I might need certain images to be 'dirty'. Maybe it's doing buffer swaps or something like that.

I'll try to look at the source, but it would be nice if there was a diagram/chart/explanation of how opengl works in SFML (it's probably different in 2.x too).

267
Graphics / [mostly solved]Clear() for sprites/images too?
« on: April 10, 2010, 06:45:03 pm »
Hi, when I worked in flash with blitting you had control over the 'clear' (fill) of each image to clean up the pixels before drawing.

Are you doing this automatically in SFML?

How do I get control of this in SFML?

268
Graphics / [solved]Loading all images from a folder
« on: April 10, 2010, 03:45:14 pm »
Hey thanks a lot, I'll get working with boost soon.

Yeah, I was just thinking about putting everything together if I had to write it myself.

269
SFML website / Site often appears down
« on: April 10, 2010, 07:45:42 am »
Hi, I've been trying to use this site/forums all week and many times they will not load (and it's only this site).

It's never completely down, but you have to make many attempts to get through sometimes.

I don't have any blocking software/hardware and I'm using Firefox.

Not trying to complain here, just letting you know.

Thanks for reading.

270
Graphics / [solved]Loading all images from a folder
« on: April 10, 2010, 07:41:56 am »
Hi, first I'd like to say thanks to Laurent for creating SFML.

I haven't programmed in C++ in many years, but I'm converting my game from Actionscript 3. First I need to convert my tools though.

I have thousands of images that need to be processed so I load them by getting a directory list which returns an array of strings. Next I sort by 'png'.

For example, my code in AS3:
Code: [Select]
var imgs=[];

function Img_Load(path)
{
var f=new File();
f=File.documentsDirectory;
f=f.resolvePath(path);
var l=f.getDirectoryListing(),x=0;

for(var i=0;i<l.length;i++)
{
var s=l[i].nativePath,t=s;
s=s.split('.');
if(s[1]=='png')
{
imgs[x]=t;
x++;
}
}
}


I'm not really sure how I should start with this.

What's the recommended/cross-platform way to get directory listings/work with files?

Should this be a feature I write on my own or should I extend SFML/SOIL?

Shouldn't there be one cross-platform way for all file loading/handling?

EDIT: I just looked at your roadmap, does this do what I'm talking about:

"FS#83 - DataStream framework for resource loading "

http://www.sfml-dev.org/todo/index.php?do=details&task_id=83

Pages: 1 ... 16 17 [18]
anything