Mac: Add Cocoa port

Martin Plicht 2010-12-27 04:49:02 +01:00
parent 0876e89f3a
commit a22d5ee35c
42 changed files with 10043 additions and 3663 deletions

View File

@ -58,6 +58,8 @@ planet/cmake_install.cmake
planet/clonk.sln
planet/clonk.ilk
planet/CMakeCache.txt
build
planet/clonk.app
Release
RelWithDebInfo
MinSizeRel
@ -100,9 +102,14 @@ xcode/build
.anjuta*
# Binaries
planet/Clonk.app
*.app
*.exe
# Development files explicitely excluded
planet/nohg*
# Eclipse project file
planet/.project
# MacOSX saved searches
*.savedSearch

View File

@ -16,11 +16,8 @@ separate_arguments(OC_CXX_FLAGS_DEBUG)
############################################################################
option(PROJECT_FOLDERS "Put source files into subfolders in project file" ON)
option(USE_GL "Enable OpenGL support" ON)
if(APPLE)
SET(INITIAL_USE_SDL_MAINLOOP_VALUE ON)
else()
SET(INITIAL_USE_SDL_MAINLOOP_VALUE OFF)
endif()
SET(INITIAL_USE_SDL_MAINLOOP_VALUE OFF)
SET(INITIAL_USE_OPEN_AL OFF)
option(USE_SDL_MAINLOOP "Use SDL to create windows etc." ${INITIAL_USE_SDL_MAINLOOP_VALUE})
if(WIN32)
option(USE_DIRECTX "Enable DirectX support" ON)
@ -38,7 +35,7 @@ else()
SET(USE_DIRECTX OFF)
SET(HAVE_FMOD OFF)
endif()
if(UNIX AND NOT USE_SDL_MAINLOOP)
if(UNIX AND NOT USE_SDL_MAINLOOP AND NOT APPLE)
option(USE_X11 "Use X11 to create windows etc." ON)
option(USE_GTK "Use GTK for the developer mode" ON)
option(USE_GTK3 "Use GTK3 instead of GTK2" OFF)
@ -47,10 +44,17 @@ else()
SET(USE_GTK OFF)
SET(USE_GTK3 OFF)
endif()
if(APPLE)
option(USE_COCOA "Use Apple Cocoa for the developer mode and the windows." ON)
SET(INITIAL_USE_OPEN_AL ON)
else()
option(USE_COCOA OFF)
endif()
if(NOT USE_GL AND NOT USE_DIRECTX)
message(STATUS "No graphics display enabled; building dedicated server")
SET(USE_CONSOLE ON CACHE INTERNAL "Build dedicated server")
endif()
option(USE_OPEN_AL "Use OpenAL to play sounds" ${INITIAL_USE_OPEN_AL})
option(BUILD_TO_PLANET "Put build files to ./planet/" OFF)
option(DEBUGREC "Debug records" OFF)
option(OC_BUILD_MULTIPROCESSOR "Use all processor cores to build" OFF)
@ -144,7 +148,6 @@ set(OC_CLONK_SOURCES
src/C4Include.h
src/C4Prototypes.h
src/C4Version.h
src/C4WinMain.cpp
src/config/C4Config.cpp
src/config/C4Config.h
src/config/C4ConfigShareware.cpp
@ -559,12 +562,32 @@ elseif(USE_X11)
src/platform/StdXPrivate.h
)
endif()
if(NOT APPLE)
list(APPEND OC_SYSTEM_SOURCES src/C4WinMain.cpp)
endif()
if(APPLE)
list(APPEND OC_SYSTEM_SOURCES
src/platform/MacUtility.mm
src/platform/StdMacApp.mm
src/platform/C4FileMonitorMac.mm
src/platform/StdMacWindow.mm
src/platform/ClonkAppDelegate.h
src/platform/ClonkAppDelegate.mm
)
if(USE_COCOA)
list(APPEND OC_SYSTEM_SOURCES
src/platform/ConsoleWindowController.h
src/platform/ConsoleWindowController.mm
src/platform/ClonkWindowController.h
src/platform/ClonkWindowController.mm
src/platform/ClonkOpenGLView.h
src/platform/ClonkOpenGLView.mm
src/platform/CocoaKeycodeMap.h
src/editor/C4ConsoleCocoa.mm
src/platform/ClonkMainMenuActions.mm
)
endif()
endif()
if(USE_GTK)
list(APPEND OC_CLONK_SOURCES
@ -745,6 +768,25 @@ if(APPLE)
src/res/Clonk.icns
src/res/C4D.icns src/res/C4F.icns src/res/C4G.icns src/res/C4K.icns
src/res/C4P.icns src/res/C4S.icns src/res/C4U.icns
src/res/MainMenu.xib
src/res/FullscreenWindow.xib
src/res/ConsoleGUIWindow.xib
src/res/ClonkWindow.xib
src/res/ConsoleWindow.xib
src/res/Mouse_Trans.png
src/res/Cursor_Trans.png
src/res/Brush_Trans.png
src/res/Play_Trans.png
src/res/Halt_Trans.png
src/res/Dynamic_Trans.png
src/res/Static_Trans.png
src/res/Exact_Trans.png
src/res/Line_Trans.png
src/res/Rect_Trans.png
src/res/Fill_Trans.png
src/res/Picker_Trans.png
src/res/Ift_Trans.png
src/res/NoIft_Trans.png
)
# Add icon resources
@ -776,6 +818,12 @@ if(USE_GTK)
endif()
endif()
if(USE_OPEN_AL)
FINDLIB(VORBIS_LIBRARY NAMES vorbis)
FINDLIB(VORBISFILE_LIBRARY NAMES vorbisfile)
FINDLIB(OGG_LIBRARY NAMES ogg)
endif()
add_definitions(-DHAVE_CONFIG_H)
add_executable(clonk WIN32 MACOSX_BUNDLE
${OC_SYSTEM_SOURCES}
@ -807,6 +855,9 @@ target_link_libraries(clonk
${JPEG_LIBRARIES}
${OPENSSL_LIBRARIES}
${ICONV_LIBRARY}
${VORBIS_LIBRARY}
${VORBISFILE_LIBRARY}
${OGG_LIBRARY}
)
target_link_libraries(c4group
${ZLIB_LIBRARIES}
@ -815,25 +866,39 @@ target_link_libraries(c4group
set_property(TARGET clonk APPEND PROPERTY COMPILE_DEFINITIONS GLEW_STATIC)
set_property(DIRECTORY APPEND PROPERTY COMPILE_DEFINITIONS_DEBUG _DEBUG)
if (APPLE)
add_custom_command(TARGET clonk
POST_BUILD COMMAND "/bin/sh" "${CMAKE_CURRENT_SOURCE_DIR}/tools/osx_bundle_libs.sh"
)
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
SET_TARGET_PROPERTIES(clonk PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PRECOMPILE_PREFIX_HEADER YES)
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PREFIX_HEADER "${CMAKE_CURRENT_SOURCE_DIR}/src/C4Include.h")
SET_TARGET_PROPERTIES(c4group PROPERTIES XCODE_ATTRIBUTE_GCC_PFE_FILE_C_DIALECTS "c++ objective-c++")
endif()
# This expands some variables in Info.plist as a side-effect. XCode might then
# expand a second time, using the same syntax. Try not to get confused by this!
set_target_properties(clonk PROPERTIES MACOSX_BUNDLE_INFO_PLIST "src/res/Info.plist")
set_target_properties(clonk PROPERTIES MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/src/res/Info.plist")
############################################################################
# build to planet
############################################################################
if(BUILD_TO_PLANET)
if(MSVC) #get the files out of the Build folders
if(CMAKE_VERSION VERSION_LESS "2.8")
message(SEND_ERROR "You need CMake 2.8 or higher for BUILD_TO_PLANET to get the builds out of MSVCs folders. You have ${CMAKE_VERSION}")
else()
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELEASE "../Clonk")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_DEBUG "../ClonkD")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_MINSIZEREL "../ClonkMSR")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELWITHDEBINFO "../ClonkRD")
endif()
if(CMAKE_VERSION VERSION_LESS "2.8")
message(SEND_ERROR "You need CMake 2.8 or higher for BUILD_TO_PLANET to get the builds out of the sub folders. You have ${CMAKE_VERSION}")
else()
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELEASE ${CMAKE_CURRENT_SOURCE_DIR}/planet)
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY_DEBUG ${CMAKE_CURRENT_SOURCE_DIR}/planet)
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY_MINSIZEREL ${CMAKE_CURRENT_SOURCE_DIR}/planet)
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY_RELWITHDEBINFO ${CMAKE_CURRENT_SOURCE_DIR}/planet)
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELEASE "Clonk")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_DEBUG "ClonkD")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_MINSIZEREL "ClonkMSR")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_NAME_RELWITHDEBINFO "ClonkRD")
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/planet)
endif()
set_target_properties(clonk PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}/planet)
endif()
############################################################################
@ -933,6 +998,10 @@ if(USE_X11)
${XRANDR_LIBRARIES}
)
endif()
if(USE_COCOA)
#stupid fix: just link to iconv that way
TARGET_LINK_LIBRARIES(clonk "-framework Cocoa -framework AppKit -framework Quartz -framework OpenAL -framework AudioToolBox -liconv")
endif()
if (WIN32)
# CMake is too incompetent to check whether these libraries can be linked to
# So just pretend that everything is fine
@ -948,25 +1017,27 @@ if (WIN32)
target_link_libraries(clonk ws2_32 winmm)
target_link_libraries(c4group ws2_32)
if(MSVC_VERSION)
if(CMAKE_CL_64)
FINDLIB(FMOD_LIBRARIES fmod64vc)
else()
FINDLIB(FMOD_LIBRARIES fmodvc)
if(NOT USE_OPEN_AL)
if(MSVC_VERSION)
if(CMAKE_CL_64)
FINDLIB(FMOD_LIBRARIES fmod64vc)
else()
FINDLIB(FMOD_LIBRARIES fmodvc)
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
FINDLIB(FMOD_LIBRARIES fmod)
endif()
if(FMOD_LIBRARIES)
set(HAVE_FMOD TRUE)
target_link_libraries(clonk
${FMOD_LIBRARIES}
)
else()
set(HAVE_FMOD FALSE)
endif()
elseif(CMAKE_COMPILER_IS_GNUCXX)
FINDLIB(FMOD_LIBRARIES fmod)
endif()
if(FMOD_LIBRARIES)
set(HAVE_FMOD TRUE)
target_link_libraries(clonk
${FMOD_LIBRARIES}
)
else()
set(HAVE_FMOD FALSE)
endif()
endif()
if(NOT HAVE_FMOD OR USE_SDL_MAINLOOP)
if((NOT HAVE_FMOD OR USE_SDL_MAINLOOP) AND NOT USE_OPEN_AL)
include(FindSDL)
SET(HAVE_SDL ${SDL_FOUND})
if(SDL_FOUND)

View File

@ -34,6 +34,9 @@
/* Define to 1 if FMOD is available */
#cmakedefine HAVE_FMOD 1
/* Use OpenAL for playing sounds */
#cmakedefine USE_OPEN_AL 1
/* Define to 1 if you have the <locale.h> header file. */
#cmakedefine HAVE_LOCALE_H 1
@ -194,3 +197,5 @@
/* Define to 1 if you have support for nullptr. */
#cmakedefine HAVE_NULLPTR 1
/* Use Apple Cocoa for the UI */
#cmakedefine USE_COCOA 1

View File

@ -52,6 +52,8 @@ public:
virtual void HandleMessage (XEvent &e);
#elif defined(USE_SDL_MAINLOOP)
virtual void HandleMessage (SDL_Event &e);
#elif defined(USE_COCOA)
virtual void HandleMessage (/*NSEvent*/void* event);
#endif
virtual void PerformUpdate();
};

View File

@ -77,6 +77,7 @@ public:
bool ToggleShowVertices();
bool ToggleShowAction();
bool ToggleShowHelp();
friend class C4FullScreen;
};
extern C4GraphicsSystem GraphicsSystem;

View File

