protected override void LoadContent() { Camera.Scale = 0.7f; TesteMapa = new Map(); TesteMapa.Load(Content); TesteMapa.InitRectMap(); spriteBatch = new SpriteBatch(GraphicsDevice); MIRA = new Crosshair(); MIRA.Load(Content); CharactersHandler.InitList(Content); Player1 = CharactersHandler.getCharacter(0); Player1.SetCharacterInPlay(); Player2 = CharactersHandler.getCharacter(1); Player1.SetCharacterPosition(new Vector2(600, 350)); Player1.Load(Content); Collisions.characterCollisions.Add(Player1); Player2.SetCharacterPosition(new Vector2(700, 350)); Player2.Load(Content); Collisions.characterCollisions.Add(Player2); CharactersHandler.AddPlayer(Player1); CharactersHandler.AddPlayer(Player2); }
public void Init(string url, string mime_type) { Console.WriteLine("LOAD <" + BaseMIME + "> " + BaseURL); this.time_at_init = DateTime.Now; Console.Title = AppInfo; int[] t = new int[2]; GL.GetInteger(GetPName.MajorVersion, out t[0]); GL.GetInteger(GetPName.MinorVersion, out t[1]); Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("OpenGL Version " + t[0] + "." + t[1]); //ShowSupportMatrix(); #if GAME_INIT_MODE && FULLSCREEN window.WindowState = WindowState.Minimized; ConsoleVisibility = true; #endif // INITILISE SCENE GL.Disable(EnableCap.Normalize); GL.ClearColor(ClearColor.X, ClearColor.Y, ClearColor.Z, ClearColor.W); GL.ClearDepth(1.0f); // Depth Buffer Setup GL.Enable(EnableCap.DepthTest); // Enables Depth Testing GL.DepthFunc(DepthFunction.Lequal); // The Type Of Depth Testing To Do //GL.Enable(EnableCap.CullFace); // causes bugs if enabled i.e. nehe10 wont render properly GL.Hint(HintTarget.PerspectiveCorrectionHint, HintMode.Nicest); // Really Nice Perspective Calculations DateTime time_before = DateTime.Now; if (!string.IsNullOrEmpty(url) && !string.IsNullOrEmpty(mime_type)) { View view = View.CreateViewFromWindow(this.window); Viewpoint.ViewpointList.Clear(); SceneManager.BaseURL = BaseURL; SceneManager.BaseMIME = SceneManager.GetMIMEType(BaseMIME); if (_cachedGraph != null) { scene = SceneManager.fromSceneGraph(_cachedGraph); } else { scene = SceneManager.fromURL(url, mime_type); } X3DGraphDebugger.UpdateSceneGraph(scene.SceneGraph); Viewpoint.Initilize(ActiveCamera, view); if (showCrosshair) { //Set crosshair _crosshair = new Crosshair(); _crosshair.Load(); } } Console.ForegroundColor = ConsoleColor.Cyan; Console.WriteLine("loading time: " + DateTime.Now.Subtract(time_before).TotalMilliseconds.ToString() + "ms"); Console.ForegroundColor = ConsoleColor.Yellow; #if GAME_INIT_MODE && FULLSCREEN Console.ForegroundColor = ConsoleColor.DarkGreen; Console.WriteLine("Sleeping for 5 secs so you can read me"); Console.ForegroundColor = ConsoleColor.DarkCyan; System.Threading.Thread.Sleep(5000); window.WindowState = WindowState.Fullscreen; #elif FULLSCREEN window.WindowState = WindowState.Fullscreen; #endif }