 |

|
3Q for your great job.
|
|
|
|

|
Thanks this good code.
I use it in my aboutbox : )
But sometimes text stop scrolling on start time.
I find on my computer it is caused by this code:
>>DWORD t1 = GetTickCount();
>>InvalidateCtrl();
>>DWORD t2 = GetTickCount();
>>t2 -= t1; // = 50 on my system
>>m_nScrollSpeed = (m_nScrollSpeed * t2)/50;
After remark "nScrollSpeed = (m_nScrollSpeed * t2)/50;", every thing is ok.
may be sometimes t2 == 0.
Regards
zl@nanjing-fnst.com : )
|
|
|
|

|
Thanks very much,
I also met such a bug....
you fix works very well!
|
|
|
|

|
Hello
I included an instance of this (nice class) into my dialog, but I have no idea if the timer is destroyed , and tried KillTimer() but it seems NOT working
Anyone has an idea?
Cheers
Alex
|
|
|
|

|
If you change the last for-loop in the DoScrollText function with the following the text does a bette fade-out. The value 1.5 affects the angle of the text scroll:
//-------------------
double yDest = nHeight-1;
// shrink text from bottom to top to create Star Wars effect
for (int y = nHeight-1; y >= 0; --y)
{
double nScale = (double)y/(double)nHeight;
int nOffset = (int)(nWidth - nWidth*nScale)/2;
yDest -= __min(1, nScale * 1.5);
m_MainDC.StretchBlt(nOffset, (int) yDest, (int)(nWidth*nScale), 1, &memDC, 0, y, nWidth, 1, SRCPAINT);
}
//------------------
|
|
|
|

|
I downloaded the source, compiled and ran. Everything looked good when it started. Then after five minutes, it stalled. If I closed a large app like visual C++, the program would kinda start again. Then stall again. Sometimes, it would even crash. Often the point of stalling would be proceeded by some intermittent hard disk activity.
I then looked through the code and I found what looked like the bug
void CStarWarsCtrl::DoScrollText(CDC *pDC)
{
...
memDC.SelectObject(&memBitmap);
...
}
The problem is that there is no call to SelectObject() to switch back to the original bitmap. From what I learned from Joseph M. Newcomer, I would conclude that this bug exhausted my GDI heap.
Here's the fix. We only need to add code to switch back to the original bitmap
void CStarWarsCtrl::DoScrollText(CDC *pDC)
{
...
pOldBitmap = memDC.SelectObject(&memBitmap);
...
memDC.SelectObject(pOldBitmap);
}
I noticed that no one else had flagged this bug on the message board. I'm thinking that everybody else was using WinNT/XP/2000 which has a larger GDI heap than the very limited GDI heap of Win98, my OS. Yes, I know I should I junk my AMD K6-233, and get a real machine with XP. However, I would boast that there are some bugs that my computer can flag that current computers can't.
|
|
|
|

|
Thanks!!!!
|
|
|
|

|
Good call.
My code isn't buggy. Those are all fleatures.
|
|
|
|
|

|
This would look really good with the text texture mapped onto a quad moving off into the distance while fading.
If only I had the time...
"If lobsters looked more like puppies, people wouldn't put them in boiling water while they're still alive." - George Carlin
|
|
|
|
|

|
If not, as soon as I have some free time I will port it to C# and share it here.
Great job!!
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|

|
I write here: http://blog.beyondsolutions.it/?p=108 a little c# porting.
I hope that it's useful.
Thank's Pablo !
|
|
|
|

|
While nice, the "fading" effect is not enough IMO. It'd be so much cooler if you make font sizes and line distance for those "faraway" text lines smaller and smaller, so that they look really like slowly moving into the "galaxy far far away" instead of being abruptly enveloped by "the dark side".
I'm not sure if that's easy to implement, though, just a thought.
|
|
|
|

|
We know who the successor to Yoda will be.
William
|
|
|
|

|
First of all, great job! A small suggestion: remove "#include stars.h" from StarWarsCtrl.h so it can be used in other apps without editing.
Thanks,
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|