@ -32,8 +32,6 @@
#include <C4Version.h>
#include "C4Network2.h"
#include "MacUtility.h"
#ifdef _WIN32
#include <shellapi.h>
@ -193,12 +191,6 @@ static void crash_handler(int signo)
}
#endif // HAVE_SIGNAL_H
#ifdef __APPLE__
void restart(char* args[])
{
MacUtility::restart(args);
}
#else
static void restart(char * argv[])
{
// Close all file descriptors except stdin, stdout, stderr
@ -208,7 +200,6 @@ static void restart(char * argv[])
// Execute the new engine
execlp(argv[0], argv[0], static_cast<char *>(0));
}
#endif
int main (int argc, char * argv[])
{

View File

@ -0,0 +1,491 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4Console.h>
#include <C4Application.h>
#include <C4GameSave.h>
#include <C4Game.h>
#include <C4MessageInput.h>
#include <C4UserMessages.h>
#include <C4Version.h>
#include <C4Language.h>
#include <C4Player.h>
#include <C4Landscape.h>
#include <C4GraphicsSystem.h>
#include <C4PlayerList.h>
#include <C4GameControl.h>
#include <C4Texture.h>
#include <StdFile.h>
#include <StdRegistry.h>
#include <StdGL.h>
#import <Cocoa/Cocoa.h>
#import "ClonkAppDelegate.h"
#import "ConsoleWindowController.h"
#import "ClonkOpenGLView.h"
// implementation of C4Console GUI for Mac OS X
namespace
{
inline ConsoleWindowController* ctrler(C4ConsoleGUI* gui) {return (ConsoleWindowController*)gui->GetController();}
}
class C4ConsoleGUI::State: public C4ConsoleGUI::InternalState<class C4ConsoleGUI>
{
public:
State(C4ConsoleGUI *console): Super(console) {}
};
class C4ToolsDlg::State: public C4ConsoleGUI::InternalState<class C4ToolsDlg>
{
public:
State(C4ToolsDlg *toolsDlg): Super(toolsDlg) {}
~State()
{
[ctrler(&Console).toolsPanel orderOut:nil];
}
CGImageRef CreatePreviewImage();
void Default() {}
void Clear() {}
};
class C4PropertyDlg::State: public C4ConsoleGUI::InternalState<class C4PropertyDlg>
{
public:
State(C4PropertyDlg *dlg): Super(dlg) {}
void Default() {}
void Clear() {}
};
CStdWindow* C4ConsoleGUI::CreateConsoleWindow(CStdApp *application)
{
ClonkWindowController* controller = [ConsoleWindowController new];
this->controller = controller;
[NSBundle loadNibNamed:@"ConsoleWindow" owner:controller];
[controller setStdWindow:this];
this->Active = true;
return this;
}
bool C4ConsoleGUI::Out(const char* message)
{
ConsoleWindowController* controller;
if (controller = ctrler(this))
{
NSTextStorage* textStorage = controller.outputTextView.textStorage;
[textStorage appendAttributedString:[[[NSAttributedString alloc] initWithString:[NSString stringWithFormat:@"%s\n", message]] autorelease]];
[controller.outputTextView scrollRangeToVisible:NSMakeRange([textStorage length]-1, 1)];
}
return true;
}
bool C4ConsoleGUI::ClearLog()
{
[ctrler(this).outputTextView.textStorage
replaceCharactersInRange:NSMakeRange(0, ctrler(this).outputTextView.textStorage.length)
withAttributedString:[[NSAttributedString alloc] initWithString:@""]];
return true;
}
void C4ConsoleGUI::DisplayInfoText(C4ConsoleGUI::InfoTextType type, StdStrBuf& text)
{
NSTextField* label;
switch (type)
{
case CONSOLE_FrameCounter:
label = ctrler(this).frameLabel;
break;
case CONSOLE_ScriptCounter:
label = ctrler(this).scriptLabel;
break;
case CONSOLE_TimeFPS:
label = ctrler(this).timeLabel;
break;
case CONSOLE_Cursor:
return;
default:
return;
}
[label setStringValue:[NSString stringWithUTF8String:text.getData()]];
}
void C4ConsoleGUI::SetCaptionToFileName(const char* file_name)
{
[ctrler(this).window setRepresentedFilename:[NSString stringWithUTF8String:file_name]];
}
bool C4ConsoleGUI::FileSelect(char *sFilename, int iSize, const char * szFilter, DWORD dwFlags, bool fSave)
{
NSSavePanel* savePanel = fSave ? [NSSavePanel savePanel] : [NSOpenPanel openPanel];
if (!fSave)
{
[(NSOpenPanel*)savePanel setCanChooseFiles:YES];
[(NSOpenPanel*)savePanel setCanChooseDirectories:YES];
}
if ([savePanel runModal] == NSFileHandlingPanelOKButton && [[savePanel URL] isFileURL])
{
strncpy(sFilename, [[savePanel URL].path cStringUsingEncoding:NSUTF8StringEncoding], iSize);
return true;
}
else
return false;
}
void C4ConsoleGUI::AddMenuItemForPlayer(C4Player* player, StdStrBuf& player_text)
{
NSMenuItem* item = [
[ClonkAppDelegate instance].newViewportForPlayerMenuItem.submenu
addItemWithTitle:[NSString stringWithUTF8String:player_text.getData()] action:@selector(newViewportForPlayer:) keyEquivalent:@""
];
[item setTag:player->Number];
[item setTarget: ClonkAppDelegate.instance];
}
void C4ConsoleGUI::ClearViewportMenu()
{
[[ClonkAppDelegate instance].newViewportForPlayerMenuItem.submenu removeAllItems];
}
bool C4ConsoleGUI::Message(const char *message, bool query)
{
NSAlert* alert = [NSAlert
alertWithMessageText:[NSString stringWithUTF8String:C4ENGINECAPTION]
defaultButton:query ? @"Yes" : nil
alternateButton:query ? @"No" : nil
otherButton:nil
informativeTextWithFormat:[NSString stringWithUTF8String:message]
];
[alert runModal];
return true;
}
bool C4ConsoleGUI::PropertyDlgOpen(C4PropertyDlg* dlg)
{
[ctrler(this).objectsPanel orderFront:nil];
return true;
}
void C4ConsoleGUI::PropertyDlgUpdate(C4PropertyDlg *dlg, StdStrBuf &text)
{
[ctrler(this).objectPropertiesText.textStorage setAttributedString:[[[NSAttributedString alloc] initWithString:[NSString stringWithUTF8String:text.getData()]] autorelease]];
}
void C4ConsoleGUI::ClearDlg(void *dlg)
{
if (dlg == &Console.PropertyDlg)
[ctrler(this).objectsPanel orderOut:nil];
else if (dlg == &Console.ToolsDlg)
[ctrler(this).toolsPanel orderOut:nil];
}
bool C4ConsoleGUI::ToolsDlgOpen(C4ToolsDlg *dlg)
{
[ctrler(this).toolsPanel orderFront:nil];
return true;
}
void C4ConsoleGUI::ToolsDlgInitMaterialCtrls(class C4ToolsDlg *dlg)
{
NSPopUpButton* materialsPopup = ctrler(this).materialsPopup;
[materialsPopup removeAllItems];
[materialsPopup addItemWithTitle:[NSString stringWithUTF8String:C4TLS_MatSky]];
NSMutableArray* ary = [[NSMutableArray alloc] initWithCapacity:MaterialMap.Num+1];
[ary addObject:[NSString stringWithUTF8String:C4TLS_MatSky]];
for (int32_t cnt = 0; cnt < ::MaterialMap.Num; cnt++)
{
[ary addObject:[NSString stringWithUTF8String: ::MaterialMap.Map[cnt].Name]];
}
[ary sortUsingComparator:^(id a, id b) {return [a compare:b];}];
for (NSString* s in ary)
{
[materialsPopup addItemWithTitle:s];
}
[ary release];
[materialsPopup selectItemWithTitle:[NSString stringWithUTF8String:dlg->Material]];
}
void C4ToolsDlg::UpdateToolCtrls()
{
[ctrler(&Console).toolSelector setSelectedSegment:Tool];
}
void C4ToolsDlg::UpdateTextures()
{
// Refill dlg
NSPopUpButton* texturesPopup = ctrler(&Console).texturesPopup;
[texturesPopup removeAllItems];
// bottom-most: any invalid textures
bool fAnyEntry = false; int32_t cnt; const char *szTexture;
if (::Landscape.Mode!=C4LSC_Exact)
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
{
if (!::TextureMap.GetIndex(Material, szTexture, false))
{
fAnyEntry = true;
[texturesPopup insertItemWithTitle:[NSString stringWithUTF8String:szTexture] atIndex:0];
}
}
// separator
if (fAnyEntry)
{
[texturesPopup insertItemWithTitle:@"-------" atIndex:0];
}
// atop: valid textures
for (cnt=0; (szTexture=::TextureMap.GetTexture(cnt)); cnt++)
{
// Current material-texture valid? Always valid for exact mode
if (::TextureMap.GetIndex(Material,szTexture,false) || ::Landscape.Mode==C4LSC_Exact)
{
[texturesPopup insertItemWithTitle:[NSString stringWithUTF8String:szTexture] atIndex:0];
}
}
// reselect current
[texturesPopup selectItemWithTitle:[NSString stringWithUTF8String:Texture]];
}
void C4ConsoleGUI::ToolsDlgSetTexture(class C4ToolsDlg *dlg, const char *texture)
{
[ctrler(this).texturesPopup selectItemWithTitle:[NSString stringWithUTF8String:texture]];
}
void C4ToolsDlg::NeedPreviewUpdate()
{
CGImageRef image = state->CreatePreviewImage();
[ctrler(&Console).previewView setImage:image imageProperties:[NSDictionary dictionary]];
CGImageRelease(image);
}
namespace
{
// copy-pasta from http://stackoverflow.com/questions/2395650/fastest-way-to-draw-a-screen-buffer-on-the-iphone
const void* GetBytePointer(void* info)
{
// this is currently only called once
return info; // info is a pointer to the buffer
}
void ReleaseBytePointer(void*info, const void* pointer)
{
// don't care, just using the one static buffer at the moment
}
size_t GetBytesAtPosition(void* info, void* buffer, off_t position, size_t count)
{
// I don't think this ever gets called
memcpy(buffer, ((char*)info) + position, count);
return count;
}
}
CGImageRef C4ToolsDlg::State::CreatePreviewImage()
{
SURFACE sfcPreview;
int32_t iPrvWdt,iPrvHgt;
RECT rect;
rect.left = rect.top = 0;
rect.bottom = [ctrler(&Console).previewView frame].size.height;
rect.right = [ctrler(&Console).previewView frame].size.width;
iPrvWdt=rect.right-rect.left;
iPrvHgt=rect.bottom-rect.top;
if (!(sfcPreview=new CSurface(iPrvWdt,iPrvHgt))) return NULL;
// fill bg
BYTE bCol = 0;
CPattern Pattern;
// Sky material: sky as pattern only
if (SEqual(GetOwner()->Material,C4TLS_MatSky))
{
Pattern.Set(::Landscape.Sky.Surface, 0);
}
// Material-Texture
else
{
bCol=Mat2PixColDefault(::MaterialMap.Get(GetOwner()->Material));
// Get/Create TexMap entry
BYTE iTex = ::TextureMap.GetIndex(GetOwner()->Material, GetOwner()->Texture, true);
if (iTex)
{
// Define texture pattern
const C4TexMapEntry *pTex = ::TextureMap.GetEntry(iTex);
// Security
if (pTex)
{
// Set drawing pattern
Pattern = pTex->GetPattern();
}
}
}
lpDDraw->DrawPatternedCircle(
sfcPreview,
iPrvWdt/2,iPrvHgt/2,
GetOwner()->Grade,
bCol, Pattern, *::Landscape.GetPal()
);
//Application.DDraw->AttachPrimaryPalette(sfcPreview);
DWORD *pixels = new DWORD[iPrvWdt*iPrvHgt];
for (int x = 0; x < iPrvWdt; x++) for (int y = 0; y < iPrvHgt; y++)
{
pixels[x+y*iPrvWdt] = sfcPreview->GetPixDw(x, y, true);
}
CGDataProviderDirectCallbacks callbacks = {0, ::GetBytePointer, ::ReleaseBytePointer, ::GetBytesAtPosition, 0};
CGDataProviderRef pixelData = CGDataProviderCreateDirect(pixels, iPrvWdt*iPrvHgt*sizeof(DWORD), &callbacks);
CGImageRef image = CGImageCreate(iPrvWdt, iPrvHgt, 8, 4*8, iPrvWdt*4, [[NSColorSpace deviceRGBColorSpace] CGColorSpace], kCGBitmapByteOrder32Little, pixelData, NULL, true, kCGRenderingIntentDefault);
CGDataProviderRelease(pixelData);
delete sfcPreview;
return image;
}
void C4ConsoleGUI::ToolsDlgSetMaterial(class C4ToolsDlg *dlg, const char *material)
{
[ctrler(this).texturesPopup selectItemWithTitle:[NSString stringWithUTF8String:material]];
}
void C4ToolsDlg::InitGradeCtrl()
{
}
bool C4ToolsDlg::PopMaterial()
{
return true;
}
void C4ConsoleGUI::ShowAboutWithCopyright(StdStrBuf &copyright)
{
StdStrBuf strMessage; strMessage.Format("%s %s\n\n%s", C4ENGINECAPTION, C4VERSION, copyright.getData());
Message(strMessage.getData(), false);
}
void C4ConsoleGUI::ToolsDlgSelectTexture(C4ToolsDlg *dlg, const char *texture)
{
[ctrler(this).texturesPopup selectItemWithTitle:[NSString stringWithUTF8String:texture]];
}
void C4ConsoleGUI::ToolsDlgSelectMaterial(C4ToolsDlg *dlg, const char *material)
{
[ctrler(this).materialsPopup selectItemWithTitle:[NSString stringWithUTF8String:material]];
}
void C4ToolsDlg::UpdateIFTControls()
{
}
void C4ConsoleGUI::SetCursor(C4ConsoleGUI::Cursor cursor)
{
}
void C4ConsoleGUI::RecordingEnabled()
{
[[[ClonkAppDelegate instance] recordMenuItem] setEnabled:NO];
}
void C4ConsoleGUI::UpdateNetMenu(Stage stage)
{
switch (stage)
{
case C4ConsoleGUI::STAGE_Start:
[ClonkAppDelegate.instance.netMenu setHidden:NO];
break;
default:
break;
}
}
void C4ConsoleGUI::ClearNetMenu(Stage stage)
{
switch (stage)
{
case C4ConsoleGUI::STAGE_Start:
[ClonkAppDelegate.instance.netMenu setHidden:YES];
break;
default:
break;
}
}
void C4ConsoleGUI::DoEnableControls(bool fEnable)
{
}
bool C4ConsoleGUI::DoUpdateHaltCtrls(bool fHalt)
{
return true;
}
void C4ConsoleGUI::ToolsDlgEnableControls(C4ToolsDlg *dlg)
{
}
void C4ConsoleGUI::ClearInput()
{
[ctrler(this).consoleCombo setStringValue:[NSString string]];
}
void C4ConsoleGUI::ClearPlayerMenu()
{
}
void C4ConsoleGUI::AddNetMenuItemForPlayer(int32_t index, StdStrBuf &text)
{
NSMenuItem *item = [[NSMenuItem alloc] initWithTitle:[NSString stringWithCString:text.getData() encoding:NSUTF8StringEncoding] action:@selector(kickPlayer:) keyEquivalent:[NSString string]];
[item setTarget:ctrler(this)];
[ClonkAppDelegate.instance.netMenu.submenu addItem:item];
}
void C4ConsoleGUI::SetInputFunctions(std::vector<char*> &functions)
{
}
void C4ConsoleGUI::PropertyDlgSetFunctions(C4PropertyDlg *dlg, std::vector<char*> &functions)
{
}
void C4ConsoleGUI::AddKickPlayerMenuItem(C4Player *player, StdStrBuf& player_text, bool enabled)
{
NSMenuItem* item = [
[ClonkAppDelegate instance].kickPlayerMenuItem.submenu
addItemWithTitle:[NSString stringWithUTF8String:player_text.getData()] action:@selector(kickPlayer:) keyEquivalent:@""
];
[item setEnabled:enabled];
[item setTag:player->Number];
[item setTarget: ctrler(this)];
}
bool C4ToolsDlg::PopTextures()
{
return true;
}
void C4ToolsDlg::UpdateLandscapeModeCtrls()
{
}
bool C4ConsoleGUI::UpdateModeCtrls(int iMode)
{
return true;
}
#define CONSOLEGUICOMMONINCLUDE
#include "C4ConsoleGUICommon.h"

View File

@ -29,7 +29,7 @@
#include <C4Game.h>
#ifndef _WIN32
#ifdef USE_X11
#include <X11/Xlib.h>
#include <X11/Xutil.h> // XConvertCase
#endif
@ -325,6 +325,8 @@ const C4KeyCodeMapEntry KeyCodeMap [] =
{ KEY_Default, "None", NULL},
{ KEY_Undefined, NULL, NULL }
};
#elif defined(USE_COCOA)
#include "CocoaKeycodeMap.h"
#endif
C4KeyCode C4KeyCodeEx::String2KeyCode(const StdStrBuf &sName)
@ -429,7 +431,7 @@ C4KeyCode C4KeyCodeEx::String2KeyCode(const StdStrBuf &sName)
}
}
#ifdef _WIN32
#if defined(_WIN32) || defined(USE_COCOA)
// query map
const C4KeyCodeMapEntry *pCheck = KeyCodeMap;
while (pCheck->szName)
@ -527,7 +529,7 @@ StdStrBuf C4KeyCodeEx::KeyCode2String(C4KeyCode wCode, bool fHumanReadable, bool
}
}
#ifdef _WIN32
#if defined(_WIN32) || defined(USE_COCOA)
// TODO: Works?
// StdStrBuf Name; Name.SetLength(1000);

View File

