using Microsoft.Xna.Framework; using Microsoft.Xna.Framework.Graphics; using Microsoft.Xna.Framework.Input; using RecrownedAthenaeum.Render; using RecrownedAthenaeum.ScreenSystem; using RecrownedAthenaeum.SpecialTypes; using RecrownedAthenaeum.UI.Modular.Modules; using RecrownedAthenaeum.UI.SkinSystem; using RecrownedAthenaeum.UI.SkinSystem.Definitions; namespace TestGame { /// /// This is the main type for your game. /// public class TestGame : Game { GraphicsDeviceManager graphics; ConsistentSpriteBatch spriteBatch; Camera2D camera; BasicEffect effect; UIScrollable uIScrollable; Texture2D logo; Image logoImage; Skin skin; public TestGame() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; } /// /// 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. /// protected override void Initialize() { // TODO: Add your initialization logic here IsMouseVisible = true; base.Initialize(); } /// /// LoadContent will be called once per game and is the place to load /// all of your content. /// protected override void LoadContent() { // Create a new SpriteBatch, which can be used to draw textures. spriteBatch = new ConsistentSpriteBatch(GraphicsDevice); effect = new BasicEffect(GraphicsDevice); effect.TextureEnabled = true; effect.VertexColorEnabled = true; camera = new Camera2D(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight, effect); skin = new Skin(Content.Load("UI"), Content.Load("cursor")); skin.AddDefinition(new UIScrollableSkinDefinition("ScrollBar", "ScrollBar")); logo = Content.Load("RhythmBullet"); skin.Laminate(); uIScrollable = new UIScrollable(skin); uIScrollable.Width = 256; uIScrollable.Height = 256; uIScrollable.HideScrollBars = true; logoImage = new Image(logo); uIScrollable.AddModules(logoImage); // TODO: use this.Content to load your game content here } /// /// UnloadContent will be called once per game and is the place to unload /// game-specific content. /// protected override void UnloadContent() { // TODO: Unload any non ContentManager content here } /// /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// /// Provides a snapshot of timing values. protected override void Update(GameTime gameTime) { if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed || Keyboard.GetState().IsKeyDown(Keys.Escape)) Exit(); uIScrollable.Update(gameTime); // TODO: Add your update logic here base.Update(gameTime); } /// /// This is called when the game should draw itself. /// /// Provides a snapshot of timing values. protected override void Draw(GameTime gameTime) { spriteBatch.effect = effect; GraphicsDevice.Clear(Color.CornflowerBlue); spriteBatch.Begin(effect: effect); Rectangle smallRect = new Rectangle(0, 0, 64, 64); uIScrollable.Draw(spriteBatch); Rectangle normal = new Rectangle(0, 0, 128, 128); spriteBatch.End(); base.Draw(gameTime); } } }