Game Won't Run On Macs or Vista

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
knicholes
Posts: 14
Joined: Sat Aug 30, 2008 8:21 pm

Game Won't Run On Macs or Vista

Post by knicholes »

Hey, I wrote this 8puzzle game that works just fine on my PC but and it won't run on macs. Can anyone tell me what I can do to get it to work? My friends say they run the executable and then nothing happens. I compiled with MinGW gcc.

Here's just the beginning of my code. Maybe it has something to do with using "int"?

[Please use the code tag - Rogerborg]

Code: Select all

#include <iostream>
#include "Tile.h"
//#include "Board.h"
#include <conio.h>
#include <irrlicht.h>
#include <irrKlang.h>
using namespace irrklang;
using namespace irr;
using namespace scene;
using namespace video;
using namespace io;
using namespace gui;
using namespace core;
using namespace std;

//int ROWSIZE = 3;
//int COLSIZE = 3;
enum {UP, DOWN, LEFT, RIGHT};
int swap(int);
Tile* getBlank();
int checkForWin();
u32 MAXTIME = 50000;
u32 WAITTIME = 80;
u32 MAXMOVES = 3000;
void wait();

class MyEventReceiver : public IEventReceiver
{
public:
        // This is the one method that we have to implement
        virtual bool OnEvent(const SEvent& event)
        {
                // Remember whether each key is down or up
                if (event.EventType == irr::EET_KEY_INPUT_EVENT)
                        KeyIsDown[event.KeyInput.Key] = event.KeyInput.PressedDown;
				//if (event.EventType == irr: EET_MOUSE_INPUT_EVENT)
				 return false;
        }

        // This is used to check whether a key is being held down
        virtual bool IsKeyDown(EKEY_CODE keyCode) const
        {
                return KeyIsDown[keyCode];
        }

        MyEventReceiver()
        {
                for (u32 i=0; i<KEY_KEY_CODES_COUNT; ++i)
                        KeyIsDown[i] = false;
        }

private:
        // We use this array to store the current state of each key
        bool KeyIsDown[KEY_KEY_CODES_COUNT];
};


int ROWSIZE = 3;
int COLSIZE = 3;
Tile* slots[3][3];
Tile* current;
int main()
{
        // let user select driver type
		
		
        video::E_DRIVER_TYPE driverType = video::EDT_DIRECT3D9;

        printf("Please select the driver you want for this example:\n"\
                " (a) Direct3D 9.0c\n (b) Direct3D 8.1\n (c) OpenGL 1.5\n"\
                " (d) Software Renderer\n (e) Burning's Software Renderer\n"\
                " (f) NullDevice\n (otherKey) exit\n\n");

        char i;
        std::cin >> i;

        switch(i)
        {
                case 'a': driverType = video::EDT_DIRECT3D9;break;
                case 'b': driverType = video::EDT_DIRECT3D8;break;
                case 'c': driverType = video::EDT_OPENGL;   break;
                case 'd': driverType = video::EDT_SOFTWARE; break;
                case 'e': driverType = video::EDT_BURNINGSVIDEO;break;
                case 'f': driverType = video::EDT_NULL;     break;
                default: return 0;
        }       

        // create device
        int userTime;
		cout << "How much time do you want? (in seconds)"<<endl;
		cin >> userTime;
		MAXTIME = userTime*1000;
		cout << "How many moves do you want?"<<endl;
		cin >> MAXMOVES;

..................
Ion Dune
Posts: 453
Joined: Mon Nov 12, 2007 8:29 pm
Location: California, USA
Contact:

Post by Ion Dune »

What do you mean? You mean you compiled a win32 exe and it won't run on a mac? Or do you mean that this code won't compile on a mac? If so, what are the errors?

Also, I highly doubt it's because you're using "int" :lol:
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

You have to compile it on the mac, you can't compile it on a PC, transfer over the .exe and run it. It has to be .app.
Last edited by twilight17 on Mon Dec 15, 2008 5:02 am, edited 1 time in total.
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
knicholes
Posts: 14
Joined: Sat Aug 30, 2008 8:21 pm

Post by knicholes »

So wait, if I just install MinGW on a Mac or a Vista machine and compile the very same source code I used on my XP machine, it will create an executable (or mac executable equivalent) that will work properly on similar machines? I don't have to do anything special with the compiler or with the programming language? (variable types)

I'm using the GCC libraries, .a files, for irrKlang and irrlicht. This makes a difference somehow, right?
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

An int is an int across all compilers.
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
SwitchCase
Posts: 170
Joined: Sun Jul 01, 2007 11:41 pm
Location: Manchester, UK

Post by SwitchCase »

twilight17 wrote:An int is an int across all compilers.
Not true. C++ standards do not actually clarify the size in bytes of defined types. Differing compilers and systems may use different definitions of the same types. That's why Irrlicht defines it's own types, abstracting type differences over different systems/environments.
twilight17
Posts: 362
Joined: Sun Dec 16, 2007 9:25 pm

Post by twilight17 »

In general use, an int is an int across all compilers. :lol: (They'll do the same thing)

For the sake of this thread:

@knicholes:
First question: yeah
Second question: usually you don't (unless you used platform specific code)
Third question: It's all good. :P
Post this userbar I made on other websites to show your support for Irrlicht!
Image
http://img147.imageshack.us/img147/1261 ... wernq4.png
bitplane
Admin
Posts: 3204
Joined: Mon Mar 28, 2005 3:45 am
Location: England
Contact:

Post by bitplane »

Since we don't provide a Makefile for OSX yet, it's easiest to just open the XCode project (in /source/Irrlicht/MacOSX/) and add your project to this. My first test worked with minimal adjustments to the game source (I moved the resources to inside the .app dir).
The only real problem I had was getting shift and ctrl key events working (Varmint provided some code which will be committed to the 1.5 branch before the official OSX 1.5 binary release).
Submit bugs/patches to the tracker!
Need help right now? Visit the chat room
Post Reply