public ResourceFetcher( AsyncDownloader downloader ) { this.downloader = downloader; }
protected override void OnLoad( EventArgs e ) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api( this ); #endif try { Options.Load(); } catch( IOException ) { Utils.LogWarning( "Unable to load options.txt" ); } ViewDistance = Options.GetInt( "viewdist", 16, 8192, 512 ); Keys = new KeyMap(); InputHandler = new InputHandler( this ); Chat = new ChatLog( this ); Drawer2D = new GdiPlusDrawer2D( Graphics ); defaultIb = Graphics.MakeDefaultIb(); ModelCache = new ModelCache( this ); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader( skinServer ); Graphics.PrintGraphicsInfo(); TerrainAtlas1D = new TerrainAtlas1D( Graphics ); TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D ); Animations = new Animations( this ); TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract( defaultTexPack, this ); Inventory = new Inventory( this ); BlockInfo = new BlockInfo(); BlockInfo.Init(); BlockInfo.SetDefaultBlockPermissions( Inventory.CanPlace, Inventory.CanDelete ); Map = new Map( this ); LocalPlayer = new LocalPlayer( this ); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer( this ); MapEnvRenderer = new MapEnvRenderer( this ); EnvRenderer = new StandardEnvRenderer( this ); if( IPAddress == null ) { Network = new Singleplayer.SinglePlayerServer( this ); } else { Network = new NetworkProcessor( this ); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera( this ); thirdPersonCam = new ThirdPersonCamera( this ); Camera = firstPersonCam; CommandManager = new CommandManager(); CommandManager.Init( this ); SelectionManager = new SelectionManager( this ); ParticleManager = new ParticleManager( this ); WeatherRenderer = new WeatherRenderer( this ); WeatherRenderer.Init(); Graphics.SetVSync( this, true ); Graphics.DepthTest = true; Graphics.DepthTestFunc( CompareFunc.LessEqual ); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha ); Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f ); Title = Utils.AppName; fpsScreen = new FpsScreen( this ); fpsScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapEnvRenderer.Init(); Picking = new PickingRenderer( this ); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; SetNewScreen( new LoadingMapScreen( this, connectString, "Reticulating splines" ) ); Network.Connect( IPAddress, Port ); }
public void DownloadItems( AsyncDownloader downloader, Action<string> setStatus ) { this.downloader = downloader; DownloadMusicFiles(); digPatcher = new SoundPatcher( digSounds, "dig_", "step_cloth1" ); digPatcher.FetchFiles( digSoundsUri, altDigSoundsUri, this ); stepPatcher = new SoundPatcher( stepSounds, "step_", "classic jar" ); stepPatcher.FetchFiles( stepSoundsUri, altStepSoundsUri, this ); if( !defaultZipExists ) { downloader.DownloadData( jarClassicUri, false, "classic_jar" ); downloader.DownloadData( jar162Uri, false, "162_jar" ); downloader.DownloadData( pngTerrainPatchUri, false, "terrain_patch" ); downloader.DownloadData( pngGuiPatchUri, false, "gui_patch" ); } SetFirstStatus( setStatus ); }
public void DownloadItems( AsyncDownloader downloader, Action<string> setStatus ) { this.downloader = downloader; DownloadMusicFiles(); digPatcher = new SoundPatcher( ResourceList.DigSounds, "dig_", "step_cloth1" ); digPatcher.FetchFiles( digSoundsUri, altDigSoundsUri, this, DigSoundsExist ); stepPatcher = new SoundPatcher( ResourceList.StepSounds, "step_", "classic jar" ); stepPatcher.FetchFiles( stepSoundsUri, altStepSoundsUri, this, StepSoundsExist ); flags = 0; foreach( var entry in ResourceList.Files ) flags |= entry.Value; if( (flags & ResourceList.cMask) != 0 ) downloader.DownloadData( jarClassicUri, false, "classic_jar" ); if( (flags & ResourceList.mMask) != 0 ) downloader.DownloadData( jar162Uri, false, "162_jar" ); if( (flags & ResourceList.gMask) != 0 ) downloader.DownloadData( pngGuiPatchUri, false, "gui_patch" ); if( (flags & ResourceList.tMask) != 0 ) downloader.DownloadData( pngTerrainPatchUri, false, "terrain_patch" ); SetFirstStatus( setStatus ); }
protected override void OnLoad( EventArgs e ) { #if !USE_DX Graphics = new OpenGLApi(); #else Graphics = new Direct3D9Api( this ); #endif Graphics.MakeGraphicsInfo(); Options.Load(); ViewDistance = Options.GetInt( OptionsKey.ViewDist, 16, 4096, 512 ); InputHandler = new InputHandler( this ); Chat = new ChatLog( this ); Chat.FontSize = Options.GetInt( OptionsKey.FontSize, 6, 30, 12 ); defaultIb = Graphics.MakeDefaultIb(); MouseSensitivity = Options.GetInt( OptionsKey.Sensitivity, 1, 100, 30 ); BlockInfo = new BlockInfo(); BlockInfo.Init(); ChatLines = Options.GetInt( OptionsKey.ChatLines, 1, 30, 12 ); ModelCache = new ModelCache( this ); ModelCache.InitCache(); AsyncDownloader = new AsyncDownloader( skinServer ); Drawer2D = new GdiPlusDrawer2D( Graphics ); Drawer2D.UseBitmappedChat = !Options.GetBool( OptionsKey.ArialChatFont, false ); TerrainAtlas1D = new TerrainAtlas1D( Graphics ); TerrainAtlas = new TerrainAtlas2D( Graphics, Drawer2D ); Animations = new Animations( this ); TexturePackExtractor extractor = new TexturePackExtractor(); extractor.Extract( defaultTexPack, this ); Inventory = new Inventory( this ); BlockInfo.SetDefaultBlockPermissions( Inventory.CanPlace, Inventory.CanDelete ); Map = new Map( this ); LocalPlayer = new LocalPlayer( this ); LocalPlayer.SpeedMultiplier = Options.GetInt( OptionsKey.Speed, 1, 50, 10 ); Players[255] = LocalPlayer; width = Width; height = Height; MapRenderer = new MapRenderer( this ); MapEnvRenderer = new MapEnvRenderer( this ); EnvRenderer = new StandardEnvRenderer( this ); if( IPAddress == null ) { Network = new Singleplayer.SinglePlayerServer( this ); } else { Network = new NetworkProcessor( this ); } Graphics.LostContextFunction = Network.Tick; firstPersonCam = new FirstPersonCamera( this ); thirdPersonCam = new ThirdPersonCamera( this ); forwardThirdPersonCam = new ForwardThirdPersonCamera( this ); Camera = firstPersonCam; CommandManager = new CommandManager(); CommandManager.Init( this ); SelectionManager = new SelectionManager( this ); ParticleManager = new ParticleManager( this ); WeatherRenderer = new WeatherRenderer( this ); WeatherRenderer.Init(); bool vsync = Options.GetBool( OptionsKey.VSync, true ); Graphics.SetVSync( this, vsync ); Graphics.DepthTest = true; Graphics.DepthTestFunc( CompareFunc.LessEqual ); //Graphics.DepthWrite = true; Graphics.AlphaBlendFunc( BlendFunc.SourceAlpha, BlendFunc.InvSourceAlpha ); Graphics.AlphaTestFunc( CompareFunc.Greater, 0.5f ); fpsScreen = new FpsScreen( this ); fpsScreen.Init(); Culling = new FrustumCulling(); EnvRenderer.Init(); MapEnvRenderer.Init(); Picking = new PickingRenderer( this ); string connectString = "Connecting to " + IPAddress + ":" + Port + ".."; Graphics.WarnIfNecessary( Chat ); SetNewScreen( new LoadingMapScreen( this, connectString, "Reticulating splines" ) ); Network.Connect( IPAddress, Port ); }