/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { base.Initialize(); ScreenHeight = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Height; ScreenWidth = GraphicsAdapter.DefaultAdapter.CurrentDisplayMode.Width; graphics.PreferredBackBufferHeight = ScreenHeight; graphics.PreferredBackBufferWidth = ScreenWidth; graphics.IsFullScreen = true; graphics.ApplyChanges(); renderTarget = new RenderTarget2D( graphics.GraphicsDevice, Defaults.GraphicsWidth, Defaults.GraphicsHeight, false, graphics.GraphicsDevice.PresentationParameters.BackBufferFormat, DepthFormat.Depth24); var scaleX = (double)ScreenWidth / (double)Defaults.GraphicsWidth; var scaleY = (double)ScreenHeight / (double)Defaults.GraphicsHeight; // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new SpriteBatch(graphics.GraphicsDevice); Fade = new FadeTransition(Color.White, null); GamePlayScreen = new GamePlayScreen(scaleX, scaleY); GamePlayScreen.Reset(); currentBackground = new StarField(100); previousTouchCollection = TouchPanel.GetState(); }
public GeneralWorld(ICharacter character, GraphicsDevice gd, ICamera camera, Texture2D background, Texture2D foreground) { this.Character = character; this.Camera = camera; int platformLength = 200; int platformHeight = 50; this.Background = new Background(this, background); this.Foreground = new Foreground(this, foreground); this.Platforms = new List <Platform> { new Platform(gd.CreateMonoTexture(200, 50, new Color(199, 199, 199)), new Vector2(-10, 100)), new Platform(gd.CreateMonoTexture(200, 50, new Color(199, 199, 199)), new Vector2(300, 300)), new Platform(gd.CreateMonoTexture(200, 50, new Color(199, 199, 199)), new Vector2(600, 500)), new Platform(gd.CreateMonoTexture(1400, 50, new Color(199, 199, 199)), new Vector2(-20, 700)) }; Random rand = new Random(); for (int i = 0; i < 15000; i++) { this.Platforms.Add(new Platform(gd.CreateMonoTexture(platformLength, platformHeight, new Color(199, 199, 199)), new Vector2(rand.Next(-20000, 20000), rand.Next(-10000, 10000)))); } }
public OptionsMenuState(IBackground background, IStateOwner pOwner, GameState OriginalState, String pSettingsTitle, StandardSettings AlterSettingsSet) : base(background) { _OriginalState = OriginalState; _AlterSet = AlterSettingsSet; _SettingsTitle = pSettingsTitle; PopulateOptions(pOwner); }
public BackgroundRenderer(IBackground background) { _program = new ShaderProgram("Shaders/Background.vert", "Shaders/Background.frag"); _vao = new VAO(); var flatBuffer = new VBO(); using (Bind.These(_vao, flatBuffer)) { var data = new List <float>(); data.AddRange(new float[] { -1, -1 }); data.AddRange(background.BottomLeft.ToFloatArray()); data.AddRange(new float[] { 1, -1 }); data.AddRange(background.BottomRight.ToFloatArray()); data.AddRange(new float[] { 1, 1 }); data.AddRange(background.TopRight.ToFloatArray()); data.AddRange(new float[] { -1, 1 }); data.AddRange(background.TopLeft.ToFloatArray()); var flatData = data.ToArray(); flatBuffer.Update(flatData, flatData.Length * sizeof(float)); const int stride = sizeof(float) * 6; GL.EnableVertexAttribArray(0); GL.VertexAttribPointer(0, 2, VertexAttribPointerType.Float, false, stride, new IntPtr(0)); GL.EnableVertexAttribArray(1); GL.VertexAttribPointer(1, 4, VertexAttribPointerType.Float, false, stride, new IntPtr(sizeof(float) * 2)); } }
/// <summary> /// Occurs when this command is clicked /// </summary> public override void OnClick() { IActiveView pActiveView = (IActiveView)m_PageLayOutControl.PageLayout; IMap pMap = pActiveView.FocusMap; IGraphicsContainer pGraphicsContainer = (IGraphicsContainer)pActiveView; IMapFrame pMapFrame = (IMapFrame)pGraphicsContainer.FindFrame(pMap); IStyleSelector pStyleSelector = new BackgroundSelectorClass(); bool m_bOK = pStyleSelector.DoModal(m_PageLayOutControl.hWnd); if (!m_bOK) { return; } IBackground pBackground = (IBackground)pStyleSelector.GetStyle(0); pMapFrame.Background = pBackground; m_PageLayOutControl.Refresh(esriViewDrawPhase.esriViewBackground, null, null); }
public MarioFinish(Mario mario, Game1 game, IBackground flag) : base(mario.Position, mario.Velocity, mario.Acceleration) { this.mario = mario; mario.Position = new Vector2(flag.Position.X + 2.5f, mario.Position.Y); Collision = new FinishCollision(); Movement = new FinishMovement(game); this.game = game; mario.UpReleased(); mario.Right(); if (mario.State.Name == "Big") { mario.State = new BigOnFlagState(mario); } else if (mario.State.Name == "Fire") { mario.State = new FireOnFlagState(mario); } else if (mario.State.Name == "Small") { mario.State = new SmallOnFlagState(mario); } foreach (IBackground ib in game.WorldLoader.Background) { if (ib is ToadCastle) { castle = (ToadCastle)ib; break; } } }
//First Draw cycle of a Field calls this method void BeforeFirstDraw() { Log.i(this, "BeforeFirstDraw has started"); //Instance of a background image Log.i(this, "Creating instance of background image"); BackgroundImage = new GameRoundBackground(this); //Loading player ad-hoc Player = new Hero(); Player.X = (float)Size.Width / 2 - (float)Player.Width / 2; Player.Y = (float)Size.Height / 2 - (float)Player.Height / 2; //Creating a Level new Level1().AddToField(this); //Also objects ad-hoc //ICharacter doomday = new Doomday(Player); //doomday.X = 600; //doomday.Y = 400; //AddActor(doomday); //The game-flow starts running after the map is loaded with all characters GameRunning = true; //Resetting user input for avoiding possible start glitches that would require user to alt+tab for a hotfix instead ResetUserInput(); Log.i(this, "BeforeFirstDraw has ended"); }
public SurfaceRenderer(IBackground _background, ILight _light, ISurface _function, DirectBitmap _bumpMap = null) { Background = _background; Light = _light; Function = _function; BumpMap = _bumpMap; }
protected override void LoadContent() { gameWindowBounds = new Vector2(wWidth, wHeight); shipSprite = new BaseShip(shipSprite_movement_speed, 0, gameWindowBounds, startPos, startPos); background = new Background(bgScroll_speed, startPos, gameWindowBounds); // Create a new SpriteBatch, which can be used to draw textures. _spriteBatch = new SpriteBatch(GraphicsDevice); mainFont = Content.Load <SpriteFont>("mainAIfont"); largerMfont = Content.Load <SpriteFont>("largermainAIfont"); // TODO: use this.Content to load your game content here shipSprite.Texture = Content.Load <Texture2D>("triangleShip"); background.Texture = Content.Load <Texture2D>("Bg"); var bricks = Content.Load <Texture2D>("brick"); background2 = background.Clone(); background2.CurrPos = new Vector2(0, -background.Texture.Height); Obstacle Obs = new Obstacle(bricks, gameWindowBounds, obstacles_movement_speed); obstacleGenerator = new ObstacleGenerator(bricks, gameWindowBounds, Obs, obstacles_movement_speed, levelTimerDelay); projectileGenerator = new ProjectileGenerator(Content.Load <Texture2D>("bullet1")); ProjectileGenerator.MoveSpeed = ProjectileMoveSpeed; ProjectileGenerator.fireDelay = fireDelay; ProjectileGenerator.fireLimit = projectilLimit; projectileCollisionTracker = new CollisionTracker(); ObstacleGenerator.ObjPerLevel = objPerLevel; }
public ViewScoreDetailsState(ShowHighScoresState pOwner, IHighScoreEntry pShowEntry, IBackground useBG, int DetailPosition) { _Position = DetailPosition; _BG = useBG; //so it is the same as the "main" show score state and looks "seamless". _Owner = pOwner; ShowEntry = pShowEntry; }
private void btnBackgroundSelector_Click(object sender, EventArgs e) { try { frmSymbolSelector selector = new frmSymbolSelector(); if (selector != null) { selector.SetStyleGallery(this.istyleGallery_0); if (this.ibackground_0 != null) { selector.SetSymbol(this.ibackground_0); } else { selector.SetSymbol(new SymbolBackgroundClass()); } if (selector.ShowDialog() == DialogResult.OK) { this.bool_0 = false; this.ibackground_0 = selector.GetSymbol() as IBackground; this.method_3(); IStyleGalleryItem styleGalleryItemAt = this.cboBackground.GetStyleGalleryItemAt(this.cboBackground.Items.Count - 1); if (styleGalleryItemAt != null) { if (styleGalleryItemAt.Name == "<定制>") { styleGalleryItemAt.Item = this.ibackground_0; } else { styleGalleryItemAt = new MyStyleGalleryItem { Name = "<定制>", Item = this.ibackground_0 }; this.cboBackground.Add(styleGalleryItemAt); this.cboBackground.SelectedIndex = this.cboBackground.Items.Count - 1; } } else { styleGalleryItemAt = new MyStyleGalleryItem { Name = "<定制>", Item = this.ibackground_0 }; this.cboBackground.Add(styleGalleryItemAt); this.cboBackground.SelectedIndex = this.cboBackground.Items.Count - 1; } this.bool_0 = true; this.method_0(); } } } catch { } }
public UniFeedConsumer(IOptions <UniFeederOption> option, IOptions <TwsOption> twsOption, IBackground <Quote> queue, ILoggerFactory loggerFactory) { this.option = option; this.queue = queue; this.clients = new ConcurrentDictionary <int, IRxSocketClient>(); this.quotes = new ConcurrentBag <UniFeederQuote>(option.Value.TranslatesToUniFeederQuotes(twsOption.Value)); logger = loggerFactory.CreateLogger <UniFeedConsumer>(); }
public override bool CanStep(IBackground back) { if (back is WaterBackground) { return(true); } return(base.CanStep(back)); }
public GeneratorBackground(IBackground background) { Name = background.Name; XamlName = background.XamlName; Lines = background.Lines; GeneratorBackgroundMap.Add(background, this); }
public Level(IEntityManager entityManager, IBackground background) { _entityManager = entityManager; _background = background; _entities = new List <Entity>(); Loaded = false; LoadingTime = 5f; }
public SDLighting(IBackground background, Color ambientColor, float ambientStrength, params ILight[] lights) { AmbientColor = ambientColor; AmbientStrength = ambientStrength; Background = background; Lights = new List <ILight>(lights); }
public TwsProducer(IOptions <TwsOption> option, IBackground <Quote> queue, IBackground <string> state, ILoggerFactory loggerFactory) { this.option = option.Value; this.subscription = new SubscriptionDictionary(); this.queue = queue; this.state = state; this.loggerFactory = loggerFactory; this.logger = loggerFactory.CreateLogger <TwsProducer>(); }
//! [socket_declare] //! [socket_init] public EWrapperImpl(SubscriptionDictionary subscription, IBackground <Quote> queue, IBackground <string> state, ILoggerFactory loggerFactory) { this.subscription = subscription; this.logger = loggerFactory.CreateLogger <EWrapperImpl>(); this.signal = new EReaderMonitorSignal(); this.clientSocket = new EClientSocket(this, signal); this.queue = queue; this.state = state; this.quotes = new ConcurrentDictionary <string, Quote>(); }
public VirtualDesktop(Guid guid, uint index, ISystemDesktop systemDesktop) { Guid = guid; Index = index; _background = systemDesktop.Background; _systemDesktop = systemDesktop; systemDesktop.PropertyChanged += SystemDesktop_PropertyChanged; _isCurrent = Equals(guid, systemDesktop.Guid); }
//First Draw cycle of a Field calls this method void BeforeFirstDraw() { Log.i(this, "Operation before first draw started"); //Creating Background instance BackgroundImage = new MainMenuBackground(this); //Initializing object for displaying current status of Background Tasks BackgroundTaskStatus = new BackgroundTaskStatus(10, 5); Log.i(this, "Operation before first draw finished"); }
public LevelManager(ContentManager content, IBlockDefinitionBuilder blockDefinitionBuilder, ILevelReader levelReader, IPropertiesReader propertiesReader, IBackground background, LevelName levelName = LevelName.Level2) { LevelManager.content = content; LevelManager.blockDefinitionBuilder = blockDefinitionBuilder; LevelManager.levelReader = levelReader; LevelManager.propertiesReader = propertiesReader; LevelManager.background = background; SetLevel(levelName); InitializeContent(); }
private void btnBackgroundInfo_Click(object sender, EventArgs e) { IStyleGalleryItem selectStyleGalleryItem = this.cboBackground.GetSelectStyleGalleryItem(); IBackground item = null; if (selectStyleGalleryItem != null) { item = selectStyleGalleryItem.Item as IBackground; } if (item != null) { frmElementProperty property = new frmElementProperty(); BackgroundSymbolPropertyPage page = new BackgroundSymbolPropertyPage(); property.AddPage(page); if (property.EditProperties(item)) { this.bool_0 = false; selectStyleGalleryItem = this.cboBorder.GetStyleGalleryItemAt(this.cboBorder.Items.Count - 1); if (selectStyleGalleryItem != null) { if (selectStyleGalleryItem.Name == "<定制>") { selectStyleGalleryItem.Item = item; } else { selectStyleGalleryItem = new MyStyleGalleryItem { Name = "<定制>", Item = item }; this.cboBackground.Add(selectStyleGalleryItem); this.cboBackground.SelectedIndex = this.cboBackground.Items.Count - 1; } } else { selectStyleGalleryItem = new MyStyleGalleryItem { Name = "<定制>", Item = item }; this.cboBackground.Add(selectStyleGalleryItem); this.cboBackground.SelectedIndex = this.cboBackground.Items.Count - 1; } this.bool_0 = true; } } }
public static string MapBackground(IBackground bg) { if (bg != null) { if (bg.GetType() == typeof(ImageBackground)) { return(((ImageBackground)bg).ImagePath); } if (bg.GetType() == typeof(ColorBackground)) { return(ConvertColor(((ColorBackground)bg).Color).ToString()); } } return(null); }
public Image GetImage(IBackground bg) { if (bg != null) { if (bg.GetType() == typeof(ImageBackground)) { return(GetImage(((ImageBackground)bg).ImagePath)); } if (bg.GetType() == typeof(ColorBackground)) { return(ImageUtils.GetEmptyImage(DefaultImageSize, ((ColorBackground)bg).Color)); } } return(null); }
public void SaveBackground(IBackground background) { lock (_ioLock) { try { var result = _desktop.SetWallpaper(null, background.Path); result = _desktop.SetPosition(background.Fit.ToPosition()); } catch (Exception ex) { Debug.WriteLine(ex); } } }
public void SetObjects(object object_0) { this.iframeElement_0 = object_0 as IFrameElement; if (this.iframeElement_0.Border != null) { this.iborder_0 = (this.iframeElement_0.Border as IClone).Clone() as IBorder; } if (this.iframeElement_0.Background != null) { this.ibackground_0 = (this.iframeElement_0.Background as IClone).Clone() as IBackground; } if ((this.iframeElement_0 as IFrameProperties).Shadow != null) { this.ishadow_0 = ((this.iframeElement_0 as IFrameProperties).Shadow as IClone).Clone() as IShadow; } }
public void SetBackground(string value) { if (String.IsNullOrEmpty(value)) { return; } try { var backgroundTypes = typeof(CharacterBackgrounds); var background = (IBackground)backgroundTypes.GetField(value).GetValue(null); Background = background; BackgroundAbilityChoice = background.AbilityBoostOptions.First(); } catch (Exception e) { throw new Exception($"Check to make sure {value} exists in the CharacterBackgrounds.cs file. Could not assign {value} as an Background. Invalid Background name or String. {e.Message}"); } }
public Image GetThumb(IBackground bg) { if (bg != null) { if (bg.GetType() == typeof(ImageBackground)) { var img = GetThumbFromRelPath(((ImageBackground)bg).ImagePath); if (img != null) { return(img); } } else if (bg.GetType() == typeof(ColorBackground)) { return(ImageUtils.GetEmptyImage(DefaultThumbSize, ((ColorBackground)bg).Color)); } } return(ImageUtils.GetEmptyImage(DefaultThumbSize, DefaultEmptyColor)); }
private void cboBackground_SelectedIndexChanged(object sender, EventArgs e) { if (this.bool_0) { IStyleGalleryItem selectStyleGalleryItem = this.cboBackground.GetSelectStyleGalleryItem(); if (selectStyleGalleryItem == null) { this.ibackground_0 = null; } else { this.ibackground_0 = (selectStyleGalleryItem.Item as IClone).Clone() as IBackground; } this.bool_0 = false; this.method_3(); this.bool_0 = true; this.method_0(); } }
protected Image PreviewSlide(Song sng, string currentText, string currentTranslationText) { SongSlide slide = (SongSlide)sng.Parts[CurrentPartId].Slides[CurrentSlideId].Clone(); slide.Text = currentText; slide.TranslationText = currentTranslationText; SlideTextFormatting slideFormatting = new SlideTextFormatting(); PreviewFormattingMapper.Map(sng, ref slideFormatting); // Disabled for performance slideFormatting.OutlineEnabled = false; slideFormatting.SmoothShadow = false; slideFormatting.ScaleFontSize = Settings.ProjectionFontScaling; slideFormatting.SmoothShadow = false; TextLayer sl = new TextLayer(slideFormatting) { MainText = slide.Lines.ToArray(), SubText = slide.Translation.ToArray() }; sl.DrawBordersForDebugging = Settings.Default.DebugMode; ImageLayer il = new ImageLayer(Settings.ProjectionBackColor); IBackground bg = sng.Parts[CurrentPartId].Slides[CurrentSlideId].Background; il.Image = ImgManager.GetImage(bg); var bmp = new Bitmap(1024, 768); Graphics gr = Graphics.FromImage(bmp); gr.CompositingQuality = CompositingQuality.HighSpeed; gr.SmoothingMode = SmoothingMode.HighSpeed; il.WriteOut(gr, null); sl.WriteOut(gr, null); return(bmp); }
public void TestSetup() { abstractModel = BackgroundFactory.CreateExport().Value; model = abstractModel as BackgroundModel; }
public void SetBackground(/* final */ IBackground pBackground) { this.mBackground = pBackground; }