Game activated web browsing link

Member
Posts: 233
Joined: 2003.05
Post: #1
Say I want to have a link in my game... in other words the user clicks a button and up pops a webpage. The trick is I want it to be cross platform. Smile

So, while code for the mac would be useful, I'd rather find a cross platform library or some standard way of doing it on Mac/Windows/Linux. I think there may be some cross platform GUI libraries that would help me with this, but I was hoping to keep it more simple. I don't ask for much, eh? Rolleyes

I imagine it would be difficult to get a cross platform way of getting my game to read/write a file located on a web accessible server (say using webDAV and my iDisk.)

Basically, I'd love to do some DanLab Games style things like keep a web based high score list and have announcements from my site show up in any games the person has if they have an internet connection. I'm betting the solution is going to be: write different code for each platform. Wink Still, I'm drunk with SDL and effortless cross platform compiling, so I'd like to see how far that rabbit hole goes... and other metaphors. Cool

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #2
Closest thing I've found is http://www.webdav.org/neon/
I haven't tried using neon because the docs say that the documentation is always wrong. Smile (because they haven't gotten to 1.0 yet.) It's "peruse the code to learn" which is difficult for a networking neophyte like me. Sigh. Anyway, there is other stuff out there, but suprisingly little for C/C++.

After looking at this code for awhile, I'm getting curious about the Mac way of doing it. Wink

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Member
Posts: 110
Joined: 2002.07
Post: #3
write different code for each platform. Sad
Quote this message in a reply
Oldtimer
Posts: 834
Joined: 2002.09
Post: #4
Danlab, you sent me some code a while ago, that popped up a web link? Do you still have it?
Quote this message in a reply
Member
Posts: 110
Joined: 2002.07
Post: #5
PHP Code:
char *theURL2 "http://www.danlabgames.com";
long start2 0end2 strlen(theURL2);
ICInstance inst2;
ICStart(&inst2'mygame'); // put your application signature here
ICLaunchURL(inst2"\p"theURL2end2, &start2, &end2); 

i made a test and this work with ichat url and i thnk thiis should work with help url too..
Quote this message in a reply
Member
Posts: 233
Joined: 2003.05
Post: #6
Here's a tad more info on that:
http://developer.apple.com/qa/nw/nw60.html

Notably missing from Danlab's code is an ICStop call to free inst2.

Also, there is now a more direct and compliant way in Mac OS X using Launch Services:
http://developer.apple.com/documentation...index.html
It looks pretty straightforward, but I haven't taken the time to get something working. Anybody use Launch Services to launch a url from their app and have some sample code? (Apple has no example code for this.)

"Pay no attention to that man behind the curtain." - Wizard of Oz
Quote this message in a reply
Moderator
Posts: 613
Joined: 2004.09
Post: #7
Cocoa Launching a Website:

[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString:@"http://www.mysite.com"]];

Hope that helps with something =p
Quote this message in a reply
Post Reply