Welcome to Pauls PureProject
 Home Online Reference Guide duplicated from http://cvs.purebasic.com  
 Online Resources
   · Reference

 Libraries
     2DDrawing
     Billboard
     Camera
     CDAudio
     Cipher
     Clipboard
     Console
     Database
     Date
     Desktop
     Engine3D
     Entity
     File
     FileSystem
     Font
     Gadget
     Help
     Image
     ImagePlugin
     Joystick
     Keyboard
     Library
     Light
     LinkedList
     Material
     Math
     Memory
     Menu
     Mesh
     Misc
     Module
     Mouse
     Movie
     Network
     OnError
     Packer
     Palette
     Particle
     Preference
     Printer
     Requester
     Sort
     Sound
     SoundPlugin
     Sprite
     Sprite3D
     StatusBar
     String
     SysTray
     Terrain
     Texture
     Thread
     Toolbar
     Window

 KeyboardReleased

Syntax

Result = KeyboardReleased(KeyID)
Description
Returns 1 if the specified key has been pushed and released, else it returns 0. This command is very useful for switch key check, like a 'Pause' key in a game (one time the game is paused, next time it will continue). The command ExamineKeyboard() must be called before this command to update the keyboard state. The keyboard behaviour can be changed with KeyboardMode(). For a full list of KeyID values, look at KeyboardPushed().

Example:
  If InitSprite() And InitKeyboard() And OpenScreen(800,600,16,"")
    Paused = #False
    Repeat
      FlipBuffers()
      
      If StartDrawing(ScreenOutput())
        
        ExamineKeyboard()
        If KeyboardReleased(#PB_Key_P)
          If Paused = #False
            Paused = #True
          Else
            Paused = #False
          EndIf
        EndIf
        
        DrawingMode(0)
        Locate(20,20)

        If Paused = #False
          DrawText("Program is running...")
        Else
          DrawText("Program paused...    ")
        EndIf

        StopDrawing()
      EndIf
    Until KeyboardPushed(#PB_Key_Escape)
  EndIf

Supported OS

Windows, AmigaOS, Linux

<- KeyboardPushed() - Keyboard Index



Hosted by Reel Media Productions Copyright©2001-2004 All Rights Reserved