All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.daxie.joglf.gl.input.keyboard.Keyboard Maven / Gradle / Ivy

There is a newer version: 11.7.0
Show newest version
package com.daxie.joglf.gl.input.keyboard;

import com.daxie.joglf.gl.input.CountsAndFlags;
import com.jogamp.newt.event.KeyEvent;
import com.jogamp.newt.event.KeyListener;

/**
 * Keyboard
 * @author Daba
 *
 */
public class Keyboard implements KeyListener{
	private final int ALPHABET_KEY_NUM=26;
	private final int ARROW_KEY_NUM=4;
	private final int FUNCTION_KEY_NUM=12;
	private final int NUM_KEY_NUM=10;
	private final int NUMPAD_KEY_NUM=10;
	
	private CountsAndFlags alphabet_keys;
	private CountsAndFlags arrow_keys;
	private CountsAndFlags function_keys;
	private CountsAndFlags num_keys;
	private CountsAndFlags numpad_keys;
	
	private CountsAndFlags alt_key;
	private CountsAndFlags at_key;
	private CountsAndFlags back_slash_key;
	private CountsAndFlags back_space_key;
	private CountsAndFlags colon_key;
	private CountsAndFlags comma_key;
	private CountsAndFlags ctrl_key;
	private CountsAndFlags delete_key;
	private CountsAndFlags enter_key;
	private CountsAndFlags escape_key;
	private CountsAndFlags home_key;
	private CountsAndFlags minus_key;
	private CountsAndFlags num_lock_key;
	private CountsAndFlags period_key;
	private CountsAndFlags semicolon_key;
	private CountsAndFlags shift_key;
	private CountsAndFlags slash_key;
	private CountsAndFlags space_key;
	private CountsAndFlags tab_key;
	
	public Keyboard() {
		alphabet_keys=new CountsAndFlags(ALPHABET_KEY_NUM);
		arrow_keys=new CountsAndFlags(ARROW_KEY_NUM);
		function_keys=new CountsAndFlags(FUNCTION_KEY_NUM);
		num_keys=new CountsAndFlags(NUM_KEY_NUM);
		numpad_keys=new CountsAndFlags(NUMPAD_KEY_NUM);
		
		alt_key=new CountsAndFlags(1);
		at_key=new CountsAndFlags(1);
		back_slash_key=new CountsAndFlags(1);
		back_space_key=new CountsAndFlags(1);
		colon_key=new CountsAndFlags(1);
		comma_key=new CountsAndFlags(1);
		ctrl_key=new CountsAndFlags(1);
		delete_key=new CountsAndFlags(1);
		enter_key=new CountsAndFlags(1);
		escape_key=new CountsAndFlags(1);
		home_key=new CountsAndFlags(1);
		minus_key=new CountsAndFlags(1);
		num_lock_key=new CountsAndFlags(1);
		period_key=new CountsAndFlags(1);
		semicolon_key=new CountsAndFlags(1);
		shift_key=new CountsAndFlags(1);
		slash_key=new CountsAndFlags(1);
		space_key=new CountsAndFlags(1);
		tab_key=new CountsAndFlags(1);
	}
	
	@Override
	public void keyPressed(KeyEvent e) {
		if(e.isAutoRepeat()==true)return;
		
		//Alphabet keys
		char key_char=e.getKeyChar();
		char ch_temp;
		
		ch_temp='A';
		for(int i=0;i




© 2015 - 2025 Weber Informatics LLC | Privacy Policy