Giter VIP home page Giter VIP logo

cvents's Introduction

keyvents

A key press event library for C
A simple demonstration is found in main.c Note: this is meant to be ran in unix/linux/macos systems, I have not tested it on windows
Supports the BASH shell


Creating Events

Events are represented with functions

Single Keypress Functions

  • Normal events do not return a value and take no parameters
  • void trigger() {...}

Global Keypress Functions

  • Global events do not return a value but take a character
    • The character is the key that was pressed
  • void trigger(char ch) {...}

TERM_MT()

  • Reccommended to be used at the end of a multithreaded single keypress function

Setting Up Events

KEY_INIT_ENTER()

  • Execute this before setting up your events

KEY_INIT_EXIT()

  • Execute this after setting up your events

use_key(char key, void *function, <optional> thread)

  • Binds a keypress to a function
  • The function must be a single keypress function
  • thread specifies if you want the event to run on a seperate thread (optional)
    • Use USE_MT or NO_MT
    • By default, the trigger will not be multithreaded
  • Example: use_key('a', key_a_event)

use_global(void *function)

  • Triggers a function when any key is pressed
  • The function must be a global keypress function
  • Example: use_global(global_event)

cvents's People

Contributors

fisharmnic avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.