mirror of
https://github.com/SFML/SFML.git
synced 2024-11-24 20:31:05 +08:00
Format .m files
This commit is contained in:
parent
dd0f0ff4c6
commit
55a1a2a4c4
@ -22,7 +22,7 @@ endif()
|
||||
# Run
|
||||
set(SOURCES "")
|
||||
foreach(FOLDER IN ITEMS examples include src test tools)
|
||||
file(GLOB_RECURSE folder_files "${FOLDER}/*.h" "${FOLDER}/*.hpp" "${FOLDER}/*.inl" "${FOLDER}/*.cpp" "${FOLDER}/*.mm")
|
||||
file(GLOB_RECURSE folder_files "${FOLDER}/*.h" "${FOLDER}/*.hpp" "${FOLDER}/*.inl" "${FOLDER}/*.cpp" "${FOLDER}/*.mm" "${FOLDER}/*.m")
|
||||
list(FILTER folder_files EXCLUDE REGEX "gl.h|vulkan.h|stb_perlin.h") # 3rd party code to exclude from formatting
|
||||
list(APPEND SOURCES ${folder_files})
|
||||
endforeach()
|
||||
|
@ -25,7 +25,7 @@
|
||||
|
||||
#import <Cocoa/Cocoa.h>
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
return NSApplicationMain(argc, (const char **)argv);
|
||||
return NSApplicationMain(argc, (const char**)argv);
|
||||
}
|
||||
|
@ -29,11 +29,11 @@
|
||||
#import <SFML/Window/OSX/SFApplication.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
@ -42,7 +42,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
+(void)processEvent
|
||||
+ (void)processEvent
|
||||
{
|
||||
[SFApplication sharedApplication]; // Make sure NSApp exists
|
||||
NSEvent* event = nil;
|
||||
@ -58,7 +58,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(void)setUpMenuBar
|
||||
+ (void)setUpMenuBar
|
||||
{
|
||||
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
|
||||
|
||||
@ -73,17 +73,17 @@
|
||||
|
||||
// Application Menu (aka Apple Menu)
|
||||
NSMenuItem* appleItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* appleMenu = [[SFApplication newAppleMenu] autorelease];
|
||||
NSMenu* appleMenu = [[SFApplication newAppleMenu] autorelease];
|
||||
[appleItem setSubmenu:appleMenu];
|
||||
|
||||
// File Menu
|
||||
NSMenuItem* fileItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* fileMenu = [[SFApplication newFileMenu] autorelease];
|
||||
NSMenu* fileMenu = [[SFApplication newFileMenu] autorelease];
|
||||
[fileItem setSubmenu:fileMenu];
|
||||
|
||||
// Window menu
|
||||
NSMenuItem* windowItem = [mainMenu addItemWithTitle:@"" action:nil keyEquivalent:@""];
|
||||
NSMenu* windowMenu = [[SFApplication newWindowMenu] autorelease];
|
||||
NSMenu* windowMenu = [[SFApplication newWindowMenu] autorelease];
|
||||
[windowItem setSubmenu:windowMenu];
|
||||
[NSApp setWindowsMenu:windowMenu];
|
||||
|
||||
@ -92,7 +92,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)newAppleMenu
|
||||
+ (NSMenu*)newAppleMenu
|
||||
{
|
||||
// Apple menu is as follow:
|
||||
//
|
||||
@ -126,18 +126,14 @@
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
// PREFERENCES
|
||||
[appleMenu addItemWithTitle:@"Preferences..."
|
||||
action:nil
|
||||
keyEquivalent:@""];
|
||||
[appleMenu addItemWithTitle:@"Preferences..." action:nil keyEquivalent:@""];
|
||||
|
||||
// SEPARATOR
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
// SERVICES
|
||||
NSMenu* serviceMenu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
|
||||
NSMenuItem* serviceItem = [appleMenu addItemWithTitle:@"Services"
|
||||
action:nil
|
||||
keyEquivalent:@""];
|
||||
NSMenu* serviceMenu = [[[NSMenu alloc] initWithTitle:@""] autorelease];
|
||||
NSMenuItem* serviceItem = [appleMenu addItemWithTitle:@"Services" action:nil keyEquivalent:@""];
|
||||
[serviceItem setSubmenu:serviceMenu];
|
||||
[NSApp setServicesMenu:serviceMenu];
|
||||
|
||||
@ -145,20 +141,17 @@
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
// HIDE
|
||||
[appleMenu addItemWithTitle:[@"Hide " stringByAppendingString:appName]
|
||||
action:@selector(hide:)
|
||||
keyEquivalent:@"h"];
|
||||
[appleMenu addItemWithTitle:[@"Hide " stringByAppendingString:appName] action:@selector(hide:) keyEquivalent:@"h"];
|
||||
|
||||
// HIDE OTHER
|
||||
NSMenuItem* hideOtherItem = [appleMenu addItemWithTitle:@"Hide Others"
|
||||
action:@selector(hideOtherApplications:)
|
||||
keyEquivalent:@"h"];
|
||||
NSMenuItem* hideOtherItem = [appleMenu
|
||||
addItemWithTitle:@"Hide Others"
|
||||
action:@selector(hideOtherApplications:)
|
||||
keyEquivalent:@"h"];
|
||||
[hideOtherItem setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
|
||||
|
||||
// SHOW ALL
|
||||
[appleMenu addItemWithTitle:@"Show All"
|
||||
action:@selector(unhideAllApplications:)
|
||||
keyEquivalent:@""];
|
||||
[appleMenu addItemWithTitle:@"Show All" action:@selector(unhideAllApplications:) keyEquivalent:@""];
|
||||
|
||||
// SEPARATOR
|
||||
[appleMenu addItem:[NSMenuItem separatorItem]];
|
||||
@ -175,7 +168,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)newFileMenu
|
||||
+ (NSMenu*)newFileMenu
|
||||
{
|
||||
// The File menu is as follow:
|
||||
//
|
||||
@ -186,9 +179,10 @@
|
||||
NSMenu* fileMenu = [[NSMenu alloc] initWithTitle:@"File"];
|
||||
|
||||
// CLOSE WINDOW
|
||||
NSMenuItem* closeItem = [[NSMenuItem alloc] initWithTitle:@"Close Window"
|
||||
action:@selector(performClose:)
|
||||
keyEquivalent:@"w"];
|
||||
NSMenuItem* closeItem = [[NSMenuItem alloc]
|
||||
initWithTitle:@"Close Window"
|
||||
action:@selector(performClose:)
|
||||
keyEquivalent:@"w"];
|
||||
[fileMenu addItem:closeItem];
|
||||
[closeItem release];
|
||||
|
||||
@ -197,7 +191,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSMenu*)newWindowMenu
|
||||
+ (NSMenu*)newWindowMenu
|
||||
{
|
||||
// The Window menu is as follow:
|
||||
//
|
||||
@ -211,31 +205,28 @@
|
||||
NSMenu* windowMenu = [[NSMenu alloc] initWithTitle:@"Window"];
|
||||
|
||||
// MINIMIZE
|
||||
NSMenuItem* minimizeItem = [[NSMenuItem alloc] initWithTitle:@"Minimize"
|
||||
action:@selector(performMiniaturize:)
|
||||
keyEquivalent:@"m"];
|
||||
NSMenuItem* minimizeItem = [[NSMenuItem alloc]
|
||||
initWithTitle:@"Minimize"
|
||||
action:@selector(performMiniaturize:)
|
||||
keyEquivalent:@"m"];
|
||||
[windowMenu addItem:minimizeItem];
|
||||
[minimizeItem release];
|
||||
|
||||
// ZOOM
|
||||
[windowMenu addItemWithTitle:@"Zoom"
|
||||
action:@selector(performZoom:)
|
||||
keyEquivalent:@""];
|
||||
[windowMenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
|
||||
|
||||
// SEPARATOR
|
||||
[windowMenu addItem:[NSMenuItem separatorItem]];
|
||||
|
||||
// BRING ALL TO FRONT
|
||||
[windowMenu addItemWithTitle:@"Bring All to Front"
|
||||
action:@selector(bringAllToFront:)
|
||||
keyEquivalent:@""];
|
||||
[windowMenu addItemWithTitle:@"Bring All to Front" action:@selector(bringAllToFront:) keyEquivalent:@""];
|
||||
|
||||
return windowMenu;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
+(NSString*)applicationName
|
||||
+ (NSString*)applicationName
|
||||
{
|
||||
// First, try localized name
|
||||
NSString* appName = [[[NSBundle mainBundle] localizedInfoDictionary] objectForKey:@"CFBundleDisplayName"];
|
||||
@ -253,7 +244,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)bringAllToFront:(id)sender
|
||||
- (void)bringAllToFront:(id)sender
|
||||
{
|
||||
(void)sender;
|
||||
[[NSApp windows] makeObjectsPerformSelector:@selector(orderFrontRegardless)];
|
||||
@ -261,7 +252,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)sendEvent:(NSEvent *)anEvent
|
||||
- (void)sendEvent:(NSEvent*)anEvent
|
||||
{
|
||||
// Fullscreen windows have a strange behaviour with key up. To make
|
||||
// sure the user gets an event we call (if possible) sfKeyUp on our
|
||||
@ -278,5 +269,3 @@
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
||||
|
@ -29,11 +29,11 @@
|
||||
#import <SFML/Window/OSX/SFApplicationDelegate.h>
|
||||
|
||||
#if defined(__APPLE__)
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
#if defined(__clang__)
|
||||
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
|
||||
#elif defined(__GNUC__)
|
||||
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
@ -41,7 +41,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
-(NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
|
||||
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)sender
|
||||
{
|
||||
(void)sender;
|
||||
// Generate close event for each SFML window
|
||||
@ -51,7 +51,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
-(BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
|
||||
- (BOOL)applicationShouldTerminateAfterLastWindowClosed:(NSApplication*)theApplication
|
||||
{
|
||||
(void)theApplication;
|
||||
return YES;
|
||||
@ -59,4 +59,3 @@
|
||||
|
||||
|
||||
@end
|
||||
|
||||
|
@ -30,11 +30,10 @@
|
||||
|
||||
@implementation SFSilentResponder
|
||||
|
||||
-(void)doCommandBySelector:(SEL)sel
|
||||
- (void)doCommandBySelector:(SEL)sel
|
||||
{
|
||||
// Just do nothing, to prevent sound alerts
|
||||
(void)sel;
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
|
@ -32,28 +32,28 @@
|
||||
@implementation SFWindow
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)acceptsFirstResponder
|
||||
- (BOOL)acceptsFirstResponder
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)canBecomeKeyWindow
|
||||
- (BOOL)canBecomeKeyWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)canBecomeMainWindow
|
||||
- (BOOL)canBecomeMainWindow
|
||||
{
|
||||
return YES;
|
||||
}
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)keyDown:(NSEvent*)theEvent
|
||||
- (void)keyDown:(NSEvent*)theEvent
|
||||
{
|
||||
// Do nothing except preventing a system alert each time a key is pressed
|
||||
//
|
||||
@ -67,7 +67,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(void)performClose:(id)sender
|
||||
- (void)performClose:(id)sender
|
||||
{
|
||||
// From Apple documentation:
|
||||
//
|
||||
@ -98,7 +98,7 @@
|
||||
|
||||
|
||||
////////////////////////////////////////////////////////
|
||||
-(BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||
- (BOOL)validateMenuItem:(NSMenuItem*)menuItem
|
||||
{
|
||||
return [menuItem action] == @selector(performClose:) || [super validateMenuItem:menuItem];
|
||||
}
|
||||
@ -110,7 +110,7 @@
|
||||
@implementation NSWindow (SFML)
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
-(id)sfClose
|
||||
- (id)sfClose
|
||||
{
|
||||
[self performClose:nil];
|
||||
return nil;
|
||||
|
Loading…
Reference in New Issue
Block a user