Implemented NewMenuScreen. Added support for GaussuanBlur effect for future use.

This commit is contained in:
CaptainSegis 2017-03-23 01:58:56 -05:00
parent 0f839cce23
commit 327d7ad292
8 changed files with 685 additions and 4 deletions

@ -1586,6 +1586,7 @@
<Compile Include="Resources\FontContainer.vb" />
<Compile Include="Resources\FontManager.vb" />
<Compile Include="Resources\GameModeManager.vb" />
<Compile Include="Resources\GaussianBlur.vb" />
<Compile Include="Resources\ModelManager.vb" />
<Compile Include="Resources\Models\2D\BillModel.vb" />
<Compile Include="Resources\Models\2D\CrossModel.vb" />
@ -1639,6 +1640,7 @@
<Compile Include="Screens\MapPreview\MapPreviewCamera.vb" />
<Compile Include="Screens\MapPreview\MapPreviewScreen.vb" />
<Compile Include="Screens\MapScreen.vb" />
<Compile Include="Screens\NewMenuScreen.vb" />
<Compile Include="Screens\MenuScreen.vb" />
<Compile Include="Screens\NewGameScreen.vb" />
<Compile Include="Screens\OptionScreen.vb" />

@ -201,7 +201,7 @@ Public Class OverworldScreen
Level.RouteSign.Hide()
SoundManager.PlaySound("menu_open")
Core.SetScreen(New MenuScreen(Me))
Core.SetScreen(New NewMenuScreen(Me))
End If
End If

