March 28, 2024, 09:07:07 AM

News:

Own IWBasic 2.x ? -----> Get your free upgrade to 3.x now.........


(no subject!)

Started by Protected, June 16, 2006, 11:04:11 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Protected

June 16, 2006, 11:04:11 AM Last Edit: June 16, 2006, 11:05:47 AM by Protected
I finally bought Aurora  ;D Later than expected, lightning fried my router so I was unable to access the internet since wednesday. I'll be waiting for those static methods and attributes, now... And of course methods with the same name but a different number/type of arguments (especially constructors :P).

What's the 'pointer' type for? Is it the same as void*, or...? I have a class with a method dostuff (string action, arg1, arg2, arg3). I need arg1~arg3 to take any kind of object or type (the arguments required may be different for each "action") and I'm trying to figure how to do that  :P

Why do I get a syntax error with:
  (a.b.get(a.b.add (args)))->do (stuff);
? It works if I use:
  classname *var = a.b.get(a.b.add (args));
  var->do (stuff);
Is there any reason why it shouldn't work the other way?

When I have a 2d window (or fullscreen) with large visible sprites on it, something starts making a lot of noise inside my computer, maybe the processor fan, maybe the gfx card, I'm not sure. If the sprites are positioned outside the visible screen area, there is no noise. If the RenderXY line is commented out, there is no noise. If the sprites are small (dxtest.src for example) there is no noise, even when the sprites move around and change frames. When there are no sprites - only stuff created with the CWindow drawing commands -  even if it's a heavy application, like frags.src (not the only test I made) there is no noise. The processor usage according to the task manager was similar for my application with big sprites and for frags.src, too. What can be causing this?

Parker

pointer = void*, it's from before there were typed pointers (really early alpha).

The only to pass an anything is the void* or pointer, then you'll have to cast it. There is no automatic base class like in java, but then again java doesn't have pointers either, they have to solve it some way.

Currently you can't do function( )->stuff or *(type)function( ).stuff, it's considered unsafe, however after the discussions on that I've seen quite a few cases where it would be completely safe, one of them (kinda pseudo-code snippet from another compiler):
if( lexGetClass( ) == TKCLASS_NUMBER )
{
    if( *lexGetText( ) == "0" )
    {
        // handle special 0 case here.
    }
}


Obviously if there is no token, it won't be a number, so dereferencing there is safe. There are other cases too that I've seen, so it's not all bad. But for now you'll have to use a temporary variable.

Protected

Hmmm... I don't understand your example code very well, but what my code does is run the add method, which creates an instance of something somewhere inside those classes and stores it there, and then return a pointer to the newly created instance. All I need that pointer for is to run the do(stuff) method on the newly created instance (for example, a 'load' method), then it's garbage - to access the class instance again I can use methods from the 'b' class. Shouldn't that be ok?

What do you mean by "unsafe"?  ???

Using void* is fine, thanks for the info. I was curious about the pointer type because I didn't see it mentioned anywhere.

Any clue about the sprites problem? It's only three sprites, it shouldn't be making this racket when I run the program ~_~

Parker

Unsafe means, trying to dereference a null pointer causes a crash. There's no exception handling, so you can't exactly throw a NullPointerException like java does.

Sorry, I know nothing about graphics/directx, but that sure sounds like a weird error.

Barney

It's easy to explain the noise. Modern graphics card throttle down the GPU fan during normal windows operations. Only when the GPU is needed (and that is usually when one uses DirectX or OpenGL in hardware acceleration mode) does the fan increase its speed. Depending on the driver the fan my be sped up to the highest revs immediately and that's where the "funny" noise comes from. The solution is not easy and usually requires changing the cooling system completely. Water cooled systems are the quietest of the bunch...

Barney

Protected

It's not really an error, just an annoying noise  ;D

Barney: Why would three big static sprites cause the fan to immediately move at full speed while thousands of moving squares being rendered at more than 200fps (or smaller moving changing sprites) don't? Even Uru Live (graphically the heaviest application I run in this computer) takes a while to make my computer start breathing like a tired horse, and even so the noise is never quite the same, probably because the processor fan runs faster, too...

Ionic Wind Support Team

Depends whether your sprites are loaded in system or graphics ram.  For very large sprites you should use system ram, last parameter of C2DSprite::Load set to true.  It is an optional parameter that defaults to false, which loads the sprite in graphics ram.

Paul.
Ionic Wind Support Team

Protected

I had it set to true... I changed it to false, and the noise is gone  ::) Maybe the sprites aren't that large after all. Thanks paul.