mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-09-18 03:55:19 -04:00
Add info.plist file for osx, start work on cocoa events
This commit is contained in:
parent
faf09dc423
commit
dfc1a4249c
@ -49,15 +49,31 @@ void Window_SetTitle(const String* title) {
|
|||||||
[winHandle setTitle: (NSString*)titleCF];
|
[winHandle setTitle: (NSString*)titleCF];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int Window_MapMouse(int button) {
|
||||||
|
if (button == 0) return Key_
|
||||||
|
}
|
||||||
|
|
||||||
void Window_ProcessEvents(void) {
|
void Window_ProcessEvents(void) {
|
||||||
NSEvent* ev;
|
NSEvent* ev;
|
||||||
int type;
|
int type, button;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ev = [appHandle nextEventMatchingMask: 0xFFFFFFFFU untilDate:Nil inMode:NSDefaultRunLoopMode dequeue:YES];
|
ev = [appHandle nextEventMatchingMask: 0xFFFFFFFFU untilDate:Nil inMode:NSDefaultRunLoopMode dequeue:YES];
|
||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
|
|
||||||
type = [ev type];
|
type = [ev type];
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case NSLeftMouseDown:
|
||||||
|
case NSRightMouseDown:
|
||||||
|
case NSOtherMouseDown:
|
||||||
|
button = [ev buttonNumber];
|
||||||
|
|
||||||
|
case NSLeftMouseUp:
|
||||||
|
case NSRightMouseUp:
|
||||||
|
case NSOtherMouseUp:
|
||||||
|
button = [ev buttonNumber];
|
||||||
|
}
|
||||||
|
|
||||||
Platform_Log1("EVENT: %i", &type);
|
Platform_Log1("EVENT: %i", &type);
|
||||||
[appHandle sendEvent:ev];
|
[appHandle sendEvent:ev];
|
||||||
}
|
}
|
||||||
|
20
misc/info.plist
Normal file
20
misc/info.plist
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||||
|
<plist version="1.0">
|
||||||
|
<dict>
|
||||||
|
<key>CFBundleExecutable</key>
|
||||||
|
<string>ClassiCube</string>
|
||||||
|
<key>CFBundleIconFile</key>
|
||||||
|
<string>ClassiCube</string>
|
||||||
|
<key>CFBundleIdentifier</key>
|
||||||
|
<string>com.classicube.game</string>
|
||||||
|
<key>CFBundleInfoDictionaryVersion</key>
|
||||||
|
<string>6.0</string>
|
||||||
|
<key>CFBundleName</key>
|
||||||
|
<string>ClassiCube</string>
|
||||||
|
<key>CFBundlePackageType</key>
|
||||||
|
<string>APPL</string>
|
||||||
|
<key>CFBundleDisplayName</key>
|
||||||
|
<string>ClassiCube</string>
|
||||||
|
</dict>
|
||||||
|
</plist>
|
24
src/Window.c
24
src/Window.c
@ -3730,15 +3730,35 @@ void Window_ExitFullscreen(void) { }
|
|||||||
void Window_SetSize(int width, int height) { }
|
void Window_SetSize(int width, int height) { }
|
||||||
void Window_Close(void) { }
|
void Window_Close(void) { }
|
||||||
|
|
||||||
|
#define NSMouseMoved 5
|
||||||
|
#define NSLeftMouseDragged 6
|
||||||
|
#define NSRightMouseDragged 7
|
||||||
|
#define NSKeyDown 10
|
||||||
|
#define NSKeyUp 11
|
||||||
|
#define NSScrollWheel 22
|
||||||
|
#define NSOtherMouseDragged 27
|
||||||
|
|
||||||
void Window_ProcessEvents(void) {
|
void Window_ProcessEvents(void) {
|
||||||
id ev;
|
id ev;
|
||||||
int type;
|
int button, type;
|
||||||
|
|
||||||
for (;;) {
|
for (;;) {
|
||||||
ev = objc_msgSend(appHandle, selNextEvent, 0xFFFFFFFFU, NULL, NSDefaultRunLoopMode, true);
|
ev = objc_msgSend(appHandle, selNextEvent, 0xFFFFFFFFU, NULL, NSDefaultRunLoopMode, true);
|
||||||
if (!ev) break;
|
if (!ev) break;
|
||||||
|
|
||||||
type = (int)objc_msgSend(ev, selType);
|
type = (int)objc_msgSend(ev, selType);
|
||||||
|
|
||||||
|
switch (type) {
|
||||||
|
case 1: /* NSLeftMouseDown */
|
||||||
|
case 3: /* NSRightMouseDown */
|
||||||
|
case 25: /* NSOtherMouseDown */
|
||||||
|
button = (int)objc_msgSend(ev, sel_registerName("buttonNumber"));
|
||||||
|
|
||||||
|
case 2: /* NSLeftMouseUp */
|
||||||
|
case 4: /* NSRightMouseUp */
|
||||||
|
case 26: /* NSOtherMouseUp */
|
||||||
|
button = (int)objc_msgSend(ev, sel_registerName("buttonNumber"));
|
||||||
|
|
||||||
|
}
|
||||||
Platform_Log1("EVENT: %i", &type);
|
Platform_Log1("EVENT: %i", &type);
|
||||||
objc_msgSend(appHandle, selSendEvent, ev);
|
objc_msgSend(appHandle, selSendEvent, ev);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user