@ -0,0 +1,309 @@
Imports Microsoft.Xna.Framework
Namespace Resources
''' <summary>
''' A class to apply the gaussian effect to a texture.
''' </summary>
Class GaussianEffect
Private Const BLUR_RADIUS As Integer = 7
Private Const BLUR_AMOUNT As Single = 2.0F
Private _spriteBatch As SpriteBatch
Private _blurCore As GaussianBlur
Private _rt1, _rt2 As RenderTarget2D
Private _width, _height As Integer
''' <summary>
''' Creates a new instance of the effect handler class and sets its intended dimensions.
''' </summary>
Public Sub New(ByVal width As Integer, ByVal height As Integer)
_spriteBatch = New SpriteBatch(GraphicsDevice)
_blurCore = New GaussianBlur(Core.GameInstance)
_blurCore.ComputeKernel(BLUR_RADIUS, BLUR_AMOUNT)
UpdateDimensions(width, height)
End Sub
Private Sub UpdateDimensions(ByVal width As Integer, ByVal height As Integer)
_width = width
_height = height
Dim targetWidth As Integer = CInt(width / 2)
Dim targetHeight As Integer = CInt(height / 2)
_rt1 = New RenderTarget2D(GraphicsDevice,
targetWidth, targetHeight)
_rt2 = New RenderTarget2D(GraphicsDevice,
targetWidth, targetHeight)
_blurCore.ComputeOffsets(targetWidth, targetHeight)
End Sub
''' <summary>
''' Performs the effect on a texture.
''' </summary>
Public Function Perform(ByVal texture As Texture2D) As Texture2D
If texture.Width <> _width Or texture.Height <> _height Then
'fuk OpenTK
''UpdateDimensions(texture.Width, texture.Height)
End If
Return _blurCore.PerformGaussianBlur(texture, _rt1, _rt2, _spriteBatch)
End Function
Private Class GaussianBlur
'-----------------------------------------------------------------------------
' Copyright (c) 2008-2011 dhpoware. All Rights Reserved.
'
' Permission is hereby granted, free of charge, to any person obtaining a
' copy of this software and associated documentation files (the "Software"),
' to deal in the Software without restriction, including without limitation
' the rights to use, copy, modify, merge, publish, distribute, sublicense,
' and/or sell copies of the Software, and to permit persons to whom the
' Software is furnished to do so, subject to the following conditions:
'
' The above copyright notice and this permission notice shall be included in
' all copies or substantial portions of the Software.
'
' THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
' OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
' FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
' AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
' LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
' FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
' IN THE SOFTWARE.
'-----------------------------------------------------------------------------
' Converted to VB.Net by nilllzz (C) 20XX scrollupabuildingandrevealmenu.
'-----------------------------------------------------------------------------
Private game As Microsoft.Xna.Framework.Game
Private effect As Effect
Private m_radius As Integer
Private m_amount As Single
Private m_sigma As Single
Private m_kernel As Single()
Private offsetsHoriz As Vector2()
Private offsetsVert As Vector2()
''' <summary>
''' Returns the radius of the Gaussian blur filter kernel in pixels.
''' </summary>
Public ReadOnly Property Radius() As Integer
Get
Return m_radius
End Get
End Property
''' <summary>
''' Returns the blur amount. This value is used to calculate the
''' Gaussian blur filter kernel's sigma value. Good values for this
''' property are 2 and 3. 2 will give a more blurred result whilst 3
''' will give a less blurred result with sharper details.
''' </summary>
Public ReadOnly Property Amount() As Single
Get
Return m_amount
End Get
End Property
''' <summary>
''' Returns the Gaussian blur filter's standard deviation.
''' </summary>
Public ReadOnly Property Sigma() As Single
Get
Return m_sigma
End Get
End Property
''' <summary>
''' Returns the Gaussian blur filter kernel matrix. Note that the
''' kernel returned is for a 1D Gaussian blur filter kernel matrix
''' intended to be used in a two pass Gaussian blur operation.
''' </summary>
Public ReadOnly Property Kernel() As Single()
Get
Return m_kernel
End Get
End Property
''' <summary>
''' Returns the texture offsets used for the horizontal Gaussian blur
''' pass.
''' </summary>
Public ReadOnly Property TextureOffsetsX() As Vector2()
Get
Return offsetsHoriz
End Get
End Property
''' <summary>
''' Returns the texture offsets used for the vertical Gaussian blur
''' pass.
''' </summary>
Public ReadOnly Property TextureOffsetsY() As Vector2()
Get
Return offsetsVert
End Get
End Property
''' <summary>
''' Default constructor for the GaussianBlur class. This constructor
''' should be called if you don't want the GaussianBlur class to use
''' its GaussianBlur.fx effect file to perform the two pass Gaussian
''' blur operation.
''' </summary>
Public Sub New()
End Sub
''' <summary>
''' This overloaded constructor instructs the GaussianBlur class to
''' load and use its GaussianBlur.fx effect file that implements the
''' two pass Gaussian blur operation on the GPU. The effect file must
''' be already bound to the asset name: 'Effects\GaussianBlur' or
''' 'GaussianBlur'.
''' </summary>
Public Sub New(game As Microsoft.Xna.Framework.Game)
Me.game = game
'''Requires file restructure
'effect = Content.Load(Of Effect)("SharedResources\Effects\GaussianBlur")
effect = Content.Load(Of Effect)("Effects\GaussianBlur")
'Try
' effect = game.Content.Load(Of Effect)("SharedResources\Effects\GaussianBlur")
'Catch generatedExceptionName As ContentLoadException
' effect = game.Content.Load(Of Effect)("GaussianBlur")
'End Try
End Sub
''' <summary>
''' Calculates the Gaussian blur filter kernel. This implementation is
''' ported from the original Java code appearing in chapter 16 of
''' "Filthy Rich Clients: Developing Animated and Graphical Effects for
''' Desktop Java".
''' </summary>
''' <param name="blurRadius">The blur radius in pixels.</param>
''' <param name="blurAmount">Used to calculate sigma.</param>
Public Sub ComputeKernel(blurRadius As Integer, blurAmount As Single)
m_radius = blurRadius
m_amount = blurAmount
m_kernel = Nothing
m_kernel = New Single(m_radius * 2) {}
m_sigma = m_radius / m_amount
Dim twoSigmaSquare As Single = 2.0F * m_sigma * m_sigma
Dim sigmaRoot As Single = CSng(Math.Sqrt(twoSigmaSquare * Math.PI))
Dim total As Single = 0F
Dim distance As Single = 0F
Dim index As Integer = 0
For i As Integer = -m_radius To m_radius
distance = i * i
index = i + m_radius
m_kernel(index) = CSng(Math.Exp(-distance / twoSigmaSquare)) / sigmaRoot
total += m_kernel(index)
Next
For i As Integer = 0 To m_kernel.Length - 1
m_kernel(i) /= total
Next
End Sub
''' <summary>
''' Calculates the texture coordinate offsets corresponding to the
''' calculated Gaussian blur filter kernel. Each of these offset values
''' are added to the current pixel's texture coordinates in order to
''' obtain the neighboring texture coordinates that are affected by the
''' Gaussian blur filter kernel. This implementation has been adapted
''' from chapter 17 of "Filthy Rich Clients: Developing Animated and
''' Graphical Effects for Desktop Java".
''' </summary>
''' <param name="textureWidth">The texture width in pixels.</param>
''' <param name="textureHeight">The texture height in pixels.</param>
Public Sub ComputeOffsets(textureWidth As Single, textureHeight As Single)
offsetsHoriz = Nothing
offsetsHoriz = New Vector2(m_radius * 2) {}
offsetsVert = Nothing
offsetsVert = New Vector2(m_radius * 2) {}
Dim index As Integer = 0
Dim xOffset As Single = 1.0F / textureWidth
Dim yOffset As Single = 1.0F / textureHeight
For i As Integer = -m_radius To m_radius
index = i + m_radius
offsetsHoriz(index) = New Vector2(i * xOffset, 0F)
offsetsVert(index) = New Vector2(0F, i * yOffset)
Next
End Sub
''' <summary>
''' Performs the Gaussian blur operation on the source texture image.
''' The Gaussian blur is performed in two passes: a horizontal blur
''' pass followed by a vertical blur pass. The output from the first
''' pass is rendered to renderTarget1. The output from the second pass
''' is rendered to renderTarget2. The dimensions of the blurred texture
''' is therefore equal to the dimensions of renderTarget2.
''' </summary>
''' <param name="srcTexture">The source image to blur.</param>
''' <param name="renderTarget1">Stores the output from the horizontal blur pass.</param>
''' <param name="renderTarget2">Stores the output from the vertical blur pass.</param>
''' <param name="spriteBatch">Used to draw quads for the blur passes.</param>
''' <returns>The resulting Gaussian blurred image.</returns>
Public Function PerformGaussianBlur(srcTexture As Texture2D, renderTarget1 As RenderTarget2D, renderTarget2 As RenderTarget2D, spriteBatch As SpriteBatch) As Texture2D
If effect Is Nothing Then
Throw New InvalidOperationException("GaussianBlur.fx effect not loaded.")
End If
Dim outputTexture As Texture2D = Nothing
Dim srcRect As New Rectangle(0, 0, srcTexture.Width, srcTexture.Height)
Dim destRect1 As New Rectangle(0, 0, renderTarget1.Width, renderTarget1.Height)
Dim destRect2 As New Rectangle(0, 0, renderTarget2.Width, renderTarget2.Height)
' Perform horizontal Gaussian blur.
GraphicsDevice.SetRenderTarget(renderTarget1)
effect.CurrentTechnique = effect.Techniques("GaussianBlur")
effect.Parameters("weights").SetValue(m_kernel)
effect.Parameters("colorMapTexture").SetValue(srcTexture)
effect.Parameters("offsets").SetValue(offsetsHoriz)
spriteBatch.Begin(0, BlendState.Opaque, Nothing, Nothing, Nothing, effect)
spriteBatch.Draw(srcTexture, destRect1, Color.White)
spriteBatch.[End]()
' Perform vertical Gaussian blur.
GraphicsDevice.SetRenderTarget(renderTarget2)
outputTexture = DirectCast(renderTarget1, Texture2D)
effect.Parameters("colorMapTexture").SetValue(outputTexture)
effect.Parameters("offsets").SetValue(offsetsVert)
spriteBatch.Begin(0, BlendState.Opaque, Nothing, Nothing, Nothing, effect)
spriteBatch.Draw(outputTexture, destRect2, Color.White)
spriteBatch.[End]()
' Return the Gaussian blurred texture.
GraphicsDevice.SetRenderTarget(Nothing)
outputTexture = renderTarget2
Return outputTexture
End Function
End Class
End Class
End Namespace

