File: keymap.h

package info (click to toggle)
literki 0.0.0+20100113.git1da40724-1.2
  • links: PTS, VCS
  • area: main
  • in suites: sid, stretch
  • size: 3,444 kB
  • ctags: 1,153
  • sloc: cpp: 5,263; makefile: 72
file content (43 lines) | stat: -rw-r--r-- 794 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
#ifndef _KEYMAP_H
#define _KEYMAP_H

#include <string>
#include <vector>

class Keymap {
  public:
    Keymap();
    void ReadMap(const std::string& filename);

    struct Key {
	Key(int a, int b, int c, int d):px(a),py(b),w(c),h(d){}
	int px, py, w, h;
	std::string look;
	std::string action;
    };


    const std::vector<Key>& GetCurrentKeys() const;
    bool GetKey(int x, int y, Key* k) const;
    std::string GetAction(int x, int y);
    void SetFunction(std::string f);

    int Height() const;
    int Width() const;

    int CurrentFunction() const;


  private:
    int GetFunId(std::string f);
    int width, height;
    std::vector<std::vector<Key> > keys;
    std::vector<std::string> functions;
    int function;
    bool is_alt;
    bool is_ctrl;
    bool keep_fun;
};


#endif