Sign in to follow this  
  • entries
    90
  • comments
    59
  • views
    42167

Mac Porting

Sign in to follow this  
diablo_tk

120 views



Well what can I say, the porting of FallenEngine is coming along better than what I thought. I have Images, Fonts and Sounds ported, though sounds are buggy and I'm still working on that. Next though will be Input and then thats it.

If you know a translation of GetAysncKey for mac please tell me, or for that matter if you know of any good tutorials on input for mac then I'd be most thankful if you could drop a comment.

For those interested here is the code for the screenshot above:

#include
#include
#include

using namespace Fallen::System;

int main()
{
CSystem::LoadModule();
CGraphics::LoadModule();
CAudio::LoadModule();

CSystem::SetInterface(CSystem::Interface_Carbon());
CGraphics::SetInterface(CGraphics::Interface_OpenGL());
CAudio::SetInterface(CAudio::Interface_irrKlang());

CGraphics::HandleMessages();
CSystem::HandleMessages();
CAudio::HandleMessages();

CGraphics::CreateContext("Fallen OpenGL Context on a Mac", 800, 600, 32, false);

CGraphics::SetClearColor(0, 10, 173);
CGraphics::SetMaskColor(255, 0, 255);
CGraphics::SetVSync(false);
CGraphics::SetHandle(0.0f, 0.0f);
CGraphics::SetBlend(ALPHA);

CImage * image = CGraphics::LoadImage("media/main-background.png", 800, 600);
CFont * font = CGraphics::LoadFont("media/42.ttf", 72);
CSound * sound = CAudio::LoadSound("bah.wav");


CGraphics::SetDrawFont(font);

CAudio::PlaySound(sound, true);

while(CSystem::Update() == true)
{

CGraphics::Cls();

CGraphics::DrawImage(image, 0, 0);

CGraphics::SetDrawColor(0, 0, 0);
CGraphics::SetDrawAlpha(200);
CGraphics::DrawText("Hello World", 100, 300);
CGraphics::SetDrawAlpha(255);
CGraphics::SetDrawColor(255, 255, 255);

CGraphics::Flip();
}

delete image;

delete font;

delete sound;

CGraphics::DestroyContext();

CSystem::UnloadModule();
CGraphics::UnloadModule();
CAudio::UnloadModule();

return 0;
}

Sign in to follow this  


2 Comments


Recommended Comments

You might want to look at this.

I assume you're using Carbon on the backend, so just use the Button(...) functions.

I'm glad it was so easy for you to port to OS X! It's really quite a nice OS.

Note that Apple has a bunch of refurbished Core Duo Mac Minis on their store website; they're not super-fast machines but they'll cut it for almost all 2D work for $450.

Share this comment


Link to comment
Quote:
Original post by Ravuya
You might want to look at this.

I assume you're using Carbon on the backend, so just use the Button(...) functions.

I'm glad it was so easy for you to port to OS X! It's really quite a nice OS.

Note that Apple has a bunch of refurbished Core Duo Mac Minis on their store website; they're not super-fast machines but they'll cut it for almost all 2D work for $450.


Thankyou for the link, I did a lot of google searching but couldn't find anything, and yes I am using carbon.

>Note that Apple has a bunch of refurbished Core Duo Mac Minis on their store website; they're not super-fast machines but they'll cut it for almost all 2D work for $450.
$450 is indeed cheap so it's something I'll definently look into.

Share this comment


Link to comment

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now