@ -177,7 +177,7 @@ Public Class NewInventoryScreen
End Sub
Public Overrides Sub Draw()
'PreScreen.Draw()
PreScreen.Draw()
DrawGradients(CInt(255 * _interfaceFade))

@ -84,9 +84,9 @@
Case OldLocalization.GetString("game_menu_exit")
Core.SetScreen(Me.PreScreen)
Case Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177)
ShowBalls()
Me.ShowBalls()
Case "End Contest"
EndContest()
Me.EndContest()
End Select
End If
Else

@ -0,0 +1,315 @@
Public Class NewMenuScreen
Inherits Screen
Private _menuOptions As New List(Of String)
Private _menuIndex As Integer = 0
Private _texture As Texture2D
'Intro animation:
Private _gradientFade As Integer = 0
Private _buttonFadeIndex As Integer = 0
Private _currentButtonFade As Integer = 0
Private _buttonIntroFinished As Boolean = False
'cursor animation:
Private _cursorPosition As Vector2 = New Vector2(0, 0)
Private _cursorDestPosition As Vector2 = New Vector2(0, 0)
Private _preScreenTexture As RenderTarget2D
Private _preScreenTarget As RenderTarget2D
Public Sub New(ByVal currentScreen As Screen)
Identification = Identifications.MenuScreen
PreScreen = currentScreen
IsDrawingGradients = True
MouseVisible = True
_preScreenTarget = New RenderTarget2D(GraphicsDevice, windowSize.Width, windowSize.Height)
_texture = TextureManager.GetTexture("GUI\Menus\General")
ConstructMenu()
_menuIndex = Player.Temp.MenuIndex
SetCursorPosition(_menuIndex)
_cursorPosition = _cursorDestPosition
_blur = New Resources.GaussianEffect(windowSize.Width, windowSize.Height)
End Sub
Private Sub ConstructMenu()
If Core.Player.HasPokedex = True Then
_menuOptions.Add("Pokédex")
End If
If Screen.Level.IsBugCatchingContest = True Then
_menuOptions.AddRange({Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177),
"Bag",
"|||" & Core.Player.Name, 'Trainer card
"End Contest"})
Else
If Core.Player.Pokemons.Count > 0 Then
_menuOptions.Add("Pokémon")
End If
_menuOptions.AddRange({"Bag",
"|||" & Core.Player.Name,
"Save"})
End If
_menuOptions.Add("Options")
End Sub
Private _blur As Resources.GaussianEffect
Private Sub DrawPrescreen()
If _preScreenTexture Is Nothing OrElse _preScreenTexture.IsContentLost Then
SpriteBatch.EndBatch()
Dim target As RenderTarget2D = _preScreenTarget
GraphicsDevice.SetRenderTarget(target)
GraphicsDevice.Clear(BackgroundColor)
SpriteBatch.BeginBatch()
PreScreen.Draw()
SpriteBatch.EndBatch()
GraphicsDevice.SetRenderTarget(Nothing)
SpriteBatch.BeginBatch()
_preScreenTexture = target
End If
SpriteBatch.Draw(_blur.Perform(_preScreenTexture), windowSize, Color.White)
End Sub
Public Overrides Sub Draw()
DrawPrescreen()
DrawGradients(_gradientFade)
If Me.IsCurrentScreen() = True Then
'Draw buttons:
If _gradientFade = 255 Then
If Core.Player.IsGameJoltSave = True Then
GameJolt.Emblem.Draw(GameJolt.API.username, Core.GameJoltSave.GameJoltID, Core.GameJoltSave.Points, Core.GameJoltSave.Gender, Core.GameJoltSave.Emblem, New Vector2(CSng(Core.windowSize.Width / 2 - 256), 30), 4, Core.GameJoltSave.DownloadedSprite)
End If
For i = 0 To _menuOptions.Count - 1
Dim text As String = _menuOptions(i).Replace("|||", "")
If _buttonIntroFinished = True Or _buttonFadeIndex > i Then
Dim pos = GetButtonPosition(i)
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X), CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), Color.White)
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64, CInt(pos.Y), 64 * 4, 64), New Rectangle(32, 16, 16, 16), Color.White)
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64 * 5, CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), Color.White, 0.0F, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.0F)
Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(CInt(pos.X) + 20, CInt(pos.Y) + 16), Color.Black, 0.0F, Vector2.Zero, 1.25F, SpriteEffects.None, 0.0F)
Else
Dim pos = GetButtonPosition(i)
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X), CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), New Color(255, 255, 255, _currentButtonFade))
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64, CInt(pos.Y), 64 * 4, 64), New Rectangle(32, 16, 16, 16), New Color(255, 255, 255, _currentButtonFade))
Core.SpriteBatch.Draw(_texture, New Rectangle(CInt(pos.X) + 64 * 5, CInt(pos.Y), 64, 64), New Rectangle(16, 16, 16, 16), New Color(255, 255, 255, _currentButtonFade), 0.0F, Vector2.Zero, SpriteEffects.FlipHorizontally, 0.0F)
Core.SpriteBatch.DrawString(FontManager.MainFont, text, New Vector2(CInt(pos.X) + 20, CInt(pos.Y) + 16), New Color(0, 0, 0, _currentButtonFade), 0.0F, Vector2.Zero, 1.25F, SpriteEffects.None, 0.0F)
Exit For
End If
Next
End If
DrawCursor()
Else
_buttonFadeIndex = 0
_currentButtonFade = 0
_buttonIntroFinished = False
End If
End Sub
Private Sub DrawCursor()
If _buttonIntroFinished = True Or _buttonFadeIndex > _menuIndex Then
Dim t As Texture2D = TextureManager.GetTexture("GUI\Menus\General", New Rectangle(0, 0, 16, 16), "")
Core.SpriteBatch.Draw(t, New Rectangle(CInt(_cursorPosition.X), CInt(_cursorPosition.Y), 64, 64), Color.White)
End If
End Sub
Private Sub SetCursorPosition(ByVal _buttonIndex As Integer)
Dim pos = GetButtonPosition(_buttonIndex)
Dim cPosition As Vector2 = New Vector2(pos.X + 180, pos.Y - 42)
_cursorDestPosition = cPosition
End Sub
Private Function GetButtonPosition(ByVal index As Integer) As Vector2
'button size: 384x64
'space between buttons horizontally: 150
'space between buttons vertically: 80
Dim X As Single = 0F
Dim Y As Single = 0F
If (index Mod 2) = 0 Then
X = Core.ScreenSize.Width / 2.0F - 384 - 75
Else
X = Core.ScreenSize.Width / 2.0F + 75
End If
Select Case Math.Floor(index / 2)
Case 0
Y = (Core.ScreenSize.Height / 2.0F) - 64 - 80 - 32
Case 1
Y = (Core.ScreenSize.Height / 2.0F) - 32
Case 2
Y = (Core.ScreenSize.Height / 2.0F) + 32 + 80
End Select
Return New Vector2(X, Y)
End Function
Public Overrides Sub Update()
If _gradientFade < 255 Then
_gradientFade += 25
If _gradientFade >= 255 Then
_gradientFade = 255
End If
Else
If _buttonIntroFinished = False Then
_currentButtonFade += 45
If _currentButtonFade >= 255 Then
_currentButtonFade = 0
_buttonFadeIndex += 1
If _buttonFadeIndex > _menuOptions.Count - 1 Then
_buttonIntroFinished = True
End If
End If
End If
End If
If _buttonIntroFinished = True Then
Player.Temp.MenuIndex = _menuIndex
Dim preMenuIndex As Integer = _menuIndex
If _cursorDestPosition.X <> _cursorPosition.X Or _cursorDestPosition.Y <> _cursorPosition.Y Then
_cursorPosition.X = MathHelper.Lerp(_cursorDestPosition.X, _cursorPosition.X, 0.75F)
_cursorPosition.Y = MathHelper.Lerp(_cursorDestPosition.Y, _cursorPosition.Y, 0.75F)
If Math.Abs(_cursorDestPosition.X - _cursorPosition.X) < 0.1F Then
_cursorPosition.X = _cursorDestPosition.X
End If
If Math.Abs(_cursorDestPosition.Y - _cursorPosition.Y) < 0.1F Then
_cursorPosition.Y = _cursorDestPosition.Y
End If
End If
If Math.Abs(_cursorDestPosition.Y - _cursorPosition.Y) < 5.0F Then
If Controls.Accept(True, False, False) = True Then
For i = 0 To _menuOptions.Count - 1
Dim pos = GetButtonPosition(i)
If New Rectangle(CInt(pos.X), CInt(pos.Y), 64 * 6, 64).Contains(MouseHandler.MousePosition) Then
If _menuIndex = i Then
_cursorPosition.X = _cursorDestPosition.X
PressButton()
Else
_menuIndex = i
_cursorDestPosition = New Vector2(MouseHandler.MousePosition.X, MouseHandler.MousePosition.Y - 42)
preMenuIndex = _menuIndex 'Prevent the update of the mouse position below.
Exit For
End If
End If
Next
End If
If Controls.Accept(False, True, True) = True Then
_cursorPosition.X = _cursorDestPosition.X
PressButton()
End If
End If
If Controls.Up(True, True, False, True, True, True) = True Then
If _menuIndex > 1 Then
_menuIndex -= 2
End If
End If
If Controls.Down(True, True, False, True, True, True) = True Then
If _menuIndex < _menuOptions.Count - 2 Then
_menuIndex += 2
End If
End If
If Controls.Right(True, True, True, True, True, True) = True Then
If _menuIndex < _menuOptions.Count - 1 Then
_menuIndex += 1
End If
End If
If Controls.Left(True, True, True, True, True, True) = True Then
If _menuIndex > 0 Then
_menuIndex -= 1
End If
End If
If _menuIndex <> preMenuIndex Then
SetCursorPosition(_menuIndex)
End If
End If
If Controls.Dismiss() = True Then
Core.SetScreen(PreScreen)
End If
End Sub
Private Sub PressButton()
Select Case _menuOptions(_menuIndex)
Case "Pokédex"
Core.SetScreen(New TransitionScreen(Core.CurrentScreen, New PokedexSelectScreen(Me), Color.White, False))
Case "Pokémon"
SetScreen(New PartyScreen(Me))
Case "Bag"
Core.SetScreen(New NewInventoryScreen(Me))
Case "|||" & Core.Player.Name
Core.SetScreen(New TrainerScreen(Me))
Case "Save"
Core.SetScreen(New SaveScreen(Me))
Case "Options"
Core.SetScreen(New OptionScreen(Me))
Case "Exit"
Core.SetScreen(PreScreen)
Case Screen.Level.BugCatchingContestData.GetSplit(2) & " x" & Core.Player.Inventory.GetItemAmount(177)
Me.ShowBalls()
Case "End Contest"
Me.EndContest()
End Select
End Sub
Private Sub ShowBalls()
''' Requires new scripting system
'Dim s As Screen = Me.PreScreen
'Construct.Controller.GetInstance().RunFromFile(Screen.Level.BugCatchingContestData.GetSplit(1))
'Core.SetScreen(s)
Dim s As Screen = Me.PreScreen
CType(s, OverworldScreen).ActionScript.StartScript(Screen.Level.BugCatchingContestData.GetSplit(1), 0)
Core.SetScreen(s)
End Sub
Private Sub EndContest()
''' Requires new scripting system
'Dim s As Screen = Me.PreScreen
'Construct.Controller.GetInstance().RunFromFile(Screen.Level.BugCatchingContestData.GetSplit(0))
'Core.SetScreen(s)
Dim s As Screen = Me.PreScreen
CType(s, OverworldScreen).ActionScript.StartScript(Screen.Level.BugCatchingContestData.GetSplit(0), 0)
Core.SetScreen(s)
End Sub
Public Overrides Sub SizeChanged()
SetCursorPosition(_menuIndex)
_cursorPosition = _cursorDestPosition
End Sub
End Class

