mirror of
https://github.com/ddnet/ddnet.git
synced 2024-11-10 10:08:18 +00:00
commit
139c52b394
8
bam.lua
8
bam.lua
|
@ -283,6 +283,7 @@ function build(settings)
|
|||
client_settings.link.frameworks:Add("Carbon")
|
||||
client_settings.link.frameworks:Add("Cocoa")
|
||||
launcher_settings.link.frameworks:Add("Cocoa")
|
||||
client_settings.cc.flags:Add("-I/opt/X11/include")
|
||||
else
|
||||
client_settings.link.libs:Add("X11")
|
||||
client_settings.link.libs:Add("GL")
|
||||
|
@ -329,9 +330,14 @@ function build(settings)
|
|||
-- build tools (TODO: fix this so we don't get double _d_d stuff)
|
||||
tools_src = Collect("src/tools/*.cpp", "src/tools/*.c")
|
||||
|
||||
client_notification = {}
|
||||
client_osxlaunch = {}
|
||||
server_osxlaunch = {}
|
||||
if platform == "macosx" then
|
||||
notification_settings = client_settings:Copy()
|
||||
notification_settings.cc.flags:Add("-x objective-c++")
|
||||
notification_settings.cc.flags:Add("-I/System/Library/Frameworks/Foundation.framework/Versions/C/Headers")
|
||||
client_notification = Compile(notification_settings, "src/osx/notification.m")
|
||||
client_osxlaunch = Compile(client_settings, "src/osxlaunch/client.m")
|
||||
server_osxlaunch = Compile(launcher_settings, "src/osxlaunch/server.m")
|
||||
end
|
||||
|
@ -345,7 +351,7 @@ function build(settings)
|
|||
-- build client, server, version server and master server
|
||||
client_exe = Link(client_settings, "DDNet", game_shared, game_client,
|
||||
engine, client, game_editor, zlib, pnglite, wavpack,
|
||||
client_link_other, client_osxlaunch, jsonparser, libwebsockets, md5)
|
||||
client_link_other, client_osxlaunch, jsonparser, libwebsockets, md5, client_notification)
|
||||
|
||||
server_exe = Link(server_settings, "DDNet-Server", engine, server,
|
||||
game_shared, game_server, zlib, server_link_other, libwebsockets, md5)
|
||||
|
|
|
@ -152,6 +152,8 @@ if use_bundle:
|
|||
<string>????</string>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>%s</string>
|
||||
<key>CFBundleIdentifier</key>
|
||||
<string>org.DDNetClient.app</string>
|
||||
</dict>
|
||||
</plist>
|
||||
""" % (version))
|
||||
|
|
|
@ -18,6 +18,10 @@
|
|||
#include <game/client/components/sounds.h>
|
||||
#include <game/localization.h>
|
||||
|
||||
#ifdef CONF_PLATFORM_MACOSX
|
||||
#include <osx/notification.h>
|
||||
#endif
|
||||
|
||||
#include "chat.h"
|
||||
|
||||
|
||||
|
@ -469,7 +473,13 @@ void CChat::AddLine(int ClientID, int Team, const char *pLine)
|
|||
{
|
||||
if(Now-m_aLastSoundPlayed[CHAT_HIGHLIGHT] >= time_freq()*3/10)
|
||||
{
|
||||
#ifdef CONF_PLATFORM_MACOSX
|
||||
char aBuf[1024];
|
||||
str_format(aBuf, sizeof(aBuf), "%s%s", m_aLines[m_CurrentLine].m_aName, m_aLines[m_CurrentLine].m_aText);
|
||||
CNotification::notify("DDNet-Chat", aBuf);
|
||||
#else
|
||||
Graphics()->NotifyWindow();
|
||||
#endif
|
||||
if(g_Config.m_SndHighlight)
|
||||
{
|
||||
m_pClient->m_pSounds->Play(CSounds::CHN_GUI, SOUND_CHAT_HIGHLIGHT, 0);
|
||||
|
|
10
src/osx/notification.h
Normal file
10
src/osx/notification.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#ifndef NOTIFICATION_H
|
||||
#define NOTIFICATION_H
|
||||
|
||||
class CNotification
|
||||
{
|
||||
public:
|
||||
static void notify(const char *pTitle, const char *pMsg);
|
||||
};
|
||||
|
||||
#endif // NOTIFICATION_H
|
19
src/osx/notification.m
Normal file
19
src/osx/notification.m
Normal file
|
@ -0,0 +1,19 @@
|
|||
#include <NSString.h>
|
||||
#include <NSUserNotification.h>
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include "notification.h"
|
||||
|
||||
void CNotification::notify(const char *pTitle, const char *pMsg)
|
||||
{
|
||||
NSString* title = [NSString stringWithCString:pTitle encoding:NSUTF8StringEncoding];
|
||||
NSString* msg = [NSString stringWithCString:pMsg encoding:NSUTF8StringEncoding];
|
||||
|
||||
NSUserNotification *notification = [[NSUserNotification alloc] autorelease];
|
||||
notification.title = title;
|
||||
notification.informativeText = msg;
|
||||
notification.soundName = NSUserNotificationDefaultSoundName;
|
||||
|
||||
[[NSUserNotificationCenter defaultUserNotificationCenter] deliverNotification:notification];
|
||||
|
||||
[NSApp requestUserAttention:NSInformationalRequest]; // use NSCriticalRequest to annoy the user (doesn't stop bouncing)
|
||||
}
|
Loading…
Reference in a new issue