imrpoved UI system structure and added a basic text module for testing; Untested.
This commit is contained in:
45
RhythmBullet/Zer01HD/UI/Book/Book.cs
Normal file
45
RhythmBullet/Zer01HD/UI/Book/Book.cs
Normal file
@@ -0,0 +1,45 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.UI.Book
|
||||
{
|
||||
class Book
|
||||
{
|
||||
Viewport viewport;
|
||||
Dictionary<string, Page> pages = new Dictionary<string, Page>();
|
||||
public Book(Viewport viewport)
|
||||
{
|
||||
this.viewport = viewport;
|
||||
}
|
||||
|
||||
public void AddPage(Page page)
|
||||
{
|
||||
pages.Add(page.Name, page);
|
||||
}
|
||||
|
||||
public void RemovePage(Page page)
|
||||
{
|
||||
RemovePage(page.Name);
|
||||
}
|
||||
|
||||
public void RemovePage(string name)
|
||||
{
|
||||
pages.Remove(name);
|
||||
}
|
||||
|
||||
public void Resize(int width, int height)
|
||||
{
|
||||
viewport.Width = width;
|
||||
viewport.Height = height;
|
||||
}
|
||||
|
||||
public void DisplayPage(string name)
|
||||
{
|
||||
pages[name].DisplayWithViewport(viewport);
|
||||
}
|
||||
}
|
||||
}
|
36
RhythmBullet/Zer01HD/UI/Book/Page.cs
Normal file
36
RhythmBullet/Zer01HD/UI/Book/Page.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
using Microsoft.Xna.Framework.Graphics;
|
||||
using RhythmBullet.Zer01HD.UI.Modular;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace RhythmBullet.Zer01HD.UI.Book
|
||||
{
|
||||
class Page : ModuleGroup
|
||||
{
|
||||
private readonly int pageX, pageY;
|
||||
|
||||
public Page(int pageX, int pageY, int width, int height)
|
||||
{
|
||||
this.pageX = pageX;
|
||||
this.pageY = pageY;
|
||||
ApplySize(width, height);
|
||||
}
|
||||
|
||||
public virtual void ApplySize(int width, int height)
|
||||
{
|
||||
X = pageX * width;
|
||||
Y = pageY * height;
|
||||
this.Width = width;
|
||||
this.Height = height;
|
||||
}
|
||||
|
||||
public void DisplayWithViewport(Viewport viewport)
|
||||
{
|
||||
viewport.X = X;
|
||||
viewport.Y = Y;
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user