|
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.
|
|
|
|
|
bravo! -- SAB = Simple and Beautiful
|
|
|
|
|
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
|
|
|
|
|
Yes, i've tried it few months ago, and it worked (no texture but extruded font letters). It was MUCH faster than this one (btw this one is really slow even on P3/550).
And I think not using OpenGL is good idea, because one can think the best part of an application is aboutbox )
Vasek
|
|
|
|
|
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
|
|
|
|
|
Hey Pablo,
One could really get the feeling that you are writing apps that consists of nothing than an About box...
BTW: Really cool controls, man!
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
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!
|
|
|
|
|