Not logged inOpenClonk Forum
Up Topic Mac Dev Mode

This board is threaded (i.e. has a tree structure). Please use the Reply button of the specific post you are referring to, not just any random button. If you want to reply to the topic in general, use the Post button near the top and bottom of the page.

Post Reply
In Response to Günther

> I just compiled everything in Objective-C++ since I was too lazy to sort out only those files that somehow include header files with Objective-C declarations. It seemed to me that most do anyway :/


As far as I can see those id changes are in files that don't need Object-C stuff. You might have to move some #includes around, but sooner or later someone probably will use "id" again, and we don't want the mac port to break then. Really, if it weren't for the developer mode with that mixture of GUI and engine internal code, everything could be nicely encapsulated in src/platform without any leakage.

>> I don't like "Mac: Shuffle drawing code around to make it easier to call it inside a NSView drawRect: method
> I introduced those Do* methods so that calling the normal methods would still cause drawing the content even if indirectly by marking some Cocoa view as needing to be redrawn while calling the Do* methods would invoke the actual drawing code. But well, it is really ugly ;)


Well, what do you think of my suggestion? (StdWindow { virtual void ReDraw() = 0; void MarkForUpdate() { #ifndef mac ReDraw() #else FiddleCocoa() #endif } };) I think it's really the same algorithm, but with the platform differences hidden in src/platform. And that way, all platforms could use the standard interface to redraw a window in response to expose messages, and not simply redraw everything constantly even when the game is paused.

> I added #ifdefs to not have to change my custom Xcode project file which is not generated from CMake since CMake seemingly can't create Xcode files with cpp files being set to compile in Objective-C++ mode -.-. But maybe one can add 'set(CMAKE_CXX_FLAGS "-x objective-c++")' or something.


Ideally we wouldn't need to... But for the time being, it should suffice to compile src/editor that way. Maybe src/editor/*.mm files which #include the *.cpp ones?

> I think I'm calling those methods somewhere. Probably in ConsoleWindowController.mm responding to UI events.


The Win32 port does this with a friend declaration, the GTK one with a bunch of static callback functions. Doesn't "friend class ConsoleWindowController" work?

Powered by mwForum 2.29.7 © 1999-2015 Markus Wichitill