@ -52,6 +52,12 @@
/processorParam:DebugMode=Auto
/build:Content/Effects/DiffuseShader.fx
#begin Content/Effects/GaussianBlur.fx
/importer:EffectImporter
/processor:EffectProcessor
/processorParam:DebugMode=Auto
/build:Content/Effects/GaussianBlur.fx
#begin Content/Effects/Shadow.png
/importer:TextureImporter
/processor:TextureProcessor

@ -0,0 +1,49 @@
#define RADIUS 7
#define KERNEL_SIZE (RADIUS * 2 + 1)
//-----------------------------------------------------------------------------
// Globals.
//-----------------------------------------------------------------------------
float weights[KERNEL_SIZE];
float2 offsets[KERNEL_SIZE];
//-----------------------------------------------------------------------------
// Textures.
//-----------------------------------------------------------------------------
texture colorMapTexture;
sampler2D colorMap = sampler_state
{
Texture = <colorMapTexture>;
MipFilter = Linear;
MinFilter = Linear;
MagFilter = Linear;
};
//-----------------------------------------------------------------------------
// Pixel Shaders.
//-----------------------------------------------------------------------------
float4 PS_GaussianBlur(float2 texCoord : TEXCOORD) : COLOR0
{
float4 color = float4(0.0f, 0.0f, 0.0f, 0.0f);
for (int i = 0; i < KERNEL_SIZE; ++i)
color += tex2D(colorMap, texCoord + offsets[i]) * weights[i];
return color;
}
//-----------------------------------------------------------------------------
// Techniques.
//-----------------------------------------------------------------------------
technique GaussianBlur
{
pass
{
PixelShader = compile ps_2_0 PS_GaussianBlur();
}
}