|
The only problem is that the text doesn't really shrink properly (it shrinks horizontally but not vertically, giving the effect that the text is on a curved surface)
--
Help me! I'm turning into a grapefruit!
|
|
|
|

|
Maybe Speilburg and Lucas got it wrong and space is actually curved, thus this could be construed as a correction.
Regardz
Colin J Davies
Sonork ID 100.9197:Colin
I am sick of fighting with Martin, I think I will ignore his posts from here on in, and spend the time working on articles instead.
Christian Graus
|
|
|
|

|
That's right!! Space IS curved.
Einstein proved it with his famous prediction of the light from a distant star appearing closer to the sun than it actually was, due to the bend it sustained from the gravity of the sun (as it passed by the sun) on its way to the earth, as observed by us.
This happened during a solar eclipse when the moon was between the earth and the sun, such that only the corona of the sun could be seen.
William
|
|
|
|

|
WREY wrote:
due to the bend it sustained from the gravity of the sun
As far as I know (not very far), there is a theory of duality of light, that says something to the effect that light can be both matter or energy. So, being the former, it would be attracted by gravity. But not because the space is curved.
I saw that long long time ago and I never really care a lot, so I don't remember very well.
-- LuisR
──────────────
Luis Alonso Ramos
Chihuahua, Mexico
www.luisalonsoramos.com
"Do not worry about your difficulties in mathematics, I assure you that mine are greater." -- Albert Einstein
|
|
|
|

|
The "Theory of Duality" is not about light. It's about the electron and its orbit around the nucleus of the atom.
It states (in part) that the electron is BOTH "matter" and a "wave" at the SAME TIME!! Indeed, that it CANNOT exist separately at any single moment; it HAS to be BOTH. However, (and this is where you have to get the concept right) it can ONLY be viewed or determined as ONE at any one time. This means, even though the electron possesses both characteristics, you can ONLY work or study it as ONE, at any one time (NOT BOTH at the same time).
That is why you can ONLY tell one of these two things with it: As "matter" you can tell where the electron is (i.e., its "position"), OR as a "wave", how fast it is moving, but not both things AT THE SAME TIME.
This was the postulate of the German physicist, Werner Karl Heisenberg, based on the postulates of the Danish physicist, Niels Bohr, that
First Postulate (on stationary states): In the atom there are orbits in which an orbiting electron does not radiate.
Second Postulate (on quantum jumps): Radiation only occurs when an electron jumps from one stationary orbit to another.
Heisenberg tried to explain the Bohr's postulate by stating that the motion of the atomic electron cannot be pictured as the motion of a small ball along a trajectory. One simply cannot follow its motion as closely as one would follow the motion of a billard ball, and to do so, one would be seeking answers from asking the wrong questions which would yield WRONG answers.
Heisenberg contended that to obtain the correct answers to those questions, we must ask the sort of questions that "describe motion in the atom." This means, formulate an equation that mathematically asks the question.
Up until that time, everyone had been using the equations of electrodynamics to find the hypothetical trajectory x(t) of an electron in the atom, a trajectory that would have a continuous dependency on time, and could be expressed as the series of numbers x1, x2, x3, ... -- the positions of the electron at t1, t2, t3, ..., respectively.
Heisenberg held that there was no such trajectory in the atom, and that instead of a continuous curve x(t) there was a set of discrete numbers x(nk), where n and k are the numbers of the initial and final states of the electron, hence, a matrix.
These are the stuff of Quantum Mechanics.
William
|
|
|
|

|
Damn...imagine the responses for something more complex than scrolling text...
|
|
|
|

|
The "theory of duality" IS about light.
E=mc² says that energy has matter.
G. Steudtel
|
|
|
|

|
Quoting the famous equation does not put the subject in the proper context of "duality" because there is no duality there; energy IS matter, and matter IS energy. The equation does not speak of duality. It speaks of "sameness".
Duality speaks of the two states of the electron in the atom: either its speed can be noted, OR its position can be noted (meaning, which orbit it occupies), but NOT BOTH at the SAME time. This being ironic since the electron inherently possesses BOTH characteristics. That is "duality" (the same element but with a kind of dual personality, of which only one can be noted at a time, but NOT BOTH at the same time).
William
Fortes in fide et opere!
|
|
|
|

