mirror of
https://github.com/SFML/SFML.git
synced 2024-11-29 06:41:05 +08:00
Added sfPriv prefix to forgotten Objective-C classes to prevent conflicts with user classes.
git-svn-id: https://sfml.svn.sourceforge.net/svnroot/sfml/trunk@1423 4e206d99-4929-0410-ac5d-dfc041789085
This commit is contained in:
parent
9354d3adba
commit
d7496629e3
@ -32,7 +32,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Window independant OpenGL context class
|
/// Window independant OpenGL context class
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@interface GLContext : NSOpenGLContext
|
@interface sfPrivGLContext : NSOpenGLContext
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return the shared OpenGL context instance (making one if needed)
|
/// Return the shared OpenGL context instance (making one if needed)
|
||||||
@ -44,7 +44,7 @@
|
|||||||
/// and the shared context @context
|
/// and the shared context @context
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (id)initWithAttributes:(sf::WindowSettings&)attribs
|
- (id)initWithAttributes:(sf::WindowSettings&)attribs
|
||||||
sharedContext:(GLContext *)context;
|
sharedContext:(sfPrivGLContext *)context;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -52,10 +52,10 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Customized Cocoa OpenGL view
|
/// Customized Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@interface GLView : NSOpenGLView
|
@interface sfPrivGLView : NSOpenGLView
|
||||||
{
|
{
|
||||||
sf::priv::WindowImplCocoa *myDelegate;
|
sf::priv::WindowImplCocoa *myDelegate;
|
||||||
GLContext *myGLContext;
|
sfPrivGLContext *myGLContext;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -107,7 +107,7 @@
|
|||||||
{
|
{
|
||||||
@private
|
@private
|
||||||
NSWindow *myWindow;
|
NSWindow *myWindow;
|
||||||
GLView *myView;
|
sfPrivGLView *myView;
|
||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -118,7 +118,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return a reference to the internal Cocoa OpenGL view
|
/// Return a reference to the internal Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (GLView *)view;
|
- (sfPrivGLView *)view;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Sets @aDelegate as the window delegate
|
/// Sets @aDelegate as the window delegate
|
||||||
|
@ -43,12 +43,12 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Registers the the OpenGL view and adds it to its parent container
|
/// Registers the the OpenGL view and adds it to its parent container
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)putOpenGLView:(GLView *)aView;
|
- (void)putOpenGLView:(sfPrivGLView *)aView;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Registers a reference to the internal Cocoa OpenGL view
|
/// Registers a reference to the internal Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)setView:(GLView *)aView;
|
- (void)setView:(sfPrivGLView *)aView;
|
||||||
|
|
||||||
@end
|
@end
|
||||||
|
|
||||||
@ -65,7 +65,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Window independant OpenGL context class
|
/// Window independant OpenGL context class
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@implementation GLContext
|
@implementation sfPrivGLContext
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@ -75,13 +75,13 @@
|
|||||||
{
|
{
|
||||||
// Make a new context with the default parameters
|
// Make a new context with the default parameters
|
||||||
sf::WindowSettings params;
|
sf::WindowSettings params;
|
||||||
static GLContext *sharedCtx = [[GLContext alloc] initWithAttributes:params sharedContext:nil];
|
static sfPrivGLContext *sharedCtx = [[sfPrivGLContext alloc] initWithAttributes:params sharedContext:nil];
|
||||||
return sharedCtx;
|
return sharedCtx;
|
||||||
}
|
}
|
||||||
|
|
||||||
- (void)dealloc
|
- (void)dealloc
|
||||||
{
|
{
|
||||||
[[GLContext sharedContext] release];
|
[[sfPrivGLContext sharedContext] release];
|
||||||
[super dealloc];
|
[super dealloc];
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -89,7 +89,7 @@
|
|||||||
/// Make a new OpenGL context according to the @attribs settings
|
/// Make a new OpenGL context according to the @attribs settings
|
||||||
/// and the shared context @context
|
/// and the shared context @context
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (id)initWithAttributes:(sf::WindowSettings&)attribs sharedContext:(GLContext *)sharedContext
|
- (id)initWithAttributes:(sf::WindowSettings&)attribs sharedContext:(sfPrivGLContext *)sharedContext
|
||||||
{
|
{
|
||||||
// Note about antialiasing and other context attributes :
|
// Note about antialiasing and other context attributes :
|
||||||
// OpenGL context sharing does not allow the shared contexts to use different attributes.
|
// OpenGL context sharing does not allow the shared contexts to use different attributes.
|
||||||
@ -175,7 +175,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Customized Cocoa OpenGL view
|
/// Customized Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@implementation GLView
|
@implementation sfPrivGLView
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Make a new view according the the rect @frame,
|
/// Make a new view according the the rect @frame,
|
||||||
@ -196,8 +196,8 @@
|
|||||||
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
[self setAutoresizingMask:NSViewWidthSizable | NSViewHeightSizable];
|
||||||
|
|
||||||
// make the OpenGL context
|
// make the OpenGL context
|
||||||
myGLContext = [[GLContext alloc] initWithAttributes:settings
|
myGLContext = [[sfPrivGLContext alloc] initWithAttributes:settings
|
||||||
sharedContext:[GLContext sharedContext]];
|
sharedContext:[sfPrivGLContext sharedContext]];
|
||||||
|
|
||||||
if (!myGLContext) {
|
if (!myGLContext) {
|
||||||
[self release];
|
[self release];
|
||||||
@ -560,7 +560,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Registers the the OpenGL view and adds it to its parent container
|
/// Registers the the OpenGL view and adds it to its parent container
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)putOpenGLView:(GLView *)aView
|
- (void)putOpenGLView:(sfPrivGLView *)aView
|
||||||
{
|
{
|
||||||
[self setView:aView];
|
[self setView:aView];
|
||||||
|
|
||||||
@ -573,7 +573,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Registers a reference to the internal Cocoa OpenGL view
|
/// Registers a reference to the internal Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)setView:(GLView *)aView
|
- (void)setView:(sfPrivGLView *)aView
|
||||||
{
|
{
|
||||||
if (myView != aView)
|
if (myView != aView)
|
||||||
{
|
{
|
||||||
@ -585,7 +585,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Return a reference to the internal Cocoa OpenGL view
|
/// Return a reference to the internal Cocoa OpenGL view
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (GLView *)view
|
- (sfPrivGLView *)view
|
||||||
{
|
{
|
||||||
return [[myView retain] autorelease];
|
return [[myView retain] autorelease];
|
||||||
}
|
}
|
||||||
@ -849,7 +849,7 @@
|
|||||||
[[self window] center];
|
[[self window] center];
|
||||||
|
|
||||||
// Make the OpenGL view
|
// Make the OpenGL view
|
||||||
GLView *newView = [[GLView alloc]
|
sfPrivGLView *newView = [[sfPrivGLView alloc]
|
||||||
initWithFrame:[[[self window] contentView] frame]
|
initWithFrame:[[[self window] contentView] frame]
|
||||||
mode:aMode
|
mode:aMode
|
||||||
settings:someSettings];
|
settings:someSettings];
|
||||||
@ -990,7 +990,7 @@
|
|||||||
// Make the OpenGL view
|
// Make the OpenGL view
|
||||||
sf::VideoMode mode([[[self window] contentView] frame].size.width,
|
sf::VideoMode mode([[[self window] contentView] frame].size.width,
|
||||||
[[[self window] contentView] frame].size.height);
|
[[[self window] contentView] frame].size.height);
|
||||||
GLView *newView = [[GLView alloc]
|
sfPrivGLView *newView = [[sfPrivGLView alloc]
|
||||||
initWithFrame:[[[self window] contentView] frame]
|
initWithFrame:[[[self window] contentView] frame]
|
||||||
mode:mode
|
mode:mode
|
||||||
settings:someSettings];
|
settings:someSettings];
|
||||||
@ -1025,7 +1025,7 @@
|
|||||||
// Make the OpenGL view
|
// Make the OpenGL view
|
||||||
sf::VideoMode mode([parentView bounds].size.width,
|
sf::VideoMode mode([parentView bounds].size.width,
|
||||||
[parentView bounds].size.height);
|
[parentView bounds].size.height);
|
||||||
GLView *newView = [[GLView alloc]
|
sfPrivGLView *newView = [[sfPrivGLView alloc]
|
||||||
initWithFrame:[parentView bounds]
|
initWithFrame:[parentView bounds]
|
||||||
mode:mode
|
mode:mode
|
||||||
settings:someSettings];
|
settings:someSettings];
|
||||||
@ -1051,7 +1051,7 @@
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// Registers the the OpenGL view and adds it to its parent container
|
/// Registers the the OpenGL view and adds it to its parent container
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
- (void)putOpenGLView:(GLView *)aView
|
- (void)putOpenGLView:(sfPrivGLView *)aView
|
||||||
{
|
{
|
||||||
[self setView:aView];
|
[self setView:aView];
|
||||||
|
|
||||||
|
@ -70,7 +70,7 @@ myWheelStatus(0.0f)
|
|||||||
[sfPrivAppController sharedController];
|
[sfPrivAppController sharedController];
|
||||||
|
|
||||||
// Create the shared OpenGL context
|
// Create the shared OpenGL context
|
||||||
if ([GLContext sharedContext]) {
|
if ([sfPrivGLContext sharedContext]) {
|
||||||
// Then we make it the current active OpenGL context
|
// Then we make it the current active OpenGL context
|
||||||
SetActive();
|
SetActive();
|
||||||
} else {
|
} else {
|
||||||
@ -569,10 +569,10 @@ void WindowImplCocoa::SetActive(bool Active) const
|
|||||||
else {
|
else {
|
||||||
// Or directly activate the shared OpenGL context if we're not using a window
|
// Or directly activate the shared OpenGL context if we're not using a window
|
||||||
if (Active) {
|
if (Active) {
|
||||||
if ([NSOpenGLContext currentContext] != [GLContext sharedContext])
|
if ([NSOpenGLContext currentContext] != [sfPrivGLContext sharedContext])
|
||||||
[[GLContext sharedContext] makeCurrentContext];
|
[[sfPrivGLContext sharedContext] makeCurrentContext];
|
||||||
} else {
|
} else {
|
||||||
if ([NSOpenGLContext currentContext] == [GLContext sharedContext])
|
if ([NSOpenGLContext currentContext] == [sfPrivGLContext sharedContext])
|
||||||
[NSOpenGLContext clearCurrentContext];
|
[NSOpenGLContext clearCurrentContext];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user