|
pplshero54 wrote: I am programming a 3d game that is very time critical
I am positivly sure that only certain parts of it are really time critical. 3D graphics and physics engine, for example.
But large parts of it can be made in almost any language.
Refer to the port of Quake to DotNet. Or just remember that scenery and artificial intelligence are often coded in a more or less proprietary scripting Language.
So - profile your code and see which parts are the real bottlenecks.
Then optimize these and their surroundings.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
I've got a popup dialog, which pops up near the mouse click. As the mouse can be clicked near the edge of a screen, it could fall outside the visible area. I could use GetSysParams (CX / CY_SCREEN), but I'm trying to be good and multimonitor aware.
In my ramblings, I'm sure I've come across a function along the lines of:
BOOL AdjustRectangleToMakeItBeOnAScreen (RECT *rc, UINT fFlags);
in the past, but I can't find it...
I thought it was one of the shell's helper functions, but it doesn't appear to be their either.
Any clues?
Iain.
|
|
|
|
|
Dunno about that function you mention, but GetSystemMetrics(...) is still your friend here...
Look up the SM_CMONITORS , SM_XVIRTUALSCREEN and SM_YVIRTUALSCREEN values for more information.
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I found a couple of routines, GetNearestMonitor, and GetMonitorInfo (from memory), and rolled my own function in the end.
I might even post it!
Iain.
|
|
|
|
|
|
Thanks - I'll have to try that on my popup dialog. If it works, its a very neat solution
|
|
|
|
|
Just one point, it doesn't ensure dialogs are not split across multiple monitors. You might like to add that feature - it's annoying when they are...
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Well caught - I've just tested that it works as advertised, but I'll have to go with my brute force approach. It will commonly appear near the edge of the screen, so the risk of being split is quite high.
Thanks for the heads up Ryan!
Iain.
|
|
|
|
|
You're welcome. I've been bitten by the same thing
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
The difference between 'appear' on nearest monitor and FIT on nearest monitor...
People that start writing code immediately are programmers (or hackers), people that ask questions first are Software Engineers - Graham Shanks
|
|
|
|
|
Blake Miller wrote: The difference between 'appear' on nearest monitor and FIT on nearest monitor...
Exactly
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
How an exe should automatically be deleted after completing its execution? Thank you.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
you mean you want to make an exe that executes and deletes itself then ?
simply make him delete the file... there's no problem when the program is launched in memory...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
Here I like to delete automatically.
Not to delete manually.
Nice talking to you.
If you judge people, you have no time to love them. -- Mother Teresa
|
|
|
|
|
|
See here.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Am working on VC 6.0, though have a small prob...
Suppose the declaration s like
classA[] obj = new classA[]{};
now when i try to access
int k = 0;
obj[k] = numeral;
it says array index out of bounds, tat means it needs a max size right?
so how do i define a max no of elements in the array size?
|
|
|
|
|
What about:
classA *obj = new ClassA[some_number];
obj[0] = numeral;
obj[1] = numeral;
...
obj[some_number-1] = numeral;
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
|
|
|
|
|
Forgot to mention, have to dynamically increase/decrease the size of the array!
|
|
|
|
|
Why don't you use a vector from the standard template library ? It offers all this flexibility and is much more secure.
|
|
|
|
|
this is not VB, so no possible directly.
is you have to increase/decrease the size of your array you could either do it yourself :
- allocate a new array with the new size
- copy the elements to keep from the old array
- destroy the old array.
or use a library that already do that for you :
- std::vector<>
- std::list<>
- some other STL containers...
TOXCCT >>> GEII power [toxcct][VisualCalc 2.24][3.0 soon...]
|
|
|
|
|
For debugging purposes, I am going to be basically hijacking a function that handles a variable argument list. This function convers the Variable Argument List (VAL) into a va_list variable and passes it to another function to process the variable argument list (like how one would make a call to _vsntprintf ).
I can descern the number and types of arguments from other parameters passed to the function, so I want to be able to trace information on the parameters passed. My question is this - it is safe (not possible, but safe) to call va_start multiple times on the same va_list variable (in the same function) to reset the VAL?
I cannot find code that does this, nor information that details the safety of doing so.
Thoughts?
Thanks!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
I've never encountered a mention of this scenario myself, but from the possibilities to implement this, it is OK. (the two implementation I've seen so far use a pointer to thestack, initialized by va_start, incremented by va_arg, and a do-nothing operation in va_end)
The question is: how portable do you need it?
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|
|
There are no portability concerns here - this is, and always will be, a Win32 implementation. Only concerns would be compiler differences if/when this implementation is built on a newer version of the compiler.
My concern is one of works vs. correct. It might work, but is it correct to do so, so I will not expect any side-effects in the future.
I do not expect it to be a problem, because va_start just resets the internal pointer to the beginning of the argument list, and there seems to be no other state stored outside of calls to va_arg , but it is always worth asking to make sure noone else has tried this and bombed!
Thanks!
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Avoid driving a vehicle taller than you and remember that Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
James R. Twine wrote: but it is always worth asking to make sure noone else has tried this and bombed!
tell us if it does
Some of us walk the memory lane, others plummet into a rabbit hole
Tree<t> in C# || Fold With Us! || sighist
|
|
|
|