G
G
Gokilla2018-03-28 18:41:14
C++ / C#
Gokilla, 2018-03-28 18:41:14

Is the function called constantly in the process?

bool__ keyboard::IsKeyUp(byte key, bool__ bonus)
{
  if (keyboard__->msg_->message == WM_KEYUP && !bonus)
  {
    switch (key)
    {
    case VK_F1:
    {
      setF(false, 0);
      //setF(true, 0);
      break;
    }
    case VK_F2:
    {
      setF(false, 1);
      //setF(true, 1);
      break;
    }
    case VK_F3:
    {
      setF(false, 2);
      //setF(true, 2);
      break;
    }
    case VK_F4:
    {
      if (getF(3))
        SetBet_(GetBet_() + 1);
      setF(false, 3);
      //setF(true, 3);
      break;
    }
    case VK_F5:
    {
      setF(false, 4);
      //setF(true, 4);
      setdone(true);
      break;
    }
    }
  }
  else if (keyboard__->msg_->message == WM_KEYUP && bonus)
  {
      switch (key)
      {
      case VK_F1:
      {
        setF(false, 1);
        break;
      }
      case VK_F2:
      {
        setF(false, 0);
        GetRandom();
        break;
      }
      case VK_F3:
      {
        setF(false, 2);
        GetRandom();
        break;
      }
      case VK_F4:
      {
        setF(false, 3);
        GetRandom();
        break;
      }
      case VK_F5:
      {
        setF(false, 4);
        GetRandom();
        break;
      }
      }
    
  }
  return(true);
}
void__ keyboard::Update(bool__ bonus)
{
  keyboard__->Update();
  IsMouseButtonDown(GetPressedKey(),bonus);
  IsMouseButtonUp(GetPressedKey(), bonus);
  IsKeyDown(GetPressedKey(), bonus);
  IsKeyUp(GetPressedKey(), bonus);
}
void__ Game::draw_screen()
{
    while(run)
    {
        Math_->Update(&run,bonus);
    }
}
void__ Math::Update(bool__*isExecuted,bool__ bonus)
{
#if keyboardsupport==1
    if(!Drum_->GetAllRoll())
        keyboard_->Update(bonus);
#endif
    RotateIn();
    if(GetDone())
    {
*isExecuted=false;
        Destroy();
    }
}
GLvoid Keyboard::Update()
{
  if(PeekMessage(msg_,0,0,0,PM_REMOVE)&&msg_->message!=WM_QUIT)
  {
    TranslateMessage(msg_);
    DispatchMessage(msg_);
  }
  return;
}

the second part with a bonus function GetRandom () in an infinite loop, in short, constantly calls keyup i.e. matches the condition VK_KEYUP and VK_F2,VK_F3,VK_F4,VK_F5 I want GetRandom() to be called only once per pressed key, and it is constantly called when switching to the bonus part of the game bonus==true

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry Alexandrov, 2018-03-28
@jamakasi666

Hm

setdone(true);
damn suspicious.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question