@ -59,7 +59,7 @@ static void FSEvents_Callback(
// FSEvents only tells us about directories in which some files were modified
char** paths = (char**)eventPaths;
C4FileMonitor* mon = (C4FileMonitor*)clientCallBackInfo;
for (int i = 0; i < numEvents; i++)
for (unsigned int i = 0; i < numEvents; i++)
{
NSString* dir = [NSString stringWithUTF8String:paths[i]];
NSArray* filesInDir = [[NSFileManager defaultManager] contentsOfDirectoryAtPath:dir error:NULL];

View File

@ -41,7 +41,6 @@ public:
C4Viewport * cvp;
C4ViewportWindow(C4Viewport * cvp): cvp(cvp) { }
#ifdef _WIN32
virtual CStdWindow * Init(CStdWindow::WindowKind windowKind, CStdApp * pApp, const char * Title, CStdWindow * pParent, bool);
static bool RegisterViewportClass(HINSTANCE hInst);
#elif defined(WITH_DEVELOPER_MODE)
virtual GtkWidget* InitGUI();
@ -67,6 +66,9 @@ public:
GtkWidget* drawing_area;
#elif defined(USE_X11) && !defined(WITH_DEVELOPER_MODE)
virtual void HandleMessage (XEvent &);
#endif
#if defined(USE_COCOA) || defined(_WIN32)
virtual CStdWindow * Init(CStdWindow::WindowKind windowKind, CStdApp * pApp, const char * Title, CStdWindow * pParent, bool);
#endif
void EditCursorMove(int X, int Y, uint16_t);
virtual void Close();

View File

@ -0,0 +1,59 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
#ifdef USE_COCOA
#import "ConsoleWindowController.h"
#endif
@interface ClonkAppDelegate: NSObject
{
NSMutableArray *gatheredArguments;
NSString *clonkDirectory;
NSString *addonSupplied;
ConsoleWindowController *consoleController;
// declared here since ConsoleWindow.xib can't refer to objects in MainMenu.xib -.-
IBOutlet NSMenuItem *newViewportForPlayerMenuItem;
IBOutlet NSMenuItem *kickPlayerMenuItem;
IBOutlet NSMenuItem *recordMenuItem;
IBOutlet NSMenuItem *netMenu;
BOOL running;
char** argv;
int argc;
}
- (NSString*) clonkDirectory;
- (BOOL) argsLookLikeItShouldBeInstallation;
- (void)makeFakeArgs:(char***)argv argc:(int*)argc;
- (BOOL)installAddOn;
- (void)terminate:(NSApplication*)sender;
+ (ClonkAppDelegate*) instance;
+ (BOOL) isConsoleAndGameRunning;
#ifdef USE_COCOA
@property(readonly) NSMenuItem* newViewportForPlayerMenuItem;
@property(readonly) NSMenuItem* kickPlayerMenuItem;
@property(readwrite, retain) ConsoleWindowController* consoleController;
@property(readonly) NSMenuItem* recordMenuItem;
@property(readonly) NSMenuItem* netMenu;
#endif
@end

View File

@ -1,18 +1,53 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
// Roughly adapted from the original ClonkAppDelegate.m; haxxed to death by teh Gurkendoktor.
// Look at main() to get an idea for what happens here.
#include <C4Include.h>
#include <C4Application.h>
#include <C4Game.h>
#import "ClonkAppDelegate.h"
#ifdef USE_SDL_MAINLOOP
#import "SDL/SDL.h"
#endif
/* The main class of the application, the appl¤ication's delegate */
@implementation ClonkAppDelegate
+ (ClonkAppDelegate*) instance;
{
return (ClonkAppDelegate*)[[NSApplication sharedApplication] delegate];
}
+ (BOOL) isConsoleAndGameRunning
{
return Application.isEditor && Game.IsRunning;
}
#ifdef USE_COCOA
@synthesize newViewportForPlayerMenuItem, consoleController, kickPlayerMenuItem, recordMenuItem, netMenu;
#endif
- (id) init
{
if (self = [super init]) {
self = [super init];
if (self)
{
NSArray* args = [[NSProcessInfo processInfo] arguments];
gatheredArguments = [args copy];
gameState = GS_NotYetStarted;
}
return self;
}
@ -33,7 +68,7 @@
{
// later decide whether to install or run
addonSupplied = filename;
if (gameState == GS_Running)
if (running)
{
// if application is already running install immediately
[self installAddOn];
@ -48,49 +83,78 @@
[gatheredArguments addObject:url];
}
- (void)gameLoop
- (void) quitAndMaybeRestart
{
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[self clonkDirectory]];
[NSApp activateIgnoringOtherApps:YES];
// Hand off to Clonk code
char** newArgv;
int newArgc;
[self makeFakeArgs:&newArgv argc:&newArgc];
int status = SDL_main(newArgc, newArgv);
for (int i = newArgc-1; i >= 0; i--) {free (newArgv[i]);}
free(newArgv);
// free app stuff
Application.Clear();
if (Application.restartAtEnd)
{
NSString* filename = [[NSBundle mainBundle] bundlePath];
NSString* cmd = [@"open " stringByAppendingString: filename];
system([cmd UTF8String]);
}
}
/* Called when the internal event loop has just started running */
- (void) applicationDidFinishLaunching: (NSNotification *) note
{
if (!([self argsLookLikeItShouldBeInstallation] && [self installAddOn]))
{
gameState = GS_Running;
[self gameLoop];
gameState = GS_Finished;
[[NSFileManager defaultManager] changeCurrentDirectoryPath:[self clonkDirectory]];
[NSApp activateIgnoringOtherApps:YES];
[self makeFakeArgs];
#ifdef USE_SDL_MAINLOOP
running = true;
SDL_main(newArgc, newArgv);
running = NO;
[self quitAndMaybeRestart];
[NSApp terminate:self];
#endif
#ifdef USE_COCOA
// Init application
if (!Application.Init(argc, argv))
{
Application.Clear();
[NSApp terminate:self];
}
[[NSRunLoop currentRunLoop] performSelector:@selector(delayedRun:) target:self argument:self order:0 modes:[NSArray arrayWithObject:NSDefaultRunLoopMode]];
#endif
}
}
- (void) delayedRun:(id)sender
{
running = YES;
while (!Application.fQuitMsgReceived)
Application.ScheduleProcs();
running = NO;
[self quitAndMaybeRestart];
[NSApp terminate:self];
}
- (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication*)application
{
if (gameState == GS_Running)
if (running)
{
[self terminate:application];
return NSTerminateCancel; // cancels logoff but it's the only way that does not interrupt the lifecycle of the application
return NSTerminateCancel;
}
return NSTerminateNow;
}
- (void)terminate:(NSApplication*)sender
{
#ifdef USE_SDL_MAINLOOP
// Post an SDL_QUIT event
SDL_Event event;
event.type = SDL_QUIT;
SDL_PushEvent(&event);
#endif
#ifdef USE_COCOA
Application.Quit();
#endif
}
// arguments that should be converted to a c char* array and then passed on to SDL_main
@ -139,7 +203,6 @@
// Already installed?
if ([destPath isEqualToString:addonSupplied])
{
[gatheredArguments addObject:@"/fullscreen"];
return NO; // run scenarios when they are already in the clonk directory
}
@ -147,7 +210,7 @@
if ([fileManager fileExistsAtPath:destPath])
// better to throw it into the trash. everything else seems so dangerously destructive
[[NSWorkspace sharedWorkspace] performFileOperation:NSWorkspaceRecycleOperation source:[self clonkDirectory] destination:@"" files:[NSArray arrayWithObject:justFileName] tag:0];
if ([fileManager copyPath:addonSupplied toPath:destPath handler:nil])
if ([fileManager copyItemAtPath:addonSupplied toPath:destPath error:NULL])
formatString = NSLocalizedString(@"AddOnInstallationSuccess", nil);
else
formatString = NSLocalizedString(@"AddOnInstallationFailure", nil);
@ -160,16 +223,15 @@
}
// convert gatheredArguments to c array
- (void)makeFakeArgs:(char***)argv argc:(int*)argc
- (void)makeFakeArgs
{
int argCount = [gatheredArguments count];
char** args = (char**)malloc(sizeof(char*) * argCount);
argv = (char**)malloc(sizeof(char*) * argCount);
for (int i = 0; i < argCount; i++)
{
args[i] = strdup([[gatheredArguments objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding]);
argv[i] = strdup([[gatheredArguments objectAtIndex:i] cStringUsingEncoding:NSUTF8StringEncoding]);
}
*argv = args;
*argc = argCount;
argc = argCount;
}
@end

View File

@ -0,0 +1,25 @@
#import <Cocoa/Cocoa.h>
#import "ClonkAppDelegate.h"
@interface ClonkAppDelegate (ClonkMainMenuActions)
- (IBAction) openScenario:(id)sender;
- (IBAction) openScenarioWithPlayers:(id)sender;
- (IBAction) closeScenario:(id)sender;
- (IBAction) saveGame:(id)sender;
- (IBAction) saveGameAs:(id)sender;
- (IBAction) saveScenario:(id)sender;
- (IBAction) saveScenarioAs:(id)sender;
- (IBAction) record:(id)sender;
- (IBAction) newViewport:(id)sender;
- (IBAction) openPropTools:(id)sender;
- (IBAction) newViewportForPlayer:(id)sender;
- (IBAction) joinPlayer:(id)sender;
- (IBAction) showAbout:(id)sender;
- (IBAction) toggleFullscreen:(id)sender;
- (IBAction) togglePause:(id)sender;
- (IBAction) setConsoleMode:(id)sender;
- (IBAction) setDrawingTool:(id)sender;
- (IBAction) suggestQuitting:(id)sender;
- (IBAction) simulateKeyPressed:(C4KeyCode)key;
- (IBAction) visitWebsite:(id)sender;
@end

View File

@ -0,0 +1,195 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4Fullscreen.h>
#include <C4GraphicsSystem.h>
#include <C4Viewport.h>
#include <C4Console.h>
#include <C4Game.h>
#import <StdGL.h>
#import "ClonkMainMenuActions.h"
#import "ClonkOpenGLView.h"
#import "ConsoleWindowController.h"
@implementation ClonkAppDelegate (ClonkMainMenuActions)
- (IBAction) openScenario:(id)sender
{
Console.FileOpen();
}
- (IBAction) openScenarioWithPlayers:(id)sender
{
Console.FileOpenWPlrs();
}
- (IBAction) closeScenario:(id)sender
{
Console.FileClose();
[consoleController.window setRepresentedFilename:@""];
}
- (IBAction) saveGame:(id)sender
{
Console.FileSave(true);
}
- (IBAction) saveGameAs:(id)sender
{
Console.FileSaveAs(true);
}
- (IBAction) saveScenario:(id)sender
{
Console.FileSave(false);
}
- (IBAction) saveScenarioAs:(id)sender
{
Console.FileSaveAs(false);
}
- (IBAction) record:(id)sender
{
Console.FileRecord();
}
- (IBAction) newViewport:(id)sender
{
Console.ViewportNew();
}
- (IBAction) newViewportForPlayer:(id)sender
{
::Viewports.CreateViewport([sender tag]);
}
- (IBAction) joinPlayer:(id)sender
{
Console.PlayerJoin();
}
- (IBAction) openPropTools:(id)sender;
{
Console.EditCursor.OpenPropTools();
}
- (IBAction) showAbout:(id)sender;
{
Console.HelpAbout();
}
- (IBAction) toggleFullscreen:(id)sender
{
if (Application.isEditor)
{
NSBeep();
return;
}
Config.Graphics.Windowed = !Config.Graphics.Windowed;
Application.SetVideoMode(Config.Graphics.ResX, Config.Graphics.ResY, Config.Graphics.BitDepth, Config.Graphics.Monitor, !Config.Graphics.Windowed);
}
- (IBAction) simulateKeyPressed:(C4KeyCode)key
{
Game.DoKeyboardInput(
key,
KEYEV_Down,
false, false, false,
false, NULL
);
Game.DoKeyboardInput(
key,
KEYEV_Up,
false, false, false,
false, NULL
);
}
- (IBAction) togglePause:(id)sender
{
[self simulateKeyPressed:K_PAUSE];
}
- (IBAction) setConsoleMode:(id)sender
{
[consoleController selectMode:sender];
[consoleController.modeSelector selectSegmentWithTag:[sender tag]];
}
- (IBAction) setDrawingTool:(id)sender
{
[consoleController selectTool:sender];
[consoleController.toolSelector selectSegmentWithTag:[sender tag]];
}
- (IBAction) suggestQuitting:(id)sender;
{
// don't directly quit when running in fullscreen mode but rather just send escape
// which will quit the game when in the startup menu and ask whether to leave the round when playing a round
if (Application.isEditor)
[NSApp terminate:self];
else
Application.fQuitMsgReceived = true;
}
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
{
// enabled when running in fullscreen
if ([item action] == @selector(toggleFullscreen:))
return !Application.isEditor;
// game running no matter whether console or fullscreen
if ([item action] == @selector(togglePause:))
return Game.IsRunning;
// enabled when game running and console mode
SEL gameRunningInConsoleModeSelectors[] =
{
@selector(saveScenario:),
@selector(saveScenarioAs:),
@selector(saveGame:),
@selector(saveGameAs:),
@selector(record:),
@selector(closeScenario:),
@selector(newViewport:),
@selector(newViewportForPlayer:),
@selector(joinPlayer:),
@selector(openPropTools:),
@selector(setConsoleMode:),
nil
};
int i = 0;
SEL s;
while (s = gameRunningInConsoleModeSelectors[i++])
{
if (s == [item action])
return Application.isEditor && Game.IsRunning;
}
// always enabled
return YES;
}
- (IBAction) visitWebsite:(id)sender;
{
OpenURL("http://wiki.openclonk.org");
}
@end

View File

@ -1,12 +1,6 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 1998-2000 Matthes Bender
* Copyright (c) 2004, 2007 Gɬºnther Brammer
* Copyright (c) 2008 Peter Wortmann
* Copyright (c) 2009 Mortimer
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
@ -19,15 +13,25 @@
* See clonk_trademark_license.txt for full license.
*/
#ifdef __APPLE__
namespace MacUtility
{
bool isGerman();
bool sendFileToTrash(const char* szFilename);
void restart(char*[]);
int keyRepeatDelay(int defaultValue);
int keyRepeatInterval(int defaultValue);
#import <Cocoa/Cocoa.h>
#include <StdWindow.h>
void ensureWindowInFront();
#ifdef USE_COCOA
@class ClonkWindowController;
@interface ClonkOpenGLView : NSView {
@private
NSOpenGLContext* context;
}
#endif
- (ClonkWindowController*) controller;
- (void)update;
- (void) enableEvents;
- (void) showCursor;
- (void) hideCursor;
- (BOOL) shouldHideMouseCursor;
@property(readwrite, retain) NSOpenGLContext* context;
@end
#endif

View File

@ -0,0 +1,539 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4GraphicsSystem.h>
#include <C4MouseControl.h>
#include <C4GUI.h>
#include <C4Game.h>
#include <C4Viewport.h>
#include <C4ViewportWindow.h>
#include <C4Console.h>
#include <C4Fullscreen.h>
#include <C4PlayerList.h>
#include <C4Gui.h>
#include <C4Landscape.h>
#include <StdGL.h>
#import "ClonkOpenGLView.h"
#import "ClonkWindowController.h"
#import "ClonkMainMenuActions.h"
#ifdef USE_COCOA
@implementation ClonkOpenGLView
@synthesize context;
- (BOOL) isOpaque {return YES;}
- (NSOpenGLContext*) context {return context;}
- (void) dealloc
{
[context release];
[super dealloc];
}
- (id) initWithFrame:(NSRect)frameRect
{
self = [super initWithFrame:frameRect];
if (self != nil) {
[[NSNotificationCenter defaultCenter]
addObserver:self
selector:@selector(_surfaceNeedsUpdate:)
name:NSViewGlobalFrameDidChangeNotification
object:self];
}
return self;
}
- (void) awakeFromNib
{
[self enableEvents];
}
- (void) enableEvents
{
[[self window] makeFirstResponder:self];
[[self window] setAcceptsMouseMovedEvents:YES];
[self registerForDraggedTypes:[NSArray arrayWithObjects:NSFilenamesPboardType, nil]];
}
- (BOOL) acceptsFirstResponder {return YES;}
- (void) resetCursorRects
{
[super resetCursorRects];
if ([self shouldHideMouseCursor])
{
static NSCursor* cursor;
if (!cursor)
{
cursor = [[NSCursor alloc] initWithImage:[[NSImage alloc] initWithSize:NSMakeSize(1, 1)] hotSpot:NSMakePoint(0, 0)];
}
[self addCursorRect:self.bounds cursor:cursor];
}
}
- (void) _surfaceNeedsUpdate:(NSNotification*)notification
{
[self update];
}
- (void) lockFocus
{
NSOpenGLContext* ctx = [self context];
[super lockFocus];
if ([ctx view] != self) {
[ctx setView:self];
}
[ctx makeCurrentContext];
if (!Application.isEditor)
{
/*int swapInterval = 1;
[ctx setValues:&swapInterval forParameter:NSOpenGLCPSwapInterval]; */
}
}
- (void) viewDidMoveToWindow
{
[super viewDidMoveToWindow];
if ([self window] == nil)
[context clearDrawable];
}
- (void) drawRect:(NSRect)rect
{
// better not to draw anything when the game has already finished
if (Application.fQuitMsgReceived)
return;
// don't draw if tab-switched away from fullscreen
if ([self.controller isFullscreen] && ![NSApp isActive]) // ugh - no way to find out if window is hidden due hidesondeactivate?
return;
[self.context update];
CStdWindow* stdWindow = self.controller.stdWindow;
if (stdWindow)
{
stdWindow->PerformUpdate();
}
}
- (ClonkWindowController*) controller {return (ClonkWindowController*)[self.window delegate];}
int32_t mouseButtonFromEvent(NSEvent* event, DWORD& modifierFlags)
{
modifierFlags = [event modifierFlags]; // should be compatible since MK_* constants mirror the NS* constants
switch (event.type)
{
case NSLeftMouseDown:
return [event clickCount] > 1 ? C4MC_Button_LeftDouble : C4MC_Button_LeftDown;
case NSLeftMouseUp:
return C4MC_Button_LeftUp;
case NSRightMouseDown:
return [event clickCount] > 1 ? C4MC_Button_RightDouble : C4MC_Button_RightDown;
case NSRightMouseUp:
return C4MC_Button_RightUp;
case NSLeftMouseDragged: case NSRightMouseDragged:
return C4MC_Button_None; // sending mouse downs all the time when dragging is not the right thing to do
case NSOtherMouseDown:
return C4MC_Button_MiddleDown;
case NSOtherMouseUp:
return C4MC_Button_MiddleUp;
case NSScrollWheel:
return C4MC_Button_Wheel;
}
return C4MC_Button_None;
}
- (BOOL) shouldHideMouseCursor
{
return !Application.isEditor || (self.controller.viewport && Console.EditCursor.GetMode() == C4CNS_ModePlay && ValidPlr(self.controller.viewport->GetPlayer()));
}
- (void) showCursor
{
if ([self shouldHideMouseCursor])
[NSCursor unhide];
}
- (void) hideCursor
{
if ([self shouldHideMouseCursor])
[NSCursor hide];
}
- (void) mouseEvent:(NSEvent*)event
{
DWORD flags = 0;
int32_t button = mouseButtonFromEvent(event, flags);
NSPoint point = [self convertPoint:[self.window mouseLocationOutsideOfEventStream] fromView:nil];
int actualSizeX = Config.Graphics.ResX;
int actualSizeY = Config.Graphics.ResY;
if (!Application.isEditor)
{
point.x *= Config.Graphics.ResX/[self bounds].size.width;
point.y *= Config.Graphics.ResY/[self bounds].size.height;
}
else
{
actualSizeX = self.frame.size.width;
actualSizeY = self.frame.size.height;
}
int x = fmin(fmax(point.x, 0), actualSizeX);
int y = fmin(fmax(actualSizeY - point.y, 0), actualSizeY);
{
C4Viewport* viewport = self.controller.viewport;
if (::MouseControl.IsViewport(viewport) && Console.EditCursor.GetMode() == C4CNS_ModePlay)
{
::C4GUI::MouseMove(button, x, y, [event type] == NSScrollWheel ? ((int)[event deltaY] << 16) : 0, viewport);
}
else if (viewport)
{
switch (button)
{
case C4MC_Button_LeftDown:
Console.EditCursor.Move(viewport->ViewX+x/viewport->GetZoom(), viewport->ViewY+y/viewport->GetZoom(), 0);
Console.EditCursor.LeftButtonDown(!!(flags & MK_CONTROL));
break;
case C4MC_Button_LeftUp:
Console.EditCursor.LeftButtonUp();
break;
case C4MC_Button_RightDown:
Console.EditCursor.RightButtonDown(!!(flags & MK_CONTROL));
break;
case C4MC_Button_RightUp:
Console.EditCursor.RightButtonUp();
break;
case C4MC_Button_None:
Console.EditCursor.Move(viewport->ViewX+x/viewport->GetZoom(),viewport->ViewY+y/viewport->GetZoom(), 0);
break;
}
}
}
}
- (void) magnifyWithEvent:(NSEvent *)event
{
// NSLog(@"%f", [event magnification]);
C4Viewport* viewport = self.controller.viewport;
if (viewport)
{
// float x = viewport->ViewX+ ::pGUI->Mouse.x/viewport->GetZoom();
// float y = viewport->ViewY+ ::pGUI->Mouse.y/viewport->GetZoom();
viewport->SetZoom(viewport->GetZoom()+[event magnification], true);
// viewport->ViewX = x - ::pGUI->Mouse.x/viewport->GetZoom();
// viewport->ViewY = y - ::pGUI->Mouse.y/viewport->GetZoom();
}
}
- (void) swipeWithEvent:(NSEvent*)event
{
// swiping left triggers going back in startup dialogs
if (event.deltaX > 0)
[ClonkAppDelegate.instance simulateKeyPressed:K_LEFT];
else
[ClonkAppDelegate.instance simulateKeyPressed:K_RIGHT];
}
- (void)insertText:(id)insertString
{
if (::pGUI)
{
NSString* str = [insertString isKindOfClass:[NSAttributedString class]] ? [(NSAttributedString*)insertString string] : (NSString*)insertString;
for (unsigned int i = 0; i < [str length]; i++)
{
unichar c = [str characterAtIndex:i];
::pGUI->CharIn((const char*)&c);
}
}
}
- (void)doCommandBySelector:(SEL)selector
{
// ignore to not trigger the annoying beep sound
}
- (void)keyEvent:(NSEvent*)event withKeyEventType:(C4KeyEventType)type
{
Game.DoKeyboardInput(
[event keyCode]+CocoaKeycodeOffset, // offset keycode by some value to distinguish between those special key defines
type,
[event modifierFlags] & NSAlternateKeyMask,
[event modifierFlags] & NSControlKeyMask,
[event modifierFlags] & NSShiftKeyMask,
false, NULL
);
}
- (void)keyDown:(NSEvent*)event
{
[self interpretKeyEvents:[NSArray arrayWithObject:event]]; // call this to route character input to insertText:
[self keyEvent:event withKeyEventType:KEYEV_Down];
}
- (void)keyUp:(NSEvent*)event
{
[self keyEvent:event withKeyEventType:KEYEV_Up];
}
- (NSDragOperation) draggingEntered:(id<NSDraggingInfo>)sender
{
return NSDragOperationCopy;
}
- (NSDragOperation) draggingUpdated:(id<NSDraggingInfo>)sender
{
return NSDragOperationCopy;
}
- (BOOL) prepareForDragOperation:(id<NSDraggingInfo>)sender
{
return YES;
}
- (BOOL) performDragOperation:(id<NSDraggingInfo>)sender
{
NSPasteboard* pasteboard = [sender draggingPasteboard];
if ([[pasteboard types] containsObject:NSFilenamesPboardType])
{
NSArray* files = [pasteboard propertyListForType:NSFilenamesPboardType];
C4Viewport* viewport = self.controller.viewport;
if (viewport)
{
for (NSString* fileName in files)
{
viewport->DropFile([fileName cStringUsingEncoding:NSUTF8StringEncoding], [sender draggingLocation].x, [sender draggingLocation].y);
}
}
}
return YES;
}
- (void )concludeDragOperation:(id<NSDraggingInfo>)sender
{
}
// respaghettisize :D
- (void) scrollWheel:(NSEvent *)event
{
if (!Application.isEditor)
[self mouseEvent:event];
else
{
C4Viewport* viewport = self.controller.viewport;
if (viewport)
{
NSScrollView* scrollView = self.controller.scrollView;
NSPoint p = NSMakePoint(2*-[event deltaX]/(GBackWdt-viewport->ViewWdt), 2*-[event deltaY]/(GBackHgt-viewport->ViewHgt));
[scrollView.horizontalScroller setDoubleValue:scrollView.horizontalScroller.doubleValue+p.x];
[scrollView.verticalScroller setDoubleValue:scrollView.verticalScroller.doubleValue+p.y];
viewport->ViewPositionByScrollBars();
[self display];
}
}
}
- (void) mouseDown: (NSEvent *)event {[self mouseEvent:event];}
- (void) rightMouseDown: (NSEvent *)event {[self mouseEvent:event];}
- (void) rightMouseUp: (NSEvent *)event {[self mouseEvent:event];}
- (void) otherMouseDown: (NSEvent *)event {[self mouseEvent:event];}
- (void) otherMouseUp: (NSEvent *)event {[self mouseEvent:event];}
- (void) mouseUp: (NSEvent *)event {[self mouseEvent:event];}
- (void) mouseMoved: (NSEvent *)event {[self mouseEvent:event];}
- (void) mouseDragged: (NSEvent *)event {[self mouseEvent:event];}
- (void) rightMouseDragged:(NSEvent *)event {[self mouseEvent:event];}
- (void) update
{
[context update];
}
@end
// Implementation of some CStdGLCtx methods - fits here, more or less
void* CStdGLCtx::GetNativeCtx()
{
return ctx;
}
CStdGLCtx::CStdGLCtx(): pWindow(0), ctx(nil), cx(0), cy(0) {}
void CStdGLCtx::Clear()
{
Deselect();
if (ctx)
{
[(NSOpenGLContext*)ctx release];
ctx = nil;
}
pWindow = 0;
cx = cy = 0;
}
NSOpenGLContext* CreateCocoaContext(CStdGLCtx* pMainCtx, NSOpenGLPixelFormat* format)
{
if (!format)
{
NSOpenGLPixelFormatAttribute attrs[] = {
NSOpenGLPFADepthSize, 16,
0
};
format = [[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] autorelease];
}
NSOpenGLContext* result = [[NSOpenGLContext alloc] initWithFormat:format shareContext:pMainCtx ? (NSOpenGLContext*)pMainCtx->GetNativeCtx() : nil];
if (!Application.isEditor)
{
// Make back buffer size fixed ( http://developer.apple.com/library/mac/#documentation/GraphicsImaging/Conceptual/OpenGL-MacProgGuide/opengl_contexts/opengl_contexts.html )
GLint dim[2] = {Config.Graphics.ResX, Config.Graphics.ResY};
CGLContextObj ctx = (CGLContextObj)result.CGLContextObj;
CGLSetParameter(ctx, kCGLCPSurfaceBackingSize, dim);
CGLEnable (ctx, kCGLCESurfaceBackingSize);
}
return result;
}
bool CStdGLCtx::Init(CStdWindow * pWindow, CStdApp *)
{
// safety
if (!pGL) return false;
// store window
this->pWindow = pWindow;
// Create Context with sharing (if this is the main context, our ctx will be 0, so no sharing)
// try direct rendering first
NSOpenGLContext* ctx = CreateCocoaContext(pGL->pMainCtx, nil);//[NSOpenGLView defaultPixelFormat]);
this->ctx = (void*)ctx;
// No luck at all?
if (!Select(true)) return pGL->Error(" gl: Unable to select context");
// init extensions
GLenum err = glewInit();
if (GLEW_OK != err)
{
// Problem: glewInit failed, something is seriously wrong.
return pGL->Error(reinterpret_cast<const char*>(glewGetErrorString(err)));
}
// set the openglview's context
ClonkWindowController* controller = (ClonkWindowController*)pWindow->GetController();
if (controller && controller.openGLView)
{
[controller.openGLView setContext:ctx];
}
return true;
}
bool CStdGLCtx::Select(bool verbose)
{
if (ctx)
[(NSOpenGLContext*)ctx makeCurrentContext];
SelectCommon();
// update clipper - might have been done by UpdateSize
// however, the wrong size might have been assumed
if (!pGL->UpdateClipper())
{
if (verbose) pGL->Error(" gl: UpdateClipper failed");
return false;
}
// success
return true;
}
void CStdGLCtx::Deselect()
{
if (pGL && pGL->pCurrCtx == this)
{
pGL->pCurrCtx = 0;
}
}
/*
bool CStdGLCtx::UpdateSize()
{
// safety
if (!pWindow) return false;
// get size
RECT rc;
pWindow->GetSize(&rc);
int width = rc.right - rc.left, height = rc.bottom - rc.top;
// assign if different
if (cx!=width || cy!=height)
{
cx=width; cy=height;
if (pGL) pGL->UpdateClipper();
}
// success
return true;
}
*/
bool CStdGLCtx::PageFlip()
{
// flush GL buffer
glFlush();
if (!pWindow) return false;
//SDL_GL_SwapBuffers();
return true;
}
namespace
{
class GammaRampConversionTable
{
public:
CGGammaValue red[65535];
CGGammaValue green[65535];
CGGammaValue blue[65535];
GammaRampConversionTable()
{
for (int i = 0; i < 65535; i++)
{
red[i] = static_cast<float>(i)/65535;
green[i] = static_cast<float>(i)/65535;
blue[i] = static_cast<float>(i)/65535;
}
}
static GammaRampConversionTable singleton;
};
GammaRampConversionTable GammaRampConversionTable::singleton;
}
bool CStdGL::ApplyGammaRamp(_D3DGAMMARAMP& ramp, bool fForce)
{
CGGammaValue r[256];
CGGammaValue g[256];
CGGammaValue b[256];
for (int i = 0; i < 256; i++)
{
r[i] = GammaRampConversionTable::singleton.red[ramp.red[i]];
g[i] = GammaRampConversionTable::singleton.green[ramp.green[i]];
b[i] = GammaRampConversionTable::singleton.blue[ramp.blue[i]];
}
CGSetDisplayTransferByTable((CGDirectDisplayID)[[[[[NSApp keyWindow] screen] deviceDescription] valueForKey:@"NSScreenNumber"] intValue], 256, r, g, b);
return true;
}
bool CStdGL::SaveDefaultGammaRamp(CStdWindow * pWindow)
{
return false;//return SDL_GetGammaRamp(DefRamp.ramp.red, DefRamp.ramp.green, DefRamp.ramp.blue) != -1;
}
#endif

View File

@ -0,0 +1,42 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#import <Cocoa/Cocoa.h>
class CStdWindow;
class C4ViewportWindow;
class C4Viewport;
@class ClonkOpenGLView;
@class NSTextView;
@class ConsoleWindowController;
@interface ClonkWindowController : NSWindowController<NSWindowDelegate> {
IBOutlet ClonkOpenGLView* openGLView;
IBOutlet NSScrollView* scrollView;
CStdWindow* stdWindow;
NSWindow* fullscreenWindow;
}
- (C4Viewport*) viewport;
- (void) setFullscreen:(BOOL)fullscreen;
- (BOOL) isFullscreen;
- (IBAction) scroll:(id)sender;
@property (readwrite) CStdWindow* stdWindow;
@property (readonly) ClonkOpenGLView* openGLView;
@property (readonly) NSScrollView* scrollView;
@property (readonly) BOOL isLiveResizing;
@end

View File

@ -0,0 +1,225 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4Fullscreen.h>
#include <C4GraphicsSystem.h>
#include <C4Viewport.h>
#include <C4ViewportWindow.h>
#include <C4Console.h>
#include <C4Game.h>
#include <C4Landscape.h>
#import <StdGL.h>
#import "ClonkWindowController.h"
#import "ClonkOpenGLView.h"
#import "ConsoleWindowController.h"
#import "ClonkAppDelegate.h"
#import "AppKit/NSOpenGL.h"
#ifdef USE_COCOA
// Turns out, it is necessary to derive a NSWindow class after all - or else the screen-filling window won't be able to become the key window
@interface ClonkScreenfillingWindow: NSWindow
{}
- (BOOL) canBecomeKeyWindow;
@end
@implementation ClonkScreenfillingWindow
- (BOOL) canBecomeKeyWindow;
{
return YES; // a resounding one
}
@end
@implementation ClonkWindowController
@synthesize stdWindow, openGLView, scrollView;
- (void) fadeOut:(CGDisplayFadeReservationToken*)token
{
if (CGAcquireDisplayFadeReservation(15, token) == 0)
CGDisplayFade(*token, 0.2, 0.0, 1.0, 0, 0, 0, YES);
}
- (void) fadeIn:(CGDisplayFadeReservationToken)token
{
CGDisplayFade(token, 0.2, 1.0, 0.0, 0, 0, 0, YES);
CGReleaseDisplayFadeReservation(token);
}
- (BOOL) isFullscreen
{
return fullscreenWindow != nil;
}
- (void) setFullscreen:(BOOL)fullscreen
{
if (fullscreen != [self isFullscreen])
{
// fade out
CGDisplayFadeReservationToken token;
[self fadeOut:&token];
if (![self isFullscreen])
{
NSRect fullscreenRect = NSScreen.mainScreen.frame;
fullscreenWindow = [[ClonkScreenfillingWindow alloc] initWithContentRect:fullscreenRect styleMask:NSBorderlessWindowMask backing:NSBackingStoreBuffered defer:YES];
[fullscreenWindow setLevel:NSMainMenuWindowLevel+1];
[fullscreenWindow setOpaque:YES];
[fullscreenWindow setHidesOnDeactivate:YES];
[fullscreenWindow setContentView:openGLView];
[fullscreenWindow setReleasedWhenClosed:YES];
//[openGLView setFrame:fullscreenRect];
[fullscreenWindow setDelegate:self];
[self.window orderOut:self];
[fullscreenWindow setInitialFirstResponder:openGLView];
[fullscreenWindow makeKeyAndOrderFront:self];
[openGLView enableEvents];
// hide cursor completely
[NSCursor hide];
}
else
{
// unhide and rely on cursor rects again
[NSCursor unhide];
[openGLView retain];
[fullscreenWindow close];
fullscreenWindow = nil;
[self.window.contentView addSubview:openGLView];
[self.window orderFront:self];
[openGLView setFrame:[self.window.contentView frame]];
[openGLView enableEvents];
[openGLView display];
}
// fade in again
[self fadeIn:token];
}
}
- (void) setStdWindow:(CStdWindow*)window
{
stdWindow = window;
}
- (BOOL) windowShouldClose:(id)sender
{
if (sender == self.window && self.stdWindow)
{
[self.openGLView showCursor];
self.stdWindow->Close();
}
return YES;
}
- (C4Viewport*) viewport
{
for (C4Viewport* v = ::Viewports.GetFirstViewport(); v; v = v->GetNext())
if (v->GetWindow() == stdWindow || v->GetWindow() == NULL && stdWindow == &FullScreen)
return v;
return NULL;
}
- (IBAction) scroll:(id)sender
{
C4Viewport* viewport = self.viewport;
if (viewport)
{
viewport->ViewPositionByScrollBars();
viewport->Execute();
}
}
- (void) windowDidResize:(NSNotification *)notification
{
C4Viewport* viewport = self.viewport;
if (viewport && Application.isEditor)
{
viewport->ScrollBarsByViewPosition();
}
}
- (BOOL) isLiveResizing
{
return self.window.inLiveResize;
}
@end
// C4Fullscreen
void C4FullScreen::HandleMessage (void* event)
{
[NSApp sendEvent:(NSEvent*)event];
}
// C4ViewportWindow
CStdWindow * C4ViewportWindow::Init(CStdWindow::WindowKind windowKind, CStdApp * pApp, const char * Title, CStdWindow * pParent, bool b)
{
CStdWindow* result = CStdWindow::Init(windowKind, pApp, Title, pParent, b);
return result;
}
bool C4Viewport::ScrollBarsByViewPosition()
{
if (PlayerLock) return false;
NSScrollView* scrollView = ((ConsoleWindowController*)pWindow->GetController()).scrollView;
[scrollView.horizontalScroller setFloatValue:ViewX/(GBackWdt-ViewWdt)*GetZoom()];
[scrollView.verticalScroller setFloatValue:ViewY/(GBackHgt-ViewHgt)*GetZoom()];
[scrollView.horizontalScroller setKnobProportion:(float)ViewWdt/(float)GBackWdt/GetZoom()];
[scrollView.verticalScroller setKnobProportion:(float)ViewHgt/(float)GBackHgt/GetZoom()];
return true;
}
bool C4Viewport::ViewPositionByScrollBars()
{
NSScrollView* scrollView = ((ConsoleWindowController*)pWindow->GetController()).scrollView;
ViewX = [scrollView.horizontalScroller floatValue] * (GBackWdt-ViewWdt) / GetZoom();
ViewY = [scrollView.verticalScroller floatValue] * (GBackHgt-ViewHgt) / GetZoom();
return true;
}
bool C4Viewport::TogglePlayerLock()
{
NSScrollView* scrollView = ((ConsoleWindowController*)pWindow->GetController()).scrollView;
if (PlayerLock)
{
PlayerLock = false;
if (scrollView)
{
[scrollView.verticalScroller setEnabled:YES];
[scrollView.horizontalScroller setEnabled:YES];
[scrollView setAutohidesScrollers:NO];
}
ScrollBarsByViewPosition();
}
else
{
PlayerLock = true;
if (scrollView)
{
[scrollView.verticalScroller setEnabled:NO];
[scrollView.horizontalScroller setEnabled:NO];
[scrollView setAutohidesScrollers:YES];
}
}
return true;
}
#endif

View File

@ -0,0 +1,217 @@
#define K(k,s,a) {k+CocoaKeycodeOffset,s,a}
const C4KeyCodeMapEntry KeyCodeMap [] =
{
{ K_BACK , "Backspace" , NULL },
{ K_TAB , "Tab" , NULL },
//{ VK_CLEAR , "Clear" , NULL },
{ K_RETURN , "Return" , NULL },
/*K( VK_SHIFT , "KeyShift" , "Shift" ),
K( VK_CONTROL , "KeyControl" , "Control" ),
K( VK_MENU , "Menu" , NULL ),
K( VK_PAUSE , "Pause" , NULL ),*/
/* K( VK_CAPITAL , "Capital" , NULL ),
K( VK_KANA , "Kana" , NULL ),
K( VK_HANGEUL , "Hangeul" , NULL ),
K( VK_HANGUL , "Hangul" , NULL ),
K( VK_JUNJA , "Junja" , NULL ),
K( VK_FINAL , "Final" , NULL ),
K( VK_HANJA , "Hanja" , NULL ),
K( VK_KANJI , "Kanji" , NULL ),
K( VK_ESCAPE , "Escape" , "Esc" ),
K( VK_ESCAPE , "Esc" ,NULL ),
K( VK_CONVERT , "Convert" , NULL ),
K( VK_NONCONVERT , "Noconvert" , NULL ),
K( VK_ACCEPT , "Accept" , NULL ),
K( VK_MODECHANGE , "Modechange" , NULL ),*/
{ K_SPACE , "Space" , "Sp" },
{ K_END , "End" , NULL },
{ K_HOME , "Home" , NULL },
{ K_LEFT , "Left" , NULL },
{ K_UP , "Up" , NULL },
{ K_RIGHT , "Right" , NULL },
{ K_DOWN , "Down" , NULL },
/*{ VK_SELECT , "Select" , NULL },
{ VK_PRINT , "Print" , NULL },
{ VK_EXECUTE , "Execute" , NULL },
{ VK_SNAPSHOT , "Snapshot" , NULL },
{ VK_INSERT , "Insert" , "Ins" },*/
{ K_DELETE , "Delete" , "Del" },
// { VK_HELP , "Help" , NULL },
K( 29 , "0" , NULL ),
K( 18 , "1" , NULL ),
K( 19 , "2" , NULL ),
K( 20 , "3" , NULL ),
K( 21 , "4" , NULL ),
K( 23 , "5" , NULL ),
K( 22 , "6" , NULL ),
K( 26 , "7" , NULL ),
K( 28 , "8" , NULL ),
K( 25 , "9" , NULL ),
K( 0 , "A" , NULL ),
K( 11 , "B" , NULL ),
K( 8 , "C" , NULL ),
K( 2 , "D" , NULL ),
K( 14 , "E" , NULL ),
K( 3 , "F" , NULL ),
K( 5 , "G" , NULL ),
K( 4 , "H" , NULL ),
K( 34 , "I" , NULL ),
K( 38 , "J" , NULL ),
K( 40 , "K" , NULL ),
K( 37 , "L" , NULL ),
K( 46 , "M" , NULL ),
K( 45 , "N" , NULL ),
K( 31 , "O" , NULL ),
K( 35 , "P" , NULL ),
K( 12 , "Q" , NULL ),
K( 15 , "R" , NULL ),
K( 1 , "S" , NULL ),
K( 17 , "T" , NULL ),
K( 32 , "U" , NULL ),
K( 9 , "V" , NULL ),
K( 13 , "W" , NULL ),
K( 7 , "X" , NULL ),
K( 6 , "Y" , NULL ),
K( 16 , "Z" , NULL ),
K( 43 , "Comma" , NULL ),
K( 47 , "Period" , NULL ),
K( 43 , "Apostrophe", NULL ),
/*K( VK_LWIN , "WinLeft" , NULL ),
K( VK_RWIN , "WinRight" , NULL ),*/
//K( VK_APPS , "Apps" , NULL ),
K( 82 , "Num0" , "N0" ),
K( 83 , "Num1" , "N1" ),
K( 84 , "Num2" , "N2" ),
K( 85 , "Num3" , "N3" ),
K( 86 , "Num4" , "N4" ),
K( 87 , "Num5" , "N5" ),
K( 88 , "Num6" , "N6" ),
K( 89 , "Num7" , "N7" ),
K( 91 , "Num8" , "N8" ),
K( 92 , "Num9" , "N9" ),
K( 67 , "Multiply" , "N*" ),
K( 69 , "Add" , "N+" ),
//K( 65 , "Separator" , "NSep" ),
K( 78 , "Subtract" , "N-" ),
K( 65 , "Decimal" , "N," ),
K( 75 , "Divide" , "N/" ),
{ K_F1 , "F1" , NULL },
{ K_F2 , "F2" , NULL },
{ K_F3 , "F3" , NULL },
{ K_F4 , "F4" , NULL },
{ K_F5 , "F5" , NULL },
{ K_F6 , "F6" , NULL },
{ K_F7 , "F7" , NULL },
{ K_F8 , "F8" , NULL },
{ K_F9 , "F9" , NULL },
{ K_F10 , "F10" , NULL },
{ K_F11 , "F11" , NULL },
{ K_F12 , "F12" , NULL },
/*
{ K_F13 , "F13" , NULL },
{ K_F14 , "F14" , NULL },
{ K_F15 , "F15" , NULL },
{ K_F16 , "F16" , NULL },
{ K_F17 , "F17" , NULL },
{ K_F18 , "F18" , NULL },
{ K_F19 , "F19" , NULL },
{ K_F20 , "F20" , NULL },
{ K_F21 , "F21" , NULL },
{ K_F22 , "F22" , NULL },
{ K_F23 , "F23" , NULL },
{ K_F24 , "F24" , NULL },*/
K( 71 , "NumLock" , "NLock" ),
//K( K_SCROLL , "Scroll" , NULL ),
//K( VK_PROCESSKEY , "PROCESSKEY" , NULL ),
/*#if defined VK_SLEEP && defined VK_OEM_NEC_EQUAL
K( VK_SLEEP , "Sleep" , NULL ),
K( VK_OEM_NEC_EQUAL , "OEM_NEC_EQUAL" , NULL ),
K( VK_OEM_FJ_JISHO , "OEM_FJ_JISHO" , NULL ),
K( VK_OEM_FJ_MASSHOU , "OEM_FJ_MASSHOU" , NULL ),
K( VK_OEM_FJ_TOUROKU , "OEM_FJ_TOUROKU" , NULL ),
K( VK_OEM_FJ_LOYA , "OEM_FJ_LOYA" , NULL ),
K( VK_OEM_FJ_ROYA , "OEM_FJ_ROYA" , NULL ),
K( VK_BROWSER_BACK , "BROWSER_BACK" , NULL ),
K( VK_BROWSER_FORWARD , "BROWSER_FORWARD" , NULL ),
K( VK_BROWSER_REFRESH , "BROWSER_REFRESH" , NULL ),
K( VK_BROWSER_STOP , "BROWSER_STOP" , NULL ),
K( VK_BROWSER_SEARCH , "BROWSER_SEARCH" , NULL ),
K( VK_BROWSER_FAVORITES , "BROWSER_FAVORITES" , NULL ),
K( VK_BROWSER_HOME , "BROWSER_HOME" , NULL ),
K( VK_VOLUME_MUTE , "VOLUME_MUTE" , NULL ),
K( VK_VOLUME_DOWN , "VOLUME_DOWN" , NULL ),
K( VK_VOLUME_UP , "VOLUME_UP" , NULL ),
K( VK_MEDIA_NEXT_TRACK , "MEDIA_NEXT_TRACK" , NULL ),
K( VK_MEDIA_PREV_TRACK , "MEDIA_PREV_TRACK" , NULL ),
K( VK_MEDIA_STOP , "MEDIA_STOP" , NULL ),
K( VK_MEDIA_PLAY_PAUSE , "MEDIA_PLAY_PAUSE" , NULL ),
K( VK_LAUNCH_MAIL , "LAUNCH_MAIL" , NULL ),
K( VK_LAUNCH_MEDIA_SELECT , "LAUNCH_MEDIA_SELECT" , NULL ),
K( VK_LAUNCH_APP1 , "LAUNCH_APP1" , NULL ),
K( VK_LAUNCH_APP2 , "LAUNCH_APP2" , NULL ),
K( VK_OEM_1 , "OEM Ü" , "Ü" ), // German hax
K( VK_OEM_PLUS , "OEM +" , "+" ),
K( VK_OEM_COMMA , "OEM ," , "," ),
K( VK_OEM_MINUS , "OEM -" , "-" ),
K( VK_OEM_PERIOD , "OEM ." , "." ),
K( VK_OEM_2 , "OEM 2" , "2" ),
K( VK_OEM_3 , "OEM Ö" , "Ö" ), // German hax
K( VK_OEM_4 , "OEM 4" , "4" ),
K( VK_OEM_5 , "OEM 5" , "5" ),
K( VK_OEM_6 , "OEM 6" , "6" ),
K( VK_OEM_7 , "OEM Ä" , "Ä" ), // German hax
K( VK_OEM_8 , "OEM 8" , "8" ),
K( VK_OEM_AX , "AX" , "AX" ),
K( VK_OEM_102 , "< > |" , "<" ), // German hax
K( VK_ICO_HELP , "Help" , "Help" ),
K( VK_ICO_00 , "ICO_00" , "00" ),
K( VK_ICO_CLEAR , "ICO_CLEAR" , NULL ),
K( VK_PACKET , "PACKET" , NULL ),
K( VK_OEM_RESET , "OEM_RESET" , NULL ),
K( VK_OEM_JUMP , "OEM_JUMP" , NULL ),
K( VK_OEM_PA1 , "OEM_PA1" , NULL ),
K( VK_OEM_PA2 , "OEM_PA2" , NULL ),
K( VK_OEM_PA3 , "OEM_PA3" , NULL ),
K( VK_OEM_WSCTRL , "OEM_WSCTRL" , NULL ),
K( VK_OEM_CUSEL , "OEM_CUSEL" , NULL ),
K( VK_OEM_ATTN , "OEM_ATTN" , NULL ),
K( VK_OEM_FINISH , "OEM_FINISH" , NULL ),
K( VK_OEM_COPY , "OEM_COPY" , NULL ),
K( VK_OEM_AUTO , "OEM_AUTO" , NULL ),
K( VK_OEM_ENLW , "OEM_ENLW" , NULL ),
K( VK_OEM_BACKTAB , "OEM_BACKTAB" , NULL ),
#endif
K( VK_ATTN , "ATTN" , NULL ),
K( VK_CRSEL , "CRSEL" , NULL ),
K( VK_EXSEL , "EXSEL" , NULL ),
K( VK_EREOF , "EREOF" , NULL ),
K( VK_PLAY , "PLAY" , NULL ),
K( VK_ZOOM , "ZOOM" , NULL ),
K( VK_NONAME , "NONAME" , NULL ),
K( VK_PA1 , "PA1" , NULL ),
K( VK_OEM_CLEAR , "OEM_CLEAR" , NULL ),*/
{ KEY_Any, "Any" , NULL},
{ KEY_Default, "None", NULL},
{ KEY_Undefined, NULL, NULL}
};
#undef K

View File

@ -0,0 +1,74 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#import <AppKit/AppKit.h>
#import <Quartz/Quartz.h>
#import <ClonkWindowController.h>
#ifdef USE_COCOA
@class ClonkOpenGLView;
@class ClonkAppDelegate;
@interface ConsoleWindowController : ClonkWindowController<NSUserInterfaceValidations> {
IBOutlet NSTextView* outputTextView;
IBOutlet NSComboBox* consoleCombo;
IBOutlet NSComboBox* objectCombo;
IBOutlet NSPopUpButton* materialsPopup;
IBOutlet NSPopUpButton* texturesPopup;
IBOutlet NSTextField* frameLabel;
IBOutlet NSTextField* scriptLabel;
IBOutlet NSTextField* timeLabel;
IBOutlet NSTextView* objectPropertiesText;
IBOutlet NSScrollView* outputScrollView;
IBOutlet IKImageView* previewView;
IBOutlet NSPanel* toolsPanel;
IBOutlet NSPanel* objectsPanel;
IBOutlet NSSegmentedControl* toolSelector;
IBOutlet NSSegmentedControl* modeSelector;
}
@property(readonly) NSTextField* frameLabel;
@property(readonly) NSTextField* scriptLabel;
@property(readonly) NSTextField* timeLabel;
@property(readonly) NSTextView* outputTextView;
@property(readonly) NSTextView* objectPropertiesText;
@property(readonly) NSPopUpButton* materialsPopup;
@property(readonly) NSPopUpButton* texturesPopup;
@property(readonly) NSScrollView* outputScrollView;
@property(readonly) IKImageView* previewView;
@property(readonly) NSWindow* toolsPanel;
@property(readonly) NSWindow* objectsPanel;
@property(readonly) NSSegmentedControl* toolSelector;
@property(readonly) NSSegmentedControl* modeSelector;
@property(readonly) NSComboBox* objectCombo;
@property(readonly) NSComboBox* consoleCombo;
- (IBAction) consoleIn:(id)sender;
- (IBAction) objectIn:(id)sender;
- (IBAction) selectMode:(id)sender;
- (IBAction) play:(id)sender;
- (IBAction) halt:(id)sender;
- (IBAction) selectMaterial:(id)sender;
- (IBAction) selectTexture:(id)sender;
- (IBAction) selectTool:(id)sender;
- (IBAction) selectIFT:(id)sender;
- (IBAction) selectMode:(id)sender;
- (IBAction) selectLandscapeMode:(id)sender;
- (IBAction) setGrade:(id)sender;
- (IBAction) kickPlayer:(id)sender;
@end
#endif

View File

@ -0,0 +1,168 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <C4Console.h>
#include <C4Player.h>
#include <C4PlayerList.h>
#include <C4Game.h>
#import <Cocoa/Cocoa.h>
#import <ConsoleWindowController.h>
#import <ClonkOpenGLView.h>
#import <ClonkAppDelegate.h>
#ifdef USE_COCOA
@implementation ConsoleWindowController
@synthesize
frameLabel, scriptLabel, timeLabel, outputTextView, objectPropertiesText,
materialsPopup, texturesPopup, outputScrollView, previewView,
objectsPanel, toolsPanel, toolSelector, modeSelector, objectCombo, consoleCombo;
- (void) awakeFromNib
{
[super awakeFromNib];
ClonkAppDelegate.instance.consoleController = self;
NSWindow* window = self.window;
[window makeKeyAndOrderFront:self];
[window makeMainWindow];
[toolsPanel setBecomesKeyOnlyIfNeeded:YES];
[objectsPanel setBecomesKeyOnlyIfNeeded:YES];
}
- (void) windowWillClose:(NSNotification*)notification
{
if (notification.object == objectsPanel)
{
Console.PropertyDlg.Clear();
}
else if (notification.object == toolsPanel)
{
Console.ToolsDlg.Clear();
}
}
int indexFromSender(id sender)
{
if ([sender respondsToSelector:@selector(selectedSegment)])
return [sender selectedSegment];
else if ([sender respondsToSelector:@selector(tag)])
return [sender tag];
else
return -1;
}
- (IBAction) selectMode:(id)sender
{
Console.EditCursor.SetMode(indexFromSender(sender));
for (NSWindow* w in [[NSApplication sharedApplication] windows])
{
if ([[w windowController] isKindOfClass:[ClonkWindowController class]])
{
[w invalidateCursorRectsForView:[[w windowController] openGLView]];
}
}
}
- (IBAction) play:(id)sender
{
Console.DoPlay();
}
- (IBAction) halt:(id)sender
{
Console.DoHalt();
}
- (IBAction) selectMaterial:(id)sender
{
Console.ToolsDlg.SetMaterial([[(NSPopUpButton*)sender titleOfSelectedItem] cStringUsingEncoding:NSUTF8StringEncoding]);
}
- (IBAction) selectTexture:(id)sender
{
Console.ToolsDlg.SetTexture([[(NSPopUpButton*)sender titleOfSelectedItem] cStringUsingEncoding:NSUTF8StringEncoding]);
}
- (IBAction) selectTool:(id)sender
{
Console.ToolsDlg.SetTool(indexFromSender(sender), NO);
}
- (IBAction) selectIFT:(id)sender
{
Console.ToolsDlg.SetIFT([sender selectedSegment] == 1);
}
- (IBAction) selectLandscapeMode:(id)sender
{
// add one since 0 is "undefined"
Console.ToolsDlg.SetLandscapeMode([sender selectedSegment]+1, NO);
}
- (IBAction) setGrade:(id)sender
{
Console.ToolsDlg.SetGrade([sender intValue]);
}
// manually catch case of game not running since button validation would require key value binding -.-
- (IBAction) consoleIn:(id)sender
{
if (![ClonkAppDelegate isConsoleAndGameRunning])
return;
Console.In([[consoleCombo stringValue] cStringUsingEncoding:NSUTF8StringEncoding]);
}
- (IBAction) objectIn:(id)sender
{
if (![ClonkAppDelegate isConsoleAndGameRunning])
return;
Console.EditCursor.In([[objectCombo stringValue] cStringUsingEncoding:NSUTF8StringEncoding]);
}
- (IBAction) kickPlayer:(id)sender
{
if (!::Control.isCtrlHost())
return;
::Game.Clients.CtrlRemove(::Game.Clients.getClientByID([sender tag]), LoadResStr("IDS_MSG_KICKBYMENU"));
}
- (BOOL)validateUserInterfaceItem:(id<NSValidatedUserInterfaceItem>)item
{
// enabled when game running and in console mode
SEL gameRunningInConsoleModeSelectors[] =
{
@selector(play:),
@selector(halt:),
nil
};
int i = 0;
SEL s;
while (s = gameRunningInConsoleModeSelectors[i++])
{
if (s == [item action])
return [ClonkAppDelegate isConsoleAndGameRunning];
}
// always enabled
return YES;
}
@end
#endif

View File

@ -1,72 +0,0 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Copyright (c) 1998-2000 Matthes Bender
* Copyright (c) 2004, 2007 Günther Brammer
* Copyright (c) 2008 Peter Wortmann
* Copyright (c) 2001-2009, RedWolf Design GmbH, http://www.clonk.de
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#import <AppKit/AppKit.h>
namespace MacUtility {
bool sendFileToTrash(const char* szFilename)
{
NSString* filename = [NSString stringWithUTF8String: szFilename];
return [[NSWorkspace sharedWorkspace]
performFileOperation: NSWorkspaceRecycleOperation
source: [filename stringByDeletingLastPathComponent]
destination: @""
files: [NSArray arrayWithObject: [filename lastPathComponent]]
tag: 0];
}
bool isGerman()
{
id languages = [[NSUserDefaults standardUserDefaults] valueForKey:@"AppleLanguages"];
return languages && [[languages objectAtIndex:0] isEqualToString:@"de"];
}
void restart(char*[])
{
NSString* filename = [[NSBundle mainBundle] bundlePath];
NSString* cmd = [@"open " stringByAppendingString: filename];
system([cmd UTF8String]);
}
namespace {
int repeatDelayCfgValue(NSString* key, int defaultValue) {
id value = [[NSUserDefaults standardUserDefaults] valueForKey:key];
int result = value != nil ? [value intValue] * 15 : defaultValue;
return result;
}
}
int keyRepeatDelay(int defaultValue) {
return repeatDelayCfgValue(@"InitialKeyRepeat", defaultValue);
}
int keyRepeatInterval(int defaultValue) {
return repeatDelayCfgValue(@"KeyRepeat", defaultValue);
}
void ensureWindowInFront() {
if ([NSApp isActive]) {
NSWindow* w = [NSApp mainWindow];
[w makeKeyAndOrderFront:NSApp];
}
}
}

View File

@ -33,7 +33,7 @@ bool CStdApp::ScheduleProcs(int iTimeout)
// Always fail after quit message
if(fQuitMsgReceived)
return false;
#if defined(USE_SDL_MAINLOOP)
#if defined(USE_SDL_MAINLOOP) || defined(USE_COCOA)
// Unfortunately, the SDL event loop needs to be polled
FlushMessages();
#endif

View File

@ -46,6 +46,9 @@ public:
#else
bool Init(CStdWindow * pWindow, CStdApp *pApp);
#endif
#ifdef USE_COCOA
/*NSOpenGLContext*/void* GetNativeCtx();
#endif
bool Select(bool verbose = false); // select this context
void Deselect(); // select this context
@ -62,6 +65,8 @@ protected:
HDC hDC; // device context handle
#elif defined(USE_X11)
/*GLXContext*/void * ctx;
#elif defined(USE_COCOA)
/*NSOpenGLContext*/void* ctx;
#endif
unsigned int cx,cy; // context window size

View File

@ -19,25 +19,31 @@
// based on SDL implementation
#import <AppKit/AppKit.h>
#include <GL/glew.h>
#import <Cocoa/Cocoa.h>
#import "ClonkWindowController.h"
#include <C4Include.h>
#include <StdWindow.h>
#include <string>
bool CStdApp::Copy(const StdStrBuf & text, bool fClipboard) {
bool CStdApp::Copy(const StdStrBuf & text, bool fClipboard)
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
[pasteboard declareTypes:[NSArray arrayWithObject:NSStringPboardType] owner:nil];
NSString* string = [NSString stringWithCString:text.getData() encoding:NSUTF8StringEncoding];
if (![pasteboard setString:string forType:NSStringPboardType]) {
if (![pasteboard setString:string forType:NSStringPboardType])
{
NSLog(@"Writing to Cocoa pasteboard failed");
return false;
}
return true;
}
StdStrBuf CStdApp::Paste(bool fClipboard) {
if (fClipboard) {
StdStrBuf CStdApp::Paste(bool fClipboard)
{
if (fClipboard)
{
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
const char* chars = [[pasteboard stringForType:NSStringPboardType] cStringUsingEncoding:NSUTF8StringEncoding];
return StdStrBuf(chars);
@ -45,11 +51,13 @@ StdStrBuf CStdApp::Paste(bool fClipboard) {
return StdStrBuf(0);
}
bool CStdApp::IsClipboardFull(bool fClipboard) {
bool CStdApp::IsClipboardFull(bool fClipboard)
{
return [[NSPasteboard generalPasteboard] availableTypeFromArray:[NSArray arrayWithObject:NSStringPboardType]];
}
void CStdApp::ClearClipboard(bool fClipboard) {
void CStdApp::ClearClipboard(bool fClipboard)
{
[[NSPasteboard generalPasteboard] declareTypes:[NSArray array] owner:nil];
}
@ -59,10 +67,115 @@ void CStdApp::MessageDialog(const char * message)
[alert runModal];
}
void CStdWindow::FlashWindow() {
void CStdWindow::FlashWindow()
{
[NSApp requestUserAttention:NSCriticalRequest];
}
#ifdef USE_COCOA
CStdApp::CStdApp(): Active(false), fQuitMsgReceived(false), Location(""), DoNotDelay(false), MainThread(pthread_self()), fDspModeSet(false)
{
}
CStdApp::~CStdApp() {}
bool CStdApp::Init(int argc, char * argv[])
{
// Set locale
setlocale(LC_ALL,"");
// Custom initialization
return DoInit (argc, argv);
}
void CStdApp::Clear() {}
void CStdApp::Quit()
{
fQuitMsgReceived = true;
}
bool CStdApp::FlushMessages()
{
// Always fail after quit message
if(fQuitMsgReceived)
return false;
while (CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0, TRUE) == kCFRunLoopRunHandledSource);
NSEvent* event;
while (event = [NSApp nextEventMatchingMask:NSAnyEventMask untilDate:[NSDate distantPast] inMode:NSEventTrackingRunLoopMode dequeue:YES])
{
HandleNSEvent(event);
}
return true;
}
void CStdApp::HandleNSEvent(void* event)
{
NSEvent* the_event = (NSEvent*)event;
KeyMask = [the_event modifierFlags] & (MK_SHIFT|MK_CONTROL); // MK_* and NS*KeyMask values correspond
[NSApp sendEvent:the_event];
[NSApp updateWindows];
/*
// Everything else goes to the window.
if (pWindow)
pWindow->HandleMessage(event);*/
}
static int32_t bitDepthFromPixelEncoding(CFStringRef encoding)
{
// copy-pasta: http://gitorious.org/ogre3d/mainlinemirror/commit/722dbd024aa91a6401850788db76af89c364d6e7
if (CFStringCompare(encoding, CFSTR(IO32BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
return 32;
else if(CFStringCompare(encoding, CFSTR(IO16BitDirectPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
return 16;
else if(CFStringCompare(encoding, CFSTR(IO8BitIndexedPixels), kCFCompareCaseInsensitive) == kCFCompareEqualTo)
return 8;
else
return -1; // fail
}
bool CStdApp::GetIndexedDisplayMode(int32_t iIndex, int32_t *piXRes, int32_t *piYRes, int32_t *piBitDepth, uint32_t iMonitor)
{
// No support for multiple monitors.
CFArrayRef array = CGDisplayCopyAllDisplayModes(iMonitor, NULL);
bool good_index = iIndex >= 0 && iIndex < (int32_t)CFArrayGetCount(array);
if (good_index)
{
CGDisplayModeRef displayMode = (CGDisplayModeRef)CFArrayGetValueAtIndex(array, iIndex);
*piXRes = CGDisplayModeGetWidth(displayMode);
*piYRes = CGDisplayModeGetHeight(displayMode);
CFStringRef pixelEncoding = CGDisplayModeCopyPixelEncoding(displayMode);
*piBitDepth = bitDepthFromPixelEncoding(pixelEncoding);
CFRelease(pixelEncoding);
}
CFRelease(array);
return good_index;
}
bool CStdApp::SetVideoMode(unsigned int iXRes, unsigned int iYRes, unsigned int iColorDepth, unsigned int iMonitor, bool fFullScreen)
{
pWindow->SetSize(iXRes, iYRes);
ClonkWindowController* controller = (ClonkWindowController*)pWindow->GetController();
[controller setFullscreen:fFullScreen];
NSWindow* window = controller.window;
[window center];
[window setContentMinSize:NSMakeSize(iXRes, iYRes)];
[window setContentMaxSize:NSMakeSize(iXRes, iYRes)];
if (!fFullScreen)
[window makeKeyAndOrderFront:nil];
OnResolutionChanged(iXRes, iYRes);
return true;
}
void CStdApp::RestoreVideoMode()
{
}
#endif
// Event-pipe-whatever stuff I do not understand.
bool CStdApp::ReadStdInCommand()

View File

@ -0,0 +1,185 @@
/*
* OpenClonk, http://www.openclonk.org
*
* Portions might be copyrighted by other authors who have contributed
* to OpenClonk.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
* See isc_license.txt for full license and disclaimer.
*
* "Clonk" is a registered trademark of Matthes Bender.
* See clonk_trademark_license.txt for full license.
*/
#include <C4Include.h>
#include <Standard.h>
#include <StdRegistry.h>
#include <StdGL.h>
#include <StdWindow.h>
#include <C4Version.h>
#include <C4Application.h>
#import <Appkit/AppKit.h>
#import <ClonkWindowController.h>
#ifdef USE_COCOA
#define ctrler ((ClonkWindowController*)this->controller)
CStdWindow::CStdWindow ():
Active(false),
pSurface(0),
controller(nil)
{}
CStdWindow::~CStdWindow () {}
CStdWindow * CStdWindow::Init(CStdApp * pApp)
{
return Init(CStdWindow::W_Fullscreen, pApp, C4ENGINENAME);
}
static NSString* windowNibNameForWindowKind(CStdWindow::WindowKind kind)
{
switch (kind)
{
case CStdWindow::W_GuiWindow:
return @"ConsoleGUIWindow";
case CStdWindow::W_Fullscreen:
return @"FullscreenWindow";
case CStdWindow::W_Viewport:
return @"ClonkWindow";
default:
return nil;
}
}
CStdWindow * CStdWindow::Init(CStdWindow::WindowKind windowKind, CStdApp * pApp, const char * Title, CStdWindow * pParent, bool HideCursor)
{
Active = true;
// Create window
ClonkWindowController* controller = [ClonkWindowController new];
this->controller = controller;
[NSBundle loadNibNamed:windowNibNameForWindowKind(windowKind) owner:controller];
[controller setStdWindow:this];
SetTitle(Title);
return this;
}
void CStdWindow::Clear()
{
// Destroy window
ClonkWindowController* controller;
if (controller = ctrler)
{
[controller.openGLView setNeedsDisplay:NO];
[controller.openGLView removeFromSuperview];
[controller setStdWindow:NULL];
[controller close];
[controller release];
this->controller = nil;
}
}
bool CStdWindow::StorePosition(const char *szWindowName, const char *szSubKey, bool fStoreSize)
{
[ctrler setWindowFrameAutosaveName:[NSString stringWithFormat:@"%s_%s", szWindowName, szSubKey]];
return true;
}
bool CStdWindow::RestorePosition(const char *szWindowName, const char *szSubKey, bool fHidden)
{
StorePosition(szWindowName, szSubKey, true);
if (fHidden)
[ctrler.window orderOut:ctrler];
else
[ctrler.window orderFront:ctrler];
return true;
}
void CStdWindow::SetTitle(const char *szToTitle)
{
ClonkWindowController* controller;
if ((controller = ctrler) && controller.window)
[controller.window setTitle:[NSString stringWithUTF8String:szToTitle ? szToTitle : ""]];
}
bool CStdWindow::GetSize(RECT * pRect)
{
ClonkWindowController* controller = ctrler;
NSView* view = controller.openGLView ? controller.openGLView : controller.window.contentView;
NSRect r = [view frame];
pRect->top = 0;
pRect->left = 0;
pRect->right = r.size.width;
pRect->bottom = r.size.height;
return true;
}
void CStdWindow::SetSize(unsigned int cx, unsigned int cy)
{
ClonkWindowController* controller = ctrler;
if (controller.window)
{
[controller.window setContentSize:NSMakeSize(cx, cy)];
//[controller.window center];
}
}
void CStdWindow::HandleMessage(void*)
{
}
void CStdWindow::RequestUpdate()
{
[ctrler.openGLView display];
}
int K_F1 = 122 + CocoaKeycodeOffset;
int K_F2 = 120 + CocoaKeycodeOffset;
int K_F3 = 99 + CocoaKeycodeOffset;
int K_F4 = 118 + CocoaKeycodeOffset;
int K_F5 = 96 + CocoaKeycodeOffset;
int K_F6 = 97 + CocoaKeycodeOffset;
int K_F7 = 98 + CocoaKeycodeOffset;
int K_F8 = 100 + CocoaKeycodeOffset;
int K_F9 = 101 + CocoaKeycodeOffset;
int K_F10 = 109 + CocoaKeycodeOffset;
int K_F11 = 103 + CocoaKeycodeOffset;
int K_F12 = 111 + CocoaKeycodeOffset;
int K_ADD = 69 + CocoaKeycodeOffset;
int K_SUBTRACT = 78 + CocoaKeycodeOffset;
int K_MULTIPLY = 67 + CocoaKeycodeOffset;
int K_ESCAPE = 53 + CocoaKeycodeOffset;
int K_PAUSE = NSPauseFunctionKey + CocoaKeycodeOffset;
int K_TAB = 48 + CocoaKeycodeOffset;
int K_RETURN = 36 + CocoaKeycodeOffset;
int K_DELETE = 117 + CocoaKeycodeOffset;
int K_INSERT = 125125125 + CocoaKeycodeOffset;
int K_BACK = 51 + CocoaKeycodeOffset;
int K_SPACE = 49 + CocoaKeycodeOffset;
int K_UP = 126 + CocoaKeycodeOffset;
int K_DOWN = 125 + CocoaKeycodeOffset;
int K_LEFT = 123 + CocoaKeycodeOffset;
int K_RIGHT = 124 + CocoaKeycodeOffset;
int K_HOME = 115 + CocoaKeycodeOffset;
int K_END = 119 + CocoaKeycodeOffset;
int K_SCROLL = 1000 + CocoaKeycodeOffset;
int K_MENU = 1000 + CocoaKeycodeOffset;
int K_PAGEUP = 116 + CocoaKeycodeOffset;
int K_PAGEDOWN = 121 + CocoaKeycodeOffset;
int KEY_M = 46 + CocoaKeycodeOffset;
int KEY_T = 17 + CocoaKeycodeOffset;
int KEY_W = 13 + CocoaKeycodeOffset;
int KEY_I = 34 + CocoaKeycodeOffset;
int KEY_C = 8 + CocoaKeycodeOffset;
int KEY_V = 9 + CocoaKeycodeOffset;
int KEY_X = 7 + CocoaKeycodeOffset;
int KEY_A = 0 + CocoaKeycodeOffset;
int MK_SHIFT = NSShiftKeyMask;
int MK_CONTROL = NSControlKeyMask;
#endif

View File

@ -220,8 +220,52 @@ const int SEC1_TIMER=1,SEC1_MSEC=1000;
#define KEY_A 0
#define MK_SHIFT 0
#define MK_CONTROL 0
#else
#error need window system
#elif defined(USE_COCOA)
// declare as extern variables and initialize them in StdMacWindow.mm so as to not include objc headers
const int CocoaKeycodeOffset = 300;
extern int K_F1;
extern int K_F2;
extern int K_F3;
extern int K_F4;
extern int K_F5;
extern int K_F6;
extern int K_F7;
extern int K_F8;
extern int K_F9;
extern int K_F10;
extern int K_F11;
extern int K_F12;
extern int K_ADD;
extern int K_SUBTRACT;
extern int K_MULTIPLY;
extern int K_ESCAPE;
extern int K_PAUSE;
extern int K_TAB;
extern int K_RETURN;
extern int K_DELETE;
extern int K_INSERT;
extern int K_BACK;
extern int K_SPACE;
extern int K_UP;
extern int K_DOWN;
extern int K_LEFT;
extern int K_RIGHT;
extern int K_HOME;
extern int K_END;
extern int K_SCROLL;
extern int K_MENU;
extern int K_PAGEUP;
extern int K_PAGEDOWN;
extern int KEY_M;
extern int KEY_T;
extern int KEY_W;
extern int KEY_I;
extern int KEY_C;
extern int KEY_V;
extern int KEY_X;
extern int KEY_A;
extern int MK_SHIFT;
extern int MK_CONTROL;
#endif
enum C4AppHandleResult
@ -294,6 +338,12 @@ private:
int width, height;
protected:
virtual void HandleMessage(SDL_Event&) {}
#elif defined(USE_COCOA)
protected:
/*ClonkWindowController*/void* controller;
virtual void HandleMessage(/*NSEvent*/void*);
public:
/*ClonkWindowController*/void* GetController() {return controller;}
#endif
public:
// request that this window be redrawn in the near future (including immediately)
@ -466,6 +516,9 @@ protected:
# if defined(USE_SDL_MAINLOOP)
void HandleSDLEvent(SDL_Event& event);
# endif
#ifdef USE_COCOA
void HandleNSEvent(/*NSEvent*/void* event);
#endif
const char * Location;
pthread_t MainThread;
bool DoNotDelay;

Binary file not shown.

View File

@ -2,17 +2,17 @@
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10C540</string>
<string key="IBDocument.InterfaceBuilderVersion">740</string>
<string key="IBDocument.AppKitVersion">1038.25</string>
<string key="IBDocument.HIToolboxVersion">458.00</string>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">740</string>
<string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="57"/>
<integer value="5"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
@ -27,181 +27,163 @@
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="119274832">
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="818653880">
<object class="NSMutableString" key="NSClassName">
<characters key="NS.bytes">NSApplication</characters>
</object>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">ClonkWindowController</string>
</object>
<object class="NSCustomObject" id="22732454">
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1044128150">
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSMenu" id="413282662">
<string key="NSTitle">SDLMain</string>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="166399698">
<reference key="NSMenu" ref="413282662"/>
<string key="NSTitle">Clonk</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<object class="NSCustomResource" key="NSOnImage" id="236001633">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuCheckmark</string>
</object>
<object class="NSCustomResource" key="NSMixedImage" id="855621955">
<string key="NSClassName">NSImage</string>
<string key="NSResourceName">NSMenuMixedState</string>
</object>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="671325961">
<string key="NSTitle">Clonk</string>
<object class="NSMutableArray" key="NSMenuItems">
<object class="NSWindowTemplate" id="230815636">
<int key="NSWindowStyleMask">15</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{584, 378}, {480, 270}}</string>
<int key="NSWTFlags">611844096</int>
<string key="NSWindowTitle">Viewport</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<object class="NSView" key="NSWindowView" id="516276665">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSScrollView" id="363957052">
<reference key="NSNextResponder" ref="516276665"/>
<int key="NSvFlags">274</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="905940774">
<reference key="NSMenu" ref="671325961"/>
<string key="NSTitle">Hide Clonk</string>
<string key="NSKeyEquiv">h</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
<object class="NSClipView" id="1010538885">
<reference key="NSNextResponder" ref="363957052"/>
<int key="NSvFlags">2304</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="190287318">
<reference key="NSNextResponder" ref="1010538885"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{465, 255}</string>
<reference key="NSSuperview" ref="1010538885"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<string key="NSClassName">ClonkOpenGLView</string>
</object>
</object>
<string key="NSFrame">{{1, 1}, {465, 255}}</string>
<reference key="NSSuperview" ref="363957052"/>
<reference key="NSNextKeyView" ref="190287318"/>
<reference key="NSDocView" ref="190287318"/>
<object class="NSColor" key="NSBGColor">
<int key="NSColorSpace">6</int>
<string key="NSCatalogName">System</string>
<string key="NSColorName">controlColor</string>
<object class="NSColor" key="NSColor">
<int key="NSColorSpace">3</int>
<bytes key="NSWhite">MC42NjY2NjY2NjY3AA</bytes>
</object>
</object>
<int key="NScvFlags">6</int>
</object>
<object class="NSMenuItem" id="430749323">
<reference key="NSMenu" ref="671325961"/>
<string key="NSTitle">Hide Others</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
<object class="NSScroller" id="802708292">
<reference key="NSNextResponder" ref="363957052"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{466, 1}, {15, 255}}</string>
<reference key="NSSuperview" ref="363957052"/>
<bool key="NSEnabled">YES</bool>
<reference key="NSTarget" ref="363957052"/>
<string key="NSAction">_doScroller:</string>
<double key="NSCurValue">1</double>
<double key="NSPercent">0.96363627910614014</double>
</object>
<object class="NSMenuItem" id="45658860">
<reference key="NSMenu" ref="671325961"/>
<string key="NSTitle">Show All</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
</object>
<object class="NSMenuItem" id="1010818828">
<reference key="NSMenu" ref="671325961"/>
<bool key="NSIsDisabled">YES</bool>
<bool key="NSIsSeparator">YES</bool>
<string key="NSTitle"/>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
</object>
<object class="NSMenuItem" id="942357333">
<reference key="NSMenu" ref="671325961"/>
<string key="NSTitle">Quit Clonk</string>
<string key="NSKeyEquiv">q</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
<object class="NSScroller" id="316701890">
<reference key="NSNextResponder" ref="363957052"/>
<int key="NSvFlags">256</int>
<string key="NSFrame">{{1, 256}, {465, 15}}</string>
<reference key="NSSuperview" ref="363957052"/>
<bool key="NSEnabled">YES</bool>
<int key="NSsFlags">1</int>
<reference key="NSTarget" ref="363957052"/>
<string key="NSAction">_doScroller:</string>
<double key="NSPercent">0.50602412223815918</double>
</object>
</object>
<string key="NSName">_NSAppleMenu</string>
</object>
</object>
<object class="NSMenuItem" id="143812656">
<reference key="NSMenu" ref="413282662"/>
<string key="NSTitle">Window</string>
<string key="NSKeyEquiv"/>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
<string key="NSAction">submenuAction:</string>
<object class="NSMenu" key="NSSubmenu" id="594976293">
<object class="NSMutableString" key="NSTitle">
<characters key="NS.bytes">Window</characters>
</object>
<object class="NSMutableArray" key="NSMenuItems">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSMenuItem" id="687345396">
<reference key="NSMenu" ref="594976293"/>
<string key="NSTitle">Minimize</string>
<string key="NSKeyEquiv">m</string>
<int key="NSKeyEquivModMask">1048576</int>
<int key="NSMnemonicLoc">2147483647</int>
<reference key="NSOnImage" ref="236001633"/>
<reference key="NSMixedImage" ref="855621955"/>
</object>
</object>
<string key="NSName">_NSWindowsMenu</string>
<string key="NSFrame">{{-1, -1}, {482, 272}}</string>
<reference key="NSSuperview" ref="516276665"/>
<reference key="NSNextKeyView" ref="1010538885"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<int key="NSsFlags">50</int>
<reference key="NSVScroller" ref="802708292"/>
<reference key="NSHScroller" ref="316701890"/>
<reference key="NSContentView" ref="1010538885"/>
</object>
</object>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSName">_NSMainMenu</string>
</object>
<object class="NSCustomObject" id="3445348">
<string key="NSClassName">NSFontManager</string>
</object>
<object class="NSCustomObject" id="898186092">
<string key="NSClassName">ClonkAppDelegate</string>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">hideOtherApplications:</string>
<reference key="source" ref="818653880"/>
<reference key="destination" ref="430749323"/>
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="230815636"/>
</object>
<int key="connectionID">146</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">hide:</string>
<reference key="source" ref="818653880"/>
<reference key="destination" ref="905940774"/>
</object>
<int key="connectionID">152</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">unhideAllApplications:</string>
<reference key="source" ref="818653880"/>
<reference key="destination" ref="45658860"/>
</object>
<int key="connectionID">153</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">performMiniaturize:</string>
<reference key="source" ref="22732454"/>
<reference key="destination" ref="687345396"/>
</object>
<int key="connectionID">328</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">terminate:</string>
<reference key="source" ref="1044128150"/>
<reference key="destination" ref="942357333"/>
</object>
<int key="connectionID">339</int>
<int key="connectionID">10</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1044128150"/>
<reference key="destination" ref="898186092"/>
<reference key="source" ref="230815636"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">341</int>
<int key="connectionID">12</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">openGLView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="190287318"/>
</object>
<int key="connectionID">31</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">scroll:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="802708292"/>
</object>
<int key="connectionID">32</int>
</object>
<object class="IBConnectionRecord">
<object class="IBActionConnection" key="connection">
<string key="label">scroll:</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="316701890"/>
</object>
<int key="connectionID">33</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">scrollView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="363957052"/>
</object>
<int key="connectionID">34</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">initialFirstResponder</string>
<reference key="source" ref="230815636"/>
<reference key="destination" ref="190287318"/>
</object>
<int key="connectionID">36</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
@ -210,184 +192,104 @@
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="119274832"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="818653880"/>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="22732454"/>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="413282662"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="166399698"/>
<reference ref="143812656"/>
</object>
<reference key="parent" ref="0"/>
<string key="objectName">MainMenu</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">56</int>
<reference key="object" ref="166399698"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="671325961"/>
</object>
<reference key="parent" ref="413282662"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">57</int>
<reference key="object" ref="671325961"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="905940774"/>
<reference ref="942357333"/>
<reference ref="430749323"/>
<reference ref="1010818828"/>
<reference ref="45658860"/>
</object>
<reference key="parent" ref="166399698"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">134</int>
<reference key="object" ref="905940774"/>
<reference key="parent" ref="671325961"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">136</int>
<reference key="object" ref="942357333"/>
<reference key="parent" ref="671325961"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">145</int>
<reference key="object" ref="430749323"/>
<reference key="parent" ref="671325961"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">149</int>
<reference key="object" ref="1010818828"/>
<reference key="parent" ref="671325961"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">150</int>
<reference key="object" ref="45658860"/>
<reference key="parent" ref="671325961"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">284</int>
<reference key="object" ref="143812656"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="594976293"/>
</object>
<reference key="parent" ref="413282662"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">285</int>
<reference key="object" ref="594976293"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="687345396"/>
</object>
<reference key="parent" ref="143812656"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">283</int>
<reference key="object" ref="687345396"/>
<reference key="parent" ref="594976293"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">253</int>
<reference key="object" ref="3445348"/>
<reference key="parent" ref="0"/>
<string key="objectName">Font Manager</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1044128150"/>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">340</int>
<reference key="object" ref="898186092"/>
<int key="objectID">3</int>
<reference key="object" ref="230815636"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="516276665"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">5</int>
<reference key="object" ref="516276665"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="363957052"/>
</object>
<reference key="parent" ref="230815636"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">27</int>
<reference key="object" ref="363957052"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="190287318"/>
<reference ref="316701890"/>
<reference ref="802708292"/>
</object>
<reference key="parent" ref="516276665"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">30</int>
<reference key="object" ref="190287318"/>
<reference key="parent" ref="363957052"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">29</int>
<reference key="object" ref="316701890"/>
<reference key="parent" ref="363957052"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">28</int>
<reference key="object" ref="802708292"/>
<reference key="parent" ref="363957052"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>-1.IBPluginDependency</string>
<string>-2.IBPluginDependency</string>
<string>-3.IBPluginDependency</string>
<string>134.IBPluginDependency</string>
<string>134.ImportedFromIB2</string>
<string>136.IBPluginDependency</string>
<string>136.ImportedFromIB2</string>
<string>145.IBPluginDependency</string>
<string>145.ImportedFromIB2</string>
<string>149.IBPluginDependency</string>
<string>149.ImportedFromIB2</string>
<string>150.IBPluginDependency</string>
<string>150.ImportedFromIB2</string>
<string>253.ImportedFromIB2</string>
<string>283.IBPluginDependency</string>
<string>283.ImportedFromIB2</string>
<string>284.IBPluginDependency</string>
<string>284.ImportedFromIB2</string>
<string>285.IBEditorWindowLastContentRect</string>
<string>285.IBPluginDependency</string>
<string>285.ImportedFromIB2</string>
<string>29.IBEditorWindowLastContentRect</string>
<string>27.IBPluginDependency</string>
<string>28.IBPluginDependency</string>
<string>29.IBPluginDependency</string>
<string>29.ImportedFromIB2</string>
<string>340.IBPluginDependency</string>
<string>56.IBPluginDependency</string>
<string>56.ImportedFromIB2</string>
<string>57.IBEditorWindowLastContentRect</string>
<string>57.IBPluginDependency</string>
<string>57.ImportedFromIB2</string>
<string>3.IBEditorWindowLastContentRect</string>
<string>3.IBPluginDependency</string>
<string>3.IBWindowTemplateEditedContentRect</string>
<string>3.NSWindowTemplate.visibleAtLaunch</string>
<string>30.IBPluginDependency</string>
<string>5.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{124, 952}, {140, 23}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{52, 975}, {155, 20}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>{{64, 882}, {185, 93}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<boolean value="YES"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{70, 378}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{70, 378}, {480, 270}}</string>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
@ -406,26 +308,73 @@
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">341</int>
<int key="maxID">36</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ClonkAppDelegate</string>
<string key="superclassName">NSObject</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">terminate:</string>
<string key="NS.object.0">NSApplication</string>
</object>
<string key="className">ClonkOpenGLView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">ClonkAppDelegate.h</string>
<string key="minorKey">src/platform/ClonkOpenGLView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">FirstResponder</string>
<string key="superclassName">NSObject</string>
<string key="className">ClonkWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">scroll:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">scroll:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">scroll:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ClonkOpenGLView</string>
<string>NSScrollView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">openGLView</string>
<string key="candidateClassName">ClonkOpenGLView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">scrollView</string>
<string key="candidateClassName">NSScrollView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">src/platform/ClonkWindowController.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">ClonkWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBUserSource</string>
<string key="minorKey"/>
@ -434,6 +383,14 @@
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSFormatter</string>
<string key="superclassName">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFormatter.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -455,13 +412,6 @@
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -497,20 +447,6 @@
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSMetadata.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSNetServices.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -525,13 +461,6 @@
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSPort.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -574,20 +503,6 @@
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSSpellServer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSStream.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -620,7 +535,35 @@
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSXMLParser.h</string>
<string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
@ -630,6 +573,20 @@
<string key="minorKey">PrintCore.framework/Headers/PDEPluginInterface.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
@ -651,23 +608,38 @@
<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1050" key="NS.object.0"/>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">OpenClonk.xcodeproj</string>
<string key="IBDocument.LastKnownRelativeProjectPath">../../Clonk.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>

View File

@ -0,0 +1,501 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10H574</string>
<string key="IBDocument.InterfaceBuilderVersion">823</string>
<string key="IBDocument.AppKitVersion">1038.35</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">823</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="3"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">ClonkWindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="16213378">
<int key="NSWindowStyleMask">31</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{131, 159}, {480, 270}}</string>
<int key="NSWTFlags">-461897728</int>
<string key="NSWindowTitle">Dialog</string>
<string key="NSWindowClass">NSPanel</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<object class="NSView" key="NSWindowView" id="323620923">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="1029831788">
<reference key="NSNextResponder" ref="323620923"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview" ref="323620923"/>
<string key="NSClassName">ClonkOpenGLView</string>
</object>
</object>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1280, 778}}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="16213378"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">openGLView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1029831788"/>
</object>
<int key="connectionID">8</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="16213378"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">9</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="16213378"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="323620923"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">4</int>
<reference key="object" ref="323620923"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1029831788"/>
</object>
<reference key="parent" ref="16213378"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">7</int>
<reference key="object" ref="1029831788"/>
<reference key="parent" ref="323620923"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>3.IBEditorWindowLastContentRect</string>
<string>3.IBPluginDependency</string>
<string>3.IBWindowTemplateEditedContentRect</string>
<string>3.NSWindowTemplate.visibleAtLaunch</string>
<string>4.IBPluginDependency</string>
<string>7.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{21, 444}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{21, 444}, {480, 270}}</string>
<boolean value="NO"/>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">9</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ClonkOpenGLView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">src/platform/ClonkOpenGLView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">ClonkWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">scroll:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">scroll:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">scroll:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ClonkOpenGLView</string>
<string>NSScrollView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">openGLView</string>
<string key="candidateClassName">ClonkOpenGLView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">scrollView</string>
<string key="candidateClassName">NSScrollView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">src/platform/ClonkWindowController.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AddressBook.framework/Headers/ABActions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PrintCore.framework/Headers/PDEPluginInterface.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../../Clonk.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,506 @@
<?xml version="1.0" encoding="UTF-8"?>
<archive type="com.apple.InterfaceBuilder3.Cocoa.XIB" version="7.10">
<data>
<int key="IBDocument.SystemTarget">1060</int>
<string key="IBDocument.SystemVersion">10F569</string>
<string key="IBDocument.InterfaceBuilderVersion">788</string>
<string key="IBDocument.AppKitVersion">1038.29</string>
<string key="IBDocument.HIToolboxVersion">461.00</string>
<object class="NSMutableDictionary" key="IBDocument.PluginVersions">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin</string>
<string key="NS.object.0">788</string>
</object>
<object class="NSMutableArray" key="IBDocument.EditedObjectIDs">
<bool key="EncodedWithXMLCoder">YES</bool>
<integer value="1"/>
</object>
<object class="NSArray" key="IBDocument.PluginDependencies">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
<object class="NSMutableDictionary" key="IBDocument.Metadata">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys" id="0">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<object class="NSMutableArray" key="IBDocument.RootObjects" id="1000">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomObject" id="1001">
<string key="NSClassName">ClonkWindowController</string>
</object>
<object class="NSCustomObject" id="1003">
<string key="NSClassName">FirstResponder</string>
</object>
<object class="NSCustomObject" id="1004">
<string key="NSClassName">NSApplication</string>
</object>
<object class="NSWindowTemplate" id="1005">
<int key="NSWindowStyleMask">5</int>
<int key="NSWindowBacking">2</int>
<string key="NSWindowRect">{{196, 240}, {480, 270}}</string>
<int key="NSWTFlags">544735232</int>
<string key="NSWindowTitle">OpenClonk</string>
<string key="NSWindowClass">NSWindow</string>
<nil key="NSViewClass"/>
<string key="NSWindowContentMaxSize">{1.79769e+308, 1.79769e+308}</string>
<object class="NSView" key="NSWindowView" id="1006">
<reference key="NSNextResponder"/>
<int key="NSvFlags">256</int>
<object class="NSMutableArray" key="NSSubviews">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSCustomView" id="174124930">
<reference key="NSNextResponder" ref="1006"/>
<int key="NSvFlags">274</int>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview" ref="1006"/>
<bool key="NSViewCanDrawConcurrently">YES</bool>
<string key="NSClassName">ClonkOpenGLView</string>
</object>
</object>
<string key="NSFrameSize">{480, 270}</string>
<reference key="NSSuperview"/>
</object>
<string key="NSScreenRect">{{0, 0}, {1680, 1028}}</string>
<string key="NSMaxSize">{1.79769e+308, 1.79769e+308}</string>
</object>
</object>
<object class="IBObjectContainer" key="IBDocument.Objects">
<object class="NSMutableArray" key="connectionRecords">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">openGLView</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="174124930"/>
</object>
<int key="connectionID">5</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">delegate</string>
<reference key="source" ref="1005"/>
<reference key="destination" ref="1001"/>
</object>
<int key="connectionID">6</int>
</object>
<object class="IBConnectionRecord">
<object class="IBOutletConnection" key="connection">
<string key="label">window</string>
<reference key="source" ref="1001"/>
<reference key="destination" ref="1005"/>
</object>
<int key="connectionID">7</int>
</object>
</object>
<object class="IBMutableOrderedSet" key="objectRecords">
<object class="NSArray" key="orderedObjects">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBObjectRecord">
<int key="objectID">0</int>
<reference key="object" ref="0"/>
<reference key="children" ref="1000"/>
<nil key="parent"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">-2</int>
<reference key="object" ref="1001"/>
<reference key="parent" ref="0"/>
<string key="objectName">File's Owner</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-1</int>
<reference key="object" ref="1003"/>
<reference key="parent" ref="0"/>
<string key="objectName">First Responder</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">-3</int>
<reference key="object" ref="1004"/>
<reference key="parent" ref="0"/>
<string key="objectName">Application</string>
</object>
<object class="IBObjectRecord">
<int key="objectID">1</int>
<reference key="object" ref="1005"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="1006"/>
</object>
<reference key="parent" ref="0"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">2</int>
<reference key="object" ref="1006"/>
<object class="NSMutableArray" key="children">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference ref="174124930"/>
</object>
<reference key="parent" ref="1005"/>
</object>
<object class="IBObjectRecord">
<int key="objectID">3</int>
<reference key="object" ref="174124930"/>
<reference key="parent" ref="1006"/>
</object>
</object>
</object>
<object class="NSMutableDictionary" key="flattenedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>1.IBEditorWindowLastContentRect</string>
<string>1.IBPluginDependency</string>
<string>1.IBWindowTemplateEditedContentRect</string>
<string>1.NSWindowTemplate.visibleAtLaunch</string>
<string>1.WindowOrigin</string>
<string>1.editorWindowContentRectSynchronizationRect</string>
<string>2.IBPluginDependency</string>
<string>3.IBPluginDependency</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>{{154, 486}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>{{154, 486}, {480, 270}}</string>
<boolean value="NO"/>
<string>{196, 240}</string>
<string>{{202, 428}, {480, 270}}</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
<string>com.apple.InterfaceBuilder.CocoaPlugin</string>
</object>
</object>
<object class="NSMutableDictionary" key="unlocalizedProperties">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="activeLocalization"/>
<object class="NSMutableDictionary" key="localizations">
<bool key="EncodedWithXMLCoder">YES</bool>
<reference key="dict.sortedKeys" ref="0"/>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
</object>
</object>
<nil key="sourceID"/>
<int key="maxID">7</int>
</object>
<object class="IBClassDescriber" key="IBDocument.Classes">
<object class="NSMutableArray" key="referencedPartialClassDescriptions">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">ClonkOpenGLView</string>
<string key="superclassName">NSView</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">src/platform/ClonkOpenGLView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">ClonkWindowController</string>
<string key="superclassName">NSWindowController</string>
<object class="NSMutableDictionary" key="actions">
<string key="NS.key.0">scroll:</string>
<string key="NS.object.0">id</string>
</object>
<object class="NSMutableDictionary" key="actionInfosByName">
<string key="NS.key.0">scroll:</string>
<object class="IBActionInfo" key="NS.object.0">
<string key="name">scroll:</string>
<string key="candidateClassName">id</string>
</object>
</object>
<object class="NSMutableDictionary" key="outlets">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>ClonkOpenGLView</string>
<string>NSScrollView</string>
</object>
</object>
<object class="NSMutableDictionary" key="toOneOutletInfosByName">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="NSArray" key="dict.sortedKeys">
<bool key="EncodedWithXMLCoder">YES</bool>
<string>openGLView</string>
<string>scrollView</string>
</object>
<object class="NSMutableArray" key="dict.values">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBToOneOutletInfo">
<string key="name">openGLView</string>
<string key="candidateClassName">ClonkOpenGLView</string>
</object>
<object class="IBToOneOutletInfo">
<string key="name">scrollView</string>
<string key="candidateClassName">NSScrollView</string>
</object>
</object>
</object>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBProjectSource</string>
<string key="minorKey">src/platform/ClonkWindowController.h</string>
</object>
</object>
</object>
<object class="NSMutableArray" key="referencedPartialClassDescriptionsV3.2+">
<bool key="EncodedWithXMLCoder">YES</bool>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">AddressBook.framework/Headers/ABActions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSError.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSFileManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyValueObserving.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSKeyedArchiver.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObject.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSObjectScripting.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSPortCoder.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSRunLoop.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptClassDescription.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptKeyValueCoding.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptObjectSpecifiers.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSScriptWhoseTests.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSThread.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURL.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLConnection.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">Foundation.framework/Headers/NSURLDownload.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKImageBrowserView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/IKSaveOptions.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">ImageKit.framework/Headers/ImageKitDeprecated.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFDocument.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PDFKit.framework/Headers/PDFView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">PrintCore.framework/Headers/PDEPluginInterface.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionParameterView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzComposer.framework/Headers/QCCompositionPickerView.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CAAnimation.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CALayer.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzCore.framework/Headers/CIImageProvider.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuartzFilters.framework/Headers/QuartzFilterManager.h</string>
</object>
</object>
<object class="IBPartialClassDescription">
<string key="className">NSObject</string>
<object class="IBClassDescriptionSource" key="sourceIdentifier">
<string key="majorKey">IBFrameworkSource</string>
<string key="minorKey">QuickLookUI.framework/Headers/QLPreviewPanel.h</string>
</object>
</object>
</object>
</object>
<int key="IBDocument.localizationMode">0</int>
<string key="IBDocument.TargetRuntimeIdentifier">IBCocoaFramework</string>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDependencyDefaults">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.macosx</string>
<integer value="1060" key="NS.object.0"/>
</object>
<object class="NSMutableDictionary" key="IBDocument.PluginDeclaredDevelopmentDependencies">
<string key="NS.key.0">com.apple.InterfaceBuilder.CocoaPlugin.InterfaceBuilder3</string>
<integer value="3000" key="NS.object.0"/>
</object>
<bool key="IBDocument.PluginDeclaredDependenciesTrackSystemTargetVersion">YES</bool>
<string key="IBDocument.LastKnownRelativeProjectPath">../../Clonk.xcodeproj</string>
<int key="IBDocument.defaultPropertyAccessControl">3</int>
</data>
</archive>

View File

@ -172,6 +172,8 @@
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu.nib</string>
<key>NSPrincipalClass</key>
@ -179,7 +181,7 @@
<key>NSHumanReadableCopyright</key>
<string>(c) ${C4COPYRIGHT_YEAR}, ${C4PROJECT}</string>
<key>CFBundleDisplayName</key>
<string>${C4ENGINEINFOLONG}</string>
<string>${C4ENGINEINFO}</string>
<key>CFBundleShortVersionString</key>
<string>${C4VERSION}</string>
<key>CFBundleVersion</key>

3218
src/res/MainMenu.xib 100644

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
#!/bin/sh
LIBS_TO_BUNDLE="/opt/local/lib/lib(crypto|z\.|iconv|jpeg|png|GLEW|llvm|SDL|SDL_mixer|freetype)[^ ]+"
cd $TARGET_BUILD_DIR
pwd
for lib in `otool -L $EXECUTABLE_PATH | grep -Eo "$LIBS_TO_BUNDLE"`; do
base=`basename $lib`
mkdir -p $FRAMEWORKS_FOLDER_PATH
bundle_path=$FRAMEWORKS_FOLDER_PATH/$base
id=@executable_path/../Frameworks/$base
echo Bundling $base... cp $lib $bundle_path
cp $lib $bundle_path
chmod u+w $bundle_path
install_name_tool -id $id $bundle_path
install_name_tool -change $lib $id $EXECUTABLE_PATH
done

File diff suppressed because it is too large Load Diff

View File

@ -1,28 +0,0 @@
/* SDLMain.m - main entry point for our Cocoa-ized SDL app
Initial Version: Darrell Walisser <dwaliss1@purdue.edu>
Non-NIB-Code & other changes: Max Horn <max@quendi.de>
Feel free to customize this file to suit your needs
*/
#import <Cocoa/Cocoa.h>
enum ClonkAppDelegateGameState {
GS_NotYetStarted,
GS_Running,
GS_Finished
};
@interface ClonkAppDelegate: NSObject
{
NSMutableArray* gatheredArguments;
NSString* clonkDirectory;
NSString* addonSupplied;
ClonkAppDelegateGameState gameState;
}
- (NSString*) clonkDirectory;
- (BOOL) argsLookLikeItShouldBeInstallation;
- (void)makeFakeArgs:(char***)argv argc:(int*)argc;
- (BOOL)installAddOn;
- (void)terminate:(NSApplication*)sender;
@end

View File

@ -1,182 +0,0 @@
<?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>CFBundleDevelopmentRegion</key>
<string>English</string>
<key>CFBundleDocumentTypes</key>
<array>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4k</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4K.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/octet-stream</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Key</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4u</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4U.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Update</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4s</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4S.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Scenario</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4d</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4D.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Definition</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4g</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4G.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Group</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4p</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4P.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Player</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>c4f</string>
</array>
<key>CFBundleTypeIconFile</key>
<string>C4F.icns</string>
<key>CFBundleTypeMIMETypes</key>
<array>
<string>application/vnd.clonk.c4group</string>
</array>
<key>CFBundleTypeName</key>
<string>Clonk Folder</string>
<key>CFBundleTypeRole</key>
<string>Viewer</string>
<key>LSTypeIsPackage</key>
<false/>
<key>NSPersistentStoreTypeKey</key>
<string>Binary</string>
</dict>
</array>
<key>CFBundleExecutable</key>
<string>${EXECUTABLE_NAME}</string>
<key>CFBundleIconFile</key>
<string>Clonk</string>
<key>CFBundleIdentifier</key>
<string>de.clonk.rage</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string>Clonk Game Link</string>
<key>CFBundleURLSchemes</key>
<array>
<string>clonk</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1.0</string>
<key>NSMainNibFile</key>
<string>MainMenu.nib</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>
</plist>