Allegro.cc - Online Community

Allegro.cc Forums » Programming Questions » if somebody press Esc he go to another function

This thread is locked; no one can reply to it. rss feed Print
if somebody press Esc he go to another function
Kikaru
Member #7,616
August 2006
avatar

You are moving the bits from this [random example]: (you want the bold part) 1011010010011101 to 0000000010110100. It just moves it down to where you can "see" it. :)

Kauhiz
Member #4,798
July 2004

Think about it! readkey()>>16 would be 00000000 00000000!

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

GullRaDriel
Member #3,861
September 2003
avatar

LennyLen: You were right (the post just after mine)
Evert: You are a model of patience.

and ... no , wait, I can not say that :-p

"Code is like shit - it only smells if it is not yours"
Allegro Wiki, full of examples and articles !!

a b
Member #8,092
December 2006

ok thanks :)

And if I want that game will stop untill somebody press ENTER or ESC can I write that ???

 int k; 
         k= readkey()>>8; 
        
        while (k==KEY_ESC&&k==KEY_ENTER)
        {
          k= readkey()>>8;
        }
................

Evert
Member #794
November 2000
avatar

Spot the mistake:

Quote:

ENTER or ESC

Quote:

(k==KEY_ESC&&k==KEY_ENTER)

LennyLen
Member #5,313
December 2004
avatar

Quote:

Spot the mistake:

puts hand up Me sir, me!!!

a b
Member #8,092
December 2006

sorry I shoulded write "AND" :) hehhe
ok thanks :)

LennyLen
Member #5,313
December 2004
avatar

Quote:

sorry I shoulded write "AND"

You mean you want them to have to press both keys at the same time?!?!

Richard Phipps
Member #1,632
November 2001
avatar

Quote:

sorry I shoulded write "AND" :) hehhe

Richard casts Knights of the Round on a b

Kauhiz
Member #4,798
July 2004

Quote:

You mean you want them to have to press both keys at the same time?!?!

I think he means he shouldn't have written &&.

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

a b
Member #8,092
December 2006

"and" but I wrong write because in the past I had:

readkey();
        while (!key[KEY_ESC]&&!key[KEY_ENTER])
        {
          readkey();
        }

so now it should be:

   int k; 
         k= readkey()>>8; 
        
        while (k!=KEY_ESC&&k!=KEY_ENTER)  //previous I had wrong write: //k==KEY_ESC&&k==KEY_ENTER :)
        {
          k= readkey()>>8;
        }

sorrrrrrrry - little mistake :)

Kauhiz
Member #4,798
July 2004

So you do want the player to press two keys!?

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

a b
Member #8,092
December 2006

I want that somebody pressing keys while key is diffrent from ESC and diffrent from ENTER

Richard Phipps
Member #1,632
November 2001
avatar

LennyLen
Member #5,313
December 2004
avatar

Actually, his code is right, since NOT(a OR b) = NOT(a) AND NOT(b).

Richard Phipps
Member #1,632
November 2001
avatar

a b
Member #8,092
December 2006

:)

LennyLen
Member #5,313
December 2004
avatar

It might have made more sense to people if you'd expressed it this way:

while (!(k == KEY_ESC || k == KEY_ENTER))

a b
Member #8,092
December 2006

ok thanks :)

Kauhiz
Member #4,798
July 2004

Oh, true. Does this mean that the problem has been solved!?!? The thread is over! :o

---
It's Ridge Racer! RIIIIIDGE RAAAAACER!

a b
Member #8,092
December 2006

yes.........

Richard Phipps
Member #1,632
November 2001
avatar

LennyLen
Member #5,313
December 2004
avatar

Now, can anybody remember the name of the formula that states NOT(a OR b) = NOT(a) AND NOT(b)? It can also be expressed in set notation as ~(A U B) = ~A ^ ~B. Actually, it's two formulae, with the second one being ~(A ^ B) = ~A U ~B.

X-G
Member #856
December 2000
avatar

De Morgan's laws. Now for the love of all that is unholy, let this topic die. It makes baby Eris cry.

--
Since 2008-Jun-18, democracy in Sweden is dead. | 悪霊退散!悪霊退散!怨霊、物の怪、困った時は ドーマン!セーマン!ドーマン!セーマン! 直ぐに呼びましょう陰陽師レッツゴー!

LennyLen
Member #5,313
December 2004
avatar

Thanks, that's been bugging me for two hours now. I finally tracked down my Tables and Formulae booklet only to find that it didn't have those formulae anyway!

Quote:

Now for the love of all that is unholy, let this topic die.

This thread is too unholy to die. It's undead.



Go to: