Performance about NoesisNotifyArrayPropertyChanged(void*)
Posted: 18 Apr 2018, 04:29
Hi,
I am making a mini map UI, display some actor's transform info, average 20 actors, update VM info every 0.2s. but meet performance problem
the gap between disable TickIcon and enable TickIcon is about 5 fps on Android. Is there some better method can do this?
I am making a mini map UI, display some actor's transform info, average 20 actors, update VM info every 0.2s. but meet performance problem
the gap between disable TickIcon and enable TickIcon is about 5 fps on Android. Is there some better method can do this?
Code: Select all
// called every 0.2s
void UpdateIcons()
{
if(MiniMapVM == nullptr)
{
return;
}
MiniVMapM->IconList.Reset();
//about 10-20 actors
for(int32 i = 0; ActorList.Num(); ++i)
{
IconInfo IconToSet;
//compute icon location and rotation
MiniMapVM->IconList.Add(IconToSet);
}
if(MiniMapVM->bEnableTick)
MiniMapVM->NotifyIconListChanged(); // call NoesisNotifyArrayPropertyChanged(&IconList)
}
Code: Select all
<UserControl x:Class="GameGUI.MiniMap"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:local="clr-namespace:GameGUI"
mc:Ignorable="d"
d:DesignHeight="300" d:DesignWidth="300">
<UserControl.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="GameGUIStyle.Xaml"></ResourceDictionary>
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</UserControl.Resources>
<Grid>
<!--enable or disable update icons in mini map-->
<CheckBox x:Name="EnableTickIcon" Content="{Binding Path=Name, RelativeSource={RelativeSource Self}}"
Canvas.Left="1060" Canvas.Top="120" FontSize="24" Foreground="#FF0080FF" Background="#FFF3F3F3"
HorizontalAlignment="Right" VerticalAlignment="Top" IsChecked="{Binding bEnableTickIcon, Mode=OneWayToSource}" Panel.ZIndex="2"/>
<Label Content="{Binding TitleText}" Foreground="Red" FontSize="14" RenderTransformOrigin="0.5,0.5" Margin="0,0,200,280" Width="200" Height="20" Panel.ZIndex="1"/>
<!--
<Image x:Name="PreComputedMapBackground" Width="300" Height="300" RenderTransformOrigin="0.5,0.5" Source="{Binding PreComputedMapBackground}" >
</Image>
-->
<!--
<Image x:Name="RealTimeMapBackground" Source="{Binding RealTimeMapBackground}" Visibility="Visible" Width="300" Height="300" RenderTransformOrigin="0.5,0.5">
</Image>
-->
<ItemsControl ItemsSource="{Binding MapIconList}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<Canvas />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<Grid>
<Image x:Name="Img" Source="{Binding IconTexture}" RenderTransformOrigin="0.5, 0.5"
IsHitTestVisible="False" Width="{Binding IconSize.X}" Height="{Binding IconSize.Y}">
<Image.RenderTransform>
<TransformGroup>
<ScaleTransform/>
<SkewTransform/>
<RotateTransform Angle="{Binding RotateAngle}"/>
<TranslateTransform/>
</TransformGroup>
</Image.RenderTransform>
</Image>
<Border x:Name="IconTex" Width="{Binding IconSize.X}" Height="{Binding IconSize.Y}"
RenderTransformOrigin="0.5, 0.5" Background="Transparent">
</Border>
<Popup x:Name="IconTips" IsOpen="{Binding ElementName=IconTex, Path=IsMouseOver, Mode=OneWay}"
Placement="MousePoint" StaysOpen="False">
<TextBlock Text="{Binding Tips}" FontFamily="{StaticResource Font_KaiTi}" FontSize="16" Foreground="Blue" Margin="20,0,0,0"></TextBlock>
</Popup>
</Grid>
</DataTemplate>
</ItemsControl.ItemTemplate>
<ItemsControl.ItemContainerStyle>
<Style>
<Setter Property="Canvas.Left" Value="{Binding Offset.X}" />
<Setter Property="Canvas.Top" Value="{Binding Offset.Y}"/>
</Style>
</ItemsControl.ItemContainerStyle>
</ItemsControl>
</Grid>
</UserControl>