reflexion 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/ChangeLog +8 -0
- data/README +4 -0
- data/Rakefile +70 -0
- data/VERSION +1 -0
- data/examples/hello/Rakefile +41 -0
- data/examples/hello/main.cpp +18 -0
- data/examples/ruby/app.rb +13 -0
- data/examples/ruby/checker.rb +41 -0
- data/examples/ruby/fps.rb +49 -0
- data/examples/ruby/hello.rb +38 -0
- data/examples/ruby/key.rb +44 -0
- data/examples/ruby/shapes.rb +124 -0
- data/examples/ruby/text.rb +35 -0
- data/ext/reflex/application.cpp +151 -0
- data/ext/reflex/extconf.rb +57 -0
- data/ext/reflex/key.cpp +128 -0
- data/ext/reflex/native.cpp +22 -0
- data/ext/reflex/points.cpp +160 -0
- data/ext/reflex/reflex.cpp +83 -0
- data/ext/reflex/reflex.h +39 -0
- data/ext/reflex/window.cpp +357 -0
- data/include/reflex/application.h +50 -0
- data/include/reflex/defs.h +258 -0
- data/include/reflex/helpers.h +32 -0
- data/include/reflex/reflex.h +26 -0
- data/include/reflex/ruby/application.h +39 -0
- data/include/reflex/ruby/key.h +39 -0
- data/include/reflex/ruby/points.h +39 -0
- data/include/reflex/ruby/reflex.h +21 -0
- data/include/reflex/ruby/window.h +39 -0
- data/include/reflex/ruby.h +14 -0
- data/include/reflex/window.h +79 -0
- data/include/reflex.h +13 -0
- data/lib/reflex/application.rb +25 -0
- data/lib/reflex/autoinit.rb +11 -0
- data/lib/reflex/bounds.rb +133 -0
- data/lib/reflex/helpers.rb +52 -0
- data/lib/reflex/module.rb +30 -0
- data/lib/reflex/point.rb +69 -0
- data/lib/reflex/reflex.rb +21 -0
- data/lib/reflex/window.rb +65 -0
- data/lib/reflex.rb +11 -0
- data/reflex.gemspec +57 -0
- data/src/cocoa/application.mm +90 -0
- data/src/cocoa/applicationdata.h +51 -0
- data/src/cocoa/cocoaapplication.h +19 -0
- data/src/cocoa/cocoaapplication.mm +180 -0
- data/src/cocoa/cocoawindow.h +44 -0
- data/src/cocoa/cocoawindow.mm +171 -0
- data/src/cocoa/defs.h +34 -0
- data/src/cocoa/defs.mm +84 -0
- data/src/cocoa/openglview.h +17 -0
- data/src/cocoa/openglview.mm +186 -0
- data/src/cocoa/reflex.mm +68 -0
- data/src/cocoa/window.mm +118 -0
- data/src/cocoa/windowdata.h +51 -0
- data/src/defs.cpp +47 -0
- data/src/win32/defs.cpp +150 -0
- data/src/win32/opengl.cpp +95 -0
- data/src/win32/opengl.h +50 -0
- data/src/win32/reflex.cpp +65 -0
- data/src/win32/window.cpp +480 -0
- data/src/window.cpp +60 -0
- data/support.rb +56 -0
- data/task/ext.rake +42 -0
- data/task/gem.rake +33 -0
- data/task/git.rake +22 -0
- data/task/lib.rake +54 -0
- data/test/helpers.rb +15 -0
- data/test/test_bounds.rb +163 -0
- data/test/test_point.rb +81 -0
- data/test/test_reflex.rb +17 -0
- data/test/test_window.rb +39 -0
- metadata +173 -0
data/src/cocoa/defs.mm
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
#include "defs.h"
|
2
|
+
|
3
|
+
|
4
|
+
#import <Cocoa/Cocoa.h>
|
5
|
+
|
6
|
+
|
7
|
+
namespace Reflex
|
8
|
+
{
|
9
|
+
|
10
|
+
|
11
|
+
static const char*
|
12
|
+
get_chars (NSEvent* e)
|
13
|
+
{
|
14
|
+
NSString* chars = [e characters];//charactersIgnoringModifiers];
|
15
|
+
return [chars UTF8String];
|
16
|
+
}
|
17
|
+
|
18
|
+
static uint
|
19
|
+
get_current_point_type ()
|
20
|
+
{
|
21
|
+
NSUInteger buttons = [NSEvent pressedMouseButtons];
|
22
|
+
uint ret = 0;
|
23
|
+
if (buttons & (1 << 0)) ret |= POINT_MOUSE_LEFT;
|
24
|
+
if (buttons & (1 << 1)) ret |= POINT_MOUSE_RIGHT;
|
25
|
+
if (buttons >= (1 << 2)) ret |= POINT_MOUSE_MIDDLE;
|
26
|
+
return ret;
|
27
|
+
}
|
28
|
+
|
29
|
+
static uint
|
30
|
+
get_point_type (NSEvent* e)
|
31
|
+
{
|
32
|
+
switch ([e type])
|
33
|
+
{
|
34
|
+
case NSLeftMouseDown:
|
35
|
+
case NSLeftMouseUp:
|
36
|
+
case NSLeftMouseDragged:
|
37
|
+
return POINT_MOUSE_LEFT;
|
38
|
+
|
39
|
+
case NSRightMouseDown:
|
40
|
+
case NSRightMouseUp:
|
41
|
+
case NSRightMouseDragged:
|
42
|
+
return POINT_MOUSE_RIGHT;
|
43
|
+
|
44
|
+
case NSMouseMoved:
|
45
|
+
return get_current_point_type();
|
46
|
+
}
|
47
|
+
return 0;
|
48
|
+
}
|
49
|
+
|
50
|
+
static uint
|
51
|
+
get_modifiers (NSEvent* e)
|
52
|
+
{
|
53
|
+
NSUInteger flags = [e modifierFlags];
|
54
|
+
return
|
55
|
+
(flags & NSAlphaShiftKeyMask) ? MOD_CAPS : 0 |
|
56
|
+
(flags & NSShiftKeyMask) ? MOD_SHIFT : 0 |
|
57
|
+
(flags & NSControlKeyMask) ? MOD_CONTROL : 0 |
|
58
|
+
(flags & NSAlternateKeyMask) ? MOD_ALT : 0 |
|
59
|
+
(flags & NSCommandKeyMask) ? MOD_COMMAND : 0 |
|
60
|
+
(flags & NSNumericPadKeyMask) ? MOD_NUMPAD : 0 |
|
61
|
+
(flags & NSHelpKeyMask) ? MOD_HELP : 0 |
|
62
|
+
(flags & NSFunctionKeyMask) ? MOD_FUNCTION : 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
|
66
|
+
CocoaKey::CocoaKey (NSEvent* e)
|
67
|
+
: Key(get_chars(e), [e keyCode], get_modifiers(e), [e isARepeat] ? 1 : 0)
|
68
|
+
{
|
69
|
+
}
|
70
|
+
|
71
|
+
|
72
|
+
CocoaPoints::CocoaPoints (NSEvent* e, NSView* view)
|
73
|
+
: Points(
|
74
|
+
get_point_type(e), (coord) 0, (coord) 0, get_modifiers(e), [e clickCount],
|
75
|
+
[e type] == NSLeftMouseDragged || [e type] == NSRightMouseDragged)
|
76
|
+
{
|
77
|
+
NSPoint p = [e locationInWindow];
|
78
|
+
if (view) p = [view convertPoint: p fromView: nil];
|
79
|
+
x = p.x;
|
80
|
+
y = p.y;
|
81
|
+
}
|
82
|
+
|
83
|
+
|
84
|
+
};// Reflex
|
@@ -0,0 +1,17 @@
|
|
1
|
+
// -*- objc -*-
|
2
|
+
#import <AppKit/NSOpenGLView.h>
|
3
|
+
|
4
|
+
|
5
|
+
@interface OpenGLView : NSOpenGLView
|
6
|
+
|
7
|
+
{}
|
8
|
+
|
9
|
+
- (id) initWithFrame: (NSRect) frame;
|
10
|
+
|
11
|
+
- (id) initWithFrame: (NSRect) frame antiAlias: (int) nsample;
|
12
|
+
|
13
|
+
- (void) makeCurrent;
|
14
|
+
|
15
|
+
- (void) flushBuffer;
|
16
|
+
|
17
|
+
@end// OpenGLView
|
@@ -0,0 +1,186 @@
|
|
1
|
+
// -*- objc -*-
|
2
|
+
#import "openglview.h"
|
3
|
+
|
4
|
+
|
5
|
+
#include <vector>
|
6
|
+
#import <Cocoa/Cocoa.h>
|
7
|
+
#import <OpenGL/OpenGL.h>
|
8
|
+
#import "cocoawindow.h"
|
9
|
+
|
10
|
+
|
11
|
+
//#define TRANSPARENT_BACKGROUND
|
12
|
+
|
13
|
+
|
14
|
+
static bool
|
15
|
+
is_valid_antialias_nsample (int n)
|
16
|
+
{
|
17
|
+
return n == 0 || n == 2 || n == 4 || n == 6 || n == 8 || n == 16 || n == 32;
|
18
|
+
}
|
19
|
+
|
20
|
+
static NSOpenGLPixelFormat*
|
21
|
+
make_pixelformat (int antialias_nsample = 0)
|
22
|
+
{
|
23
|
+
if (!is_valid_antialias_nsample(antialias_nsample))
|
24
|
+
return nil;
|
25
|
+
|
26
|
+
static const NSOpenGLPixelFormatAttribute DEFAULT[] =
|
27
|
+
{
|
28
|
+
NSOpenGLPFAWindow,
|
29
|
+
//NSOpenGLPFAAccelerated,
|
30
|
+
NSOpenGLPFADoubleBuffer,
|
31
|
+
//NSOpenGLPFAColorSize, 24,
|
32
|
+
//NSOpenGLPFAAlphaSize, 8,
|
33
|
+
NSOpenGLPFADepthSize, 24,
|
34
|
+
//NSOpenGLPFANoRecovery,
|
35
|
+
};
|
36
|
+
static const NSOpenGLPixelFormatAttribute ANTIALIAS[] =
|
37
|
+
{
|
38
|
+
NSOpenGLPFASampleBuffers, 1,
|
39
|
+
NSOpenGLPFASamples, antialias_nsample,
|
40
|
+
};
|
41
|
+
static const size_t DEFAULT_SIZE = sizeof(DEFAULT) / sizeof(DEFAULT[0]);
|
42
|
+
static const size_t ANTIALIAS_SIZE = sizeof(ANTIALIAS) / sizeof(ANTIALIAS[0]);
|
43
|
+
|
44
|
+
std::vector<NSOpenGLPixelFormatAttribute> attr(
|
45
|
+
DEFAULT, DEFAULT + DEFAULT_SIZE);
|
46
|
+
if (antialias_nsample > 0)
|
47
|
+
attr.insert(attr.end(), ANTIALIAS, ANTIALIAS + ANTIALIAS_SIZE);
|
48
|
+
attr.push_back(0);
|
49
|
+
|
50
|
+
return [[[NSOpenGLPixelFormat alloc] initWithAttributes: &attr[0]] autorelease];
|
51
|
+
}
|
52
|
+
|
53
|
+
|
54
|
+
@implementation OpenGLView
|
55
|
+
|
56
|
+
- (id) initWithFrame: (NSRect) frame
|
57
|
+
{
|
58
|
+
return [self initWithFrame: frame antiAlias: 0];
|
59
|
+
}
|
60
|
+
|
61
|
+
- (id) initWithFrame: (NSRect) frame antiAlias: (int) nsample
|
62
|
+
{
|
63
|
+
self = [super initWithFrame: frame pixelFormat: make_pixelformat(nsample)];
|
64
|
+
if (!self) return nil;
|
65
|
+
|
66
|
+
[[self openGLContext] makeCurrentContext];
|
67
|
+
|
68
|
+
GLint swapinterval = 1;
|
69
|
+
[[self openGLContext]
|
70
|
+
setValues: &swapinterval
|
71
|
+
forParameter: NSOpenGLCPSwapInterval];
|
72
|
+
|
73
|
+
#ifdef TRANSPARENT_BACKGROUND
|
74
|
+
GLint opacity = 0;
|
75
|
+
[[self openGLContext]
|
76
|
+
setValues: &opacity
|
77
|
+
forParameter: NSOpenGLCPSurfaceOpacity];
|
78
|
+
#endif
|
79
|
+
|
80
|
+
return self;
|
81
|
+
}
|
82
|
+
|
83
|
+
- (void) makeCurrent
|
84
|
+
{
|
85
|
+
[[self openGLContext] makeCurrentContext];
|
86
|
+
}
|
87
|
+
|
88
|
+
- (void) flushBuffer
|
89
|
+
{
|
90
|
+
[[NSOpenGLContext currentContext] flushBuffer];
|
91
|
+
}
|
92
|
+
|
93
|
+
- (BOOL) acceptsFirstResponder
|
94
|
+
{
|
95
|
+
return YES;
|
96
|
+
}
|
97
|
+
|
98
|
+
- (BOOL) acceptsFirstMouse: (NSEvent*) event
|
99
|
+
{
|
100
|
+
return YES;
|
101
|
+
}
|
102
|
+
|
103
|
+
#ifdef TRANSPARENT_BACKGROUND
|
104
|
+
- (BOOL) isOpaque
|
105
|
+
{
|
106
|
+
return YES;
|
107
|
+
}
|
108
|
+
#endif
|
109
|
+
|
110
|
+
- (void) drawRect: (NSRect) rect
|
111
|
+
{
|
112
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
113
|
+
if (!win) return;
|
114
|
+
|
115
|
+
[self makeCurrent];
|
116
|
+
[win draw];
|
117
|
+
[self flushBuffer];
|
118
|
+
}
|
119
|
+
|
120
|
+
- (void) viewDidMoveToWindow
|
121
|
+
{
|
122
|
+
[[self window] setAcceptsMouseMovedEvents: YES];
|
123
|
+
[[self window] makeFirstResponder: self];
|
124
|
+
|
125
|
+
#ifdef TRANSPARENT_BACKGROUND
|
126
|
+
[[self window] setBackgroundColor: [NSColor clearColor]];
|
127
|
+
[[self window] setOpaque: NO];
|
128
|
+
#endif
|
129
|
+
}
|
130
|
+
|
131
|
+
- (void) insertText: (id) str
|
132
|
+
{
|
133
|
+
NSLog(@"interText: %@", str);
|
134
|
+
}
|
135
|
+
|
136
|
+
- (void) keyDown: (NSEvent*) event
|
137
|
+
{
|
138
|
+
[self interpretKeyEvents: [NSArray arrayWithObject: event]];
|
139
|
+
|
140
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
141
|
+
if (!win) return;
|
142
|
+
|
143
|
+
[win keyDown: event];
|
144
|
+
}
|
145
|
+
|
146
|
+
- (void) keyUp: (NSEvent*) event
|
147
|
+
{
|
148
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
149
|
+
if (!win) return;
|
150
|
+
|
151
|
+
[win keyUp: event];
|
152
|
+
}
|
153
|
+
|
154
|
+
- (void) mouseDown: (NSEvent*) event
|
155
|
+
{
|
156
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
157
|
+
if (!win) return;
|
158
|
+
|
159
|
+
[win mouseDown: event];
|
160
|
+
}
|
161
|
+
|
162
|
+
- (void) mouseUp: (NSEvent*) event
|
163
|
+
{
|
164
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
165
|
+
if (!win) return;
|
166
|
+
|
167
|
+
[win mouseUp: event];
|
168
|
+
}
|
169
|
+
|
170
|
+
- (void) mouseMoved: (NSEvent*) event
|
171
|
+
{
|
172
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
173
|
+
if (!win) return;
|
174
|
+
|
175
|
+
[win mouseMoved: event];
|
176
|
+
}
|
177
|
+
|
178
|
+
- (void) mouseDragged: (NSEvent*) event
|
179
|
+
{
|
180
|
+
CocoaWindow* win = (CocoaWindow*) [self window];
|
181
|
+
if (!win) return;
|
182
|
+
|
183
|
+
[win mouseDragged: event];
|
184
|
+
}
|
185
|
+
|
186
|
+
@end// OpenGLView
|
data/src/cocoa/reflex.mm
ADDED
@@ -0,0 +1,68 @@
|
|
1
|
+
// -*- objc -*-
|
2
|
+
#include "reflex/reflex.h"
|
3
|
+
|
4
|
+
|
5
|
+
#import <Cocoa/Cocoa.h>
|
6
|
+
#import "cocoaapplication.h"
|
7
|
+
|
8
|
+
|
9
|
+
namespace Reflex
|
10
|
+
{
|
11
|
+
|
12
|
+
|
13
|
+
namespace global
|
14
|
+
{
|
15
|
+
|
16
|
+
static NSAutoreleasePool* pool = nil;
|
17
|
+
|
18
|
+
}// global
|
19
|
+
|
20
|
+
|
21
|
+
bool
|
22
|
+
init ()
|
23
|
+
{
|
24
|
+
if (global::pool) return false;
|
25
|
+
|
26
|
+
global::pool = [[NSAutoreleasePool alloc] init];
|
27
|
+
|
28
|
+
[CocoaApplication sharedApplication];
|
29
|
+
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
|
33
|
+
bool
|
34
|
+
fin ()
|
35
|
+
{
|
36
|
+
if (!global::pool) return false;
|
37
|
+
|
38
|
+
[global::pool release];
|
39
|
+
global::pool = nil;
|
40
|
+
|
41
|
+
return true;
|
42
|
+
}
|
43
|
+
|
44
|
+
bool
|
45
|
+
run (const char* name)
|
46
|
+
{
|
47
|
+
if (!global::pool || !NSApp) return false;
|
48
|
+
|
49
|
+
Application app;
|
50
|
+
if (!app) return false;
|
51
|
+
|
52
|
+
if (name && !app.set_name(name))
|
53
|
+
return false;
|
54
|
+
|
55
|
+
return app.run();
|
56
|
+
}
|
57
|
+
|
58
|
+
bool
|
59
|
+
quit ()
|
60
|
+
{
|
61
|
+
if (!global::pool || !NSApp) return false;
|
62
|
+
|
63
|
+
[NSApp terminate: nil];
|
64
|
+
return true;
|
65
|
+
}
|
66
|
+
|
67
|
+
|
68
|
+
}// Reflex
|
data/src/cocoa/window.mm
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
// -*- objc -*-
|
2
|
+
#include "reflex/window.h"
|
3
|
+
|
4
|
+
|
5
|
+
#import <Cocoa/Cocoa.h>
|
6
|
+
#include "windowdata.h"
|
7
|
+
#import "cocoawindow.h"
|
8
|
+
|
9
|
+
|
10
|
+
namespace Reflex
|
11
|
+
{
|
12
|
+
|
13
|
+
|
14
|
+
Window::Window ()
|
15
|
+
{
|
16
|
+
self->this_ = this;
|
17
|
+
self->self_ = [[CocoaWindow alloc] initWithWindowData: self];
|
18
|
+
}
|
19
|
+
|
20
|
+
Window::~Window ()
|
21
|
+
{
|
22
|
+
if (self->self_)
|
23
|
+
{
|
24
|
+
[self->self_ release];
|
25
|
+
self->self_ = nil;
|
26
|
+
}
|
27
|
+
self->this_ = NULL;
|
28
|
+
}
|
29
|
+
|
30
|
+
bool
|
31
|
+
Window::close ()
|
32
|
+
{
|
33
|
+
if (!*this) return false;
|
34
|
+
[self->self_ close];
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
bool
|
39
|
+
Window::show ()
|
40
|
+
{
|
41
|
+
if (!*this) return false;
|
42
|
+
if (--self->hidecount == 0)
|
43
|
+
{
|
44
|
+
[self->self_ makeKeyAndOrderFront: nil];
|
45
|
+
}
|
46
|
+
return true;
|
47
|
+
}
|
48
|
+
|
49
|
+
bool
|
50
|
+
Window::hide ()
|
51
|
+
{
|
52
|
+
if (!*this) return false;
|
53
|
+
if (++self->hidecount == 1)
|
54
|
+
[self->self_ orderOut: self->self_];
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
|
58
|
+
bool
|
59
|
+
Window::hidden () const
|
60
|
+
{
|
61
|
+
if (!*this) return false;
|
62
|
+
return self->hidecount > 0;
|
63
|
+
}
|
64
|
+
|
65
|
+
bool
|
66
|
+
Window::redraw ()
|
67
|
+
{
|
68
|
+
if (!*this) return false;
|
69
|
+
[self->self_ redraw];
|
70
|
+
return true;
|
71
|
+
}
|
72
|
+
|
73
|
+
bool
|
74
|
+
Window::get_title (String* title) const
|
75
|
+
{
|
76
|
+
if (!*this || !title) return false;
|
77
|
+
NSString* s = [self->self_ title];
|
78
|
+
*title = s ? [s UTF8String] : "";
|
79
|
+
return true;
|
80
|
+
}
|
81
|
+
|
82
|
+
bool
|
83
|
+
Window::set_title (const char* title)
|
84
|
+
{
|
85
|
+
if (!*this || !title) return false;
|
86
|
+
[self->self_ setTitle: [NSString stringWithUTF8String: title]];
|
87
|
+
return true;
|
88
|
+
}
|
89
|
+
|
90
|
+
bool
|
91
|
+
Window::get_bounds (coord* x, coord* y, coord* width, coord* height)
|
92
|
+
{
|
93
|
+
if (!*this || (!x && !y && !width && !height))
|
94
|
+
return false;
|
95
|
+
NSRect frame = [self->self_ frame];
|
96
|
+
if (x) *x = frame.origin.x;
|
97
|
+
if (y) *y = frame.origin.y;
|
98
|
+
if (width) *width = frame.size.width;
|
99
|
+
if (height) *height = frame.size.height;
|
100
|
+
return true;
|
101
|
+
}
|
102
|
+
|
103
|
+
bool
|
104
|
+
Window::set_bounds (coord x, coord y, coord width, coord height)
|
105
|
+
{
|
106
|
+
if (!*this) return false;
|
107
|
+
NSRect frame = NSMakeRect(x, y, width, height);
|
108
|
+
[self->self_ setFrame: frame display: NO animate: NO];
|
109
|
+
return true;
|
110
|
+
}
|
111
|
+
|
112
|
+
Window::operator bool () const
|
113
|
+
{
|
114
|
+
return self && *self;
|
115
|
+
}
|
116
|
+
|
117
|
+
|
118
|
+
}// Reflex
|
@@ -0,0 +1,51 @@
|
|
1
|
+
// -*- c++ -*-
|
2
|
+
#pragma once
|
3
|
+
#ifndef __REFLEX_COCOA_WINDOWDATA_H__
|
4
|
+
#define __REFLEX_COCOA_WINDOWDATA_H__
|
5
|
+
|
6
|
+
|
7
|
+
#include <boost/shared_ptr.hpp>
|
8
|
+
#include <reflex/window.h>
|
9
|
+
|
10
|
+
|
11
|
+
@class CocoaWindow;
|
12
|
+
|
13
|
+
|
14
|
+
namespace Reflex
|
15
|
+
{
|
16
|
+
|
17
|
+
|
18
|
+
struct Window::Data
|
19
|
+
{
|
20
|
+
|
21
|
+
Window* this_;
|
22
|
+
|
23
|
+
CocoaWindow* self_;
|
24
|
+
|
25
|
+
int hidecount;
|
26
|
+
|
27
|
+
Data ()
|
28
|
+
: this_(NULL), self_(nil), hidecount(1)
|
29
|
+
{
|
30
|
+
}
|
31
|
+
|
32
|
+
operator bool () const
|
33
|
+
{
|
34
|
+
return this_ && self_;
|
35
|
+
}
|
36
|
+
|
37
|
+
bool operator ! () const
|
38
|
+
{
|
39
|
+
return !operator bool();
|
40
|
+
}
|
41
|
+
|
42
|
+
};// Window::Data
|
43
|
+
|
44
|
+
|
45
|
+
typedef boost::shared_ptr<Reflex::Window::Data> WindowData;
|
46
|
+
|
47
|
+
|
48
|
+
}// Reflex
|
49
|
+
|
50
|
+
|
51
|
+
#endif//EOH
|
data/src/defs.cpp
ADDED
@@ -0,0 +1,47 @@
|
|
1
|
+
#include "reflex/defs.h"
|
2
|
+
|
3
|
+
|
4
|
+
namespace Reflex
|
5
|
+
{
|
6
|
+
|
7
|
+
|
8
|
+
Key::Key ()
|
9
|
+
: code(KEY_NONE), repeat(0), modifiers(MOD_NONE)
|
10
|
+
{
|
11
|
+
}
|
12
|
+
|
13
|
+
Key::Key (const char* chars, int code, uint modifiers, int repeat)
|
14
|
+
: chars(chars), code(code), repeat(repeat), modifiers(modifiers)
|
15
|
+
{
|
16
|
+
}
|
17
|
+
|
18
|
+
|
19
|
+
Points::Points ()
|
20
|
+
: type(POINT_NONE), size(0), modifiers(MOD_NONE), count(0), drag(false),
|
21
|
+
x(0), y(0)
|
22
|
+
{
|
23
|
+
}
|
24
|
+
|
25
|
+
Points::Points (
|
26
|
+
int type, coord x_, coord y_, uint modifiers, uint count, bool drag)
|
27
|
+
: type(type), size(1), modifiers(modifiers), count(count), drag(drag),
|
28
|
+
x(x_), y(y_)
|
29
|
+
{
|
30
|
+
}
|
31
|
+
|
32
|
+
Points::Points (
|
33
|
+
int type, const Point* points_, size_t size_,
|
34
|
+
uint modifiers, uint count, bool drag)
|
35
|
+
: type(type), size(size), modifiers(modifiers), count(count), drag(drag)
|
36
|
+
{
|
37
|
+
if (size > MAX) size = MAX;
|
38
|
+
|
39
|
+
if (points_)
|
40
|
+
{
|
41
|
+
for (size_t i = 0; i < size; ++i)
|
42
|
+
points[i] = points_[i];
|
43
|
+
}
|
44
|
+
}
|
45
|
+
|
46
|
+
|
47
|
+
};// Reflex
|