どのように私は、マウスボタンが離されたかどうかを確認した後、ボーランドパスカル7.0に一度の手順を実行することができますか?

StackOverflow https://stackoverflow.com/questions/2575529

  •  24-09-2019
  •  | 
  •  

質問

私は、BorlandのPascal 7.0を使用して、私は(3乱数が同じ場合は、あなたが勝つ)のスロットゲームを作りたいと思います。問題は、私はメニューの開始(Inditas)ボタンをクリックしたときに私は、マウスのボタンを離すまで、手順は何度も実行していることです。私は、マウスのボタンを1回の手順を実行する前にリリースされた場合、私がチェックする必要があることを言われました。どうやってやるの?

:ここでは、メニューは次のようになります。
procedure eger;
begin;
  mouseinit;
  mouseon;
  menu;
  repeat  
    getmouse(m);
    if (m.left) and (m.x>60) AND (m.x<130) and (m.y>120) and (m.y<150) then
      teglalap(90,90,300,300,blue);
    if (m.left) and (m.x>60) AND (m.x<130) and (m.y>160) and (m.y<190) then
      jatek(a,b,c,coin,coins);     

  until ((m.left) and (m.x>60) AND (m.x<130) and (m.y>240) and (m.y<270));
end;

おかげで、ロバート

役に立ちましたか?

解決

場合は、マウスの単位は、マウスのクリック、または似たような、
を待つ方法を提供していません。 あなたはフラグ変数のカップルと「ボタン解放」動作をシミュレートすることができます。

例:

button_down := false; // 1
repeat
   button_released := false; // 2
   getmouse(m);
   // 3
   If m.left and not button_down Then button_down := true;
   If not m.left and button_down Then
   Begin
      button_released = true; 
      button_down := false;
   End;
   //
  if button_released and ... then ...
  if button_released and ... then ...
until (...);

(私は何であるかm.left知らないが、私はそれは左のボタンが押されているか否かを示すと仮定)。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top