File: ruby.hpp

package info (click to toggle)
higan 094-5
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 9,780 kB
  • ctags: 15,643
  • sloc: cpp: 103,963; ansic: 659; makefile: 531; sh: 25
file content (98 lines) | stat: -rwxr-xr-x 2,022 bytes parent folder | download | duplicates (5)
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
/*
  ruby
  version: 0.11 (2013-12-19)
  license: public domain
*/

#ifndef RUBY_H
#define RUBY_H

#include <nall/nall.hpp>

namespace ruby {

#include <ruby/video.hpp>
#include <ruby/audio.hpp>
#include <ruby/input.hpp>

struct VideoInterface {
  void driver(const char* driver = "");
  const char* optimalDriver();
  const char* safestDriver();
  const char* availableDrivers();
  bool init();
  void term();

  bool cap(const nall::string& name);
  nall::any get(const nall::string& name);
  bool set(const nall::string& name, const nall::any& value);

  bool lock(uint32_t*& data, unsigned& pitch, unsigned width, unsigned height);
  void unlock();
  void clear();
  void refresh();

  VideoInterface();
  ~VideoInterface();

private:
  Video* p = nullptr;
};

struct AudioInterface {
  void driver(const char* driver = "");
  const char* optimalDriver();
  const char* safestDriver();
  const char* availableDrivers();
  bool init();
  void term();

  bool cap(const nall::string& name);
  nall::any get(const nall::string& name);
  bool set(const nall::string& name, const nall::any& value);

  void sample(uint16_t left, uint16_t right);
  void clear();

  AudioInterface();
  ~AudioInterface();

private:
  Audio* p = nullptr;
};

struct InputInterface {
  nall::function<void (nall::HID::Device& device, unsigned group, unsigned input, int16_t oldValue, int16_t newValue)> onChange;

  void driver(const char* driver = "");
  const char* optimalDriver();
  const char* safestDriver();
  const char* availableDrivers();
  bool init();
  void term();

  bool cap(const nall::string& name);
  nall::any get(const nall::string& name);
  bool set(const nall::string& name, const nall::any& value);

  bool acquire();
  bool unacquire();
  bool acquired();

  nall::vector<nall::HID::Device*> poll();
  bool rumble(uint64_t id, bool enable);

  InputInterface();
  ~InputInterface();

private:
  Input* p = nullptr;
};

extern VideoInterface video;
extern AudioInterface audio;
extern InputInterface input;

};

#endif