Inheritance: System.Windows.Forms.ApplicationContext, IGame
Exemplo n.º 1
0
 public frmMainGame(Game game)
 {
     _game = game;
     InitializeComponent();
     _viewPort = new ViewportControl(this, _game);
     _viewPort.Dock = DockStyle.Fill;
     this.Controls.Add(_viewPort);
     this.Load += frmMainGame_Load;
 }
Exemplo n.º 2
0
        public ViewportControl(NomadForm mainForm, Game game)
        {
            MainForm = mainForm;
            Game = game;
            this.InitializeComponent();
            this.BackColor = SystemColors.AppWorkspace;
            base.MouseWheel += new MouseEventHandler(this.ViewportControl_MouseWheel);

            //TODO: Fix Invisible Cursor
            //this.m_invisibleCursor = new Cursor(new MemoryStream(FC3.Properties.Resources.invisible_cursor));
            this.m_invisibleCursor = Cursors.Hand;
        }
Exemplo n.º 3
0
        public bool Init(Game game)
        {
            Log.log("Init Game");

            InitInternal();
            string[] commandLineArgs = Environment.GetCommandLineArgs();
            string text = " -editorpc -language=";
            string language = GetLanguage();
            if (language.Length == 0)
            {
                ResourceManager resourceManager = new ResourceManager("FC3.Properties.Resources", Assembly.GetExecutingAssembly());
                string @string = resourceManager.GetString("IDS_ERR_MISSING_REGISTRY_KEY");
                Log.error(@string, "Far Cry 3 Map Editor");
                return false;
            }
            text += language;
            int num = 1;
            if (EngineUtils.GetMapArgument() != null)
            {
                num = 2;
            }

            Log.log("Init DuniaEngine");
            if (!Binding.InitDuniaEngine(Process.GetCurrentProcess().MainModule.BaseAddress, game.MainForm.Handle, game.MainForm.Viewport.Handle, string.Join(" ", commandLineArgs, num, commandLineArgs.Length - num) + text, true, true, m_delegateMessagePumpCallback))
            {
                return false;
            }
            // TODO:Pretty Slow do we need?
            //foreach (ProcessModule processModule in Process.GetCurrentProcess().Modules)
            //{
            //	if (processModule.ModuleName.StartsWith("Nomad") || processModule.ModuleName.StartsWith("InGameEditor"))
            //	{
            //		Binding.FCE_Hack_Init(processModule.BaseAddress);
            //	}
            //}

            Log.log("Acquiring Input");
            Binding.FCE_Engine_AutoAcquireInput(true);
            //Editor.Init(); // TODO:Editor Init ? Hooks?
            game.Initialise();

            Binding.FCE_Engine_Reset(game.MainForm.Handle, game.MainForm.Viewport.Handle, m_delegateMessagePumpCallback);
            if (!Directory.Exists(PersonalPath))
            {
                Directory.CreateDirectory(PersonalPath);
            }
            m_initialized = true;
            return true;
        }