@@ -35,8 +35,7 @@ public class ImGuiRenderer
3535 private int _scrollWheelValue ;
3636 private int _horizontalScrollWheelValue ;
3737 private readonly Keys [ ] _allKeys = Enum . GetValues < Keys > ( ) ;
38-
39-
38+
4039 public ImGuiRenderer ( Game game )
4140 {
4241 ArgumentNullException . ThrowIfNull ( game ) ;
@@ -138,11 +137,11 @@ private unsafe void CreateTexture(ImTextureDataPtr textureData)
138137
139138 if ( textureData . Pixels != null )
140139 {
141- var pixelCount = textureData . Width * textureData . Height ;
142- var bytesPerPixel = textureData . Format == ImTextureFormat . Rgba32 ? 4 : 1 ;
143- var dataSize = pixelCount * bytesPerPixel ;
140+ int pixelCount = textureData . Width * textureData . Height ;
141+ int bytesPerPixel = textureData . Format == ImTextureFormat . Rgba32 ? 4 : 1 ;
142+ int dataSize = pixelCount * bytesPerPixel ;
144143
145- var managedData = new byte [ dataSize ] ;
144+ byte [ ] managedData = new byte [ dataSize ] ;
146145 Marshal . Copy ( new IntPtr ( textureData . Pixels ) , managedData , 0 , dataSize ) ;
147146 texture . SetData ( managedData ) ;
148147 }
@@ -160,7 +159,7 @@ private unsafe void CreateTexture(ImTextureDataPtr textureData)
160159 private unsafe void UpdateTextureData ( ImTextureDataPtr textureData )
161160 {
162161 IntPtr texId = textureData . GetTexID ( ) ;
163- if ( ! _textures . TryGetValue ( texId , out var textureInfo ) )
162+ if ( ! _textures . TryGetValue ( texId , out TextureInfo textureInfo ) )
164163 {
165164 return ;
166165 }
@@ -506,7 +505,7 @@ private unsafe void RenderCommandLists(ImDrawData* drawData)
506505 // In v1.92, we need to handle ImTextureRef instead of ImTextureID
507506 ImTextureRef textureRef = drawCmd ->TexRef ;
508507 ImTextureID texId = textureRef . GetTexID ( ) ;
509- if ( ! _textures . TryGetValue ( texId , out var textureInfo ) )
508+ if ( ! _textures . TryGetValue ( texId , out TextureInfo textureInfo ) )
510509 {
511510 throw new InvalidOperationException ( $ "Could not find a texture with id '{ texId } ', please check your bindings") ;
512511 }
@@ -518,9 +517,9 @@ private unsafe void RenderCommandLists(ImDrawData* drawData)
518517 ( int ) ( drawCmd ->ClipRect . W - drawCmd ->ClipRect . Y )
519518 ) ;
520519
521- var effect = UpdateEffect ( textureInfo . Texture ) ;
520+ Effect effect = UpdateEffect ( textureInfo . Texture ) ;
522521
523- foreach ( var pass in effect . CurrentTechnique . Passes )
522+ foreach ( EffectPass pass in effect . CurrentTechnique . Passes )
524523 {
525524 pass . Apply ( ) ;
526525
@@ -549,11 +548,11 @@ public void Dispose()
549548 _effect ? . Dispose ( ) ;
550549
551550 // Clean up managed textures
552- foreach ( var kvp in _textures )
551+ foreach ( TextureInfo textureInfo in _textures . Values )
553552 {
554- if ( kvp . Value . IsManaged )
553+ if ( textureInfo . IsManaged )
555554 {
556- kvp . Value . Texture ? . Dispose ( ) ;
555+ textureInfo . Texture ? . Dispose ( ) ;
557556 }
558557 }
559558 _textures . Clear ( ) ;
0 commit comments