|
".......there; energy IS matter, and matter IS energy. The equation...." -The 'energy IS matter' statement can never be correct since in the 3rd dimension energy comes from heat, but in the 4th dimension energy is all. So energy isn't always matter because you can't see a magnetic wave or sound wave, those are also part of energy or electricity. HELLO! And BTW, your label control is brilliant!
|
|
|
|

|
I don't know which dimension you're in, but if it's the '3rd', let's begin with:
E = mc²
Energy is equal to matter times the speed of light squared. If you think the equation is right, then clearly you can see that matter is an integral part of Energy. IOW, you cannot have Energy without matter as you cannot have matter without Energy.
If you think the equation is wrong, then let's see the correct one, and let's hear why you think Einstein and the thousands of other physicists (like him) who have subjected the equation to all sorts of rigorous test, are wrong!! Show us what you know for a fact is the correct one.
For you to say that, "energy isn't always matter," sounds like you're saying that, "sometimes Energy is matter, and at other times Energy isn't matter." That sounds to me like you're saying, "energy is a variable" (that sometimes it's one thing, but at other times it's something else). If that's the case, then Einstein's equation is wrong, because at one time:
E = mc²
would be right, and at other times, the equation would be:
Ev = mc²
would be right (showing Energy as a variable), which means we'd have two distinct 'Energies' (one for when it's matter, and the other for when it's NOT matter). Now all of a sudden, the Universe is comprised of two different kinds of 'Energies'.
So let me ask you, "Which one of these is the one that produces heat?"
"And where does that energy (the one that produces heat) gets its energy to produce heat?"
Would that be from itself? Like the sun?
That couldn't be right, because the sun is made up of gravitational matter so dense, you would not be able to move or pick up a piece of it the size of a button!!
So which would be coming from the sun? Heat? or Energy?
That would have to be energy, because (according to you) heat is what comes from energy, and now we are left with energy coming from heavy gravitational matter. WOW!!!
Are you sure you're living in the 3rd dimension? HELLO!!!
William
Fortes in fide et opere!
|
|
|
|

|
Equation E=mc² does not say energy is or has matter and vice versa. It says only that some amount of energy can be transformed to some amount of matter and vice versa. This has been prooven in both directions.
Somebody mentioned here that duality means you can measure speed or position but not both, this is however called principle of uncertainty and has nothing to do with duality of light. Even more it is not about speed and about light at all.
Duality of light was about treating light sometimes like beam of photon particles and sometimes like electromagnetic waves, but since days of theory of quantum electrodynamics, which describes exactly all properties and interactions of light and matter except nuclear decay, this principle of duality is no more valid.
Einstein says, and until now he is still according all known facts correct, that no object in our universe which is composed from matter can travel at speed of light. This implies directly that LIGHT HAS NO MATTER therefore it cannot be affected by gravitational force and that finally means THE SPACE IS CURVED.
This is how it works in our 4-dimensional timespace. May be there are other dimensions we cannot see and general relativity can be even more generalized, but that is out of scope of this discussion.
I apologize for bad English, my native language is Czech.
|
|
|
|
|

|
5... for being such a geek. You rock.
My code isn't buggy. Those are all fleatures.
|
|
|
|

|
In this case the sun would have to be right behind the viewers eyes and weigh many many many many ... many many many tons .
|
|
|
|

|
I've been wanting to write one of these for a few year now. You've saved me a job. Good work and thanks.
Michael
Look, try and use your intelligence, man, even if you are a politician. - The Doctor
|
|
|
|

|
cool, cool, you're a creative guy...
Regards
Stefan
When I was young my mother told me to clean up my room, I told her -1!
|
|
|
|

|
This is a Real Beauty
Great Man
|
|
|
|

|
Great stuff!!! I rated this article 5 because it won't let me rate it any higher - this is very cool! Thanks for sharing!
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
 |
|