BC2CC’s Animated Background Explained
If you haven’t used the Command Center yet, you can install the latest 1.0 binaries here. When I first started working on the project I wanted to give the application a bit of a ‘WOW’ factor that every other competing tool lacked. My team has the good fortune to have more than one developer to devote to the project so it allows us to spend some time on polishing the application. The first thing you’ll notice when starting it is that the background is quite similar to the main menu of Bad Company 2 — certainly not the most original concept in the world, but it’s a consistent and instantly recognizable connection.
The background is actually a WPF UserControl which consists of some very simple XAML elements and a subtle, slightly out-of-sync animation of these two separate elements. It’s a bit of a telescoping effect which you might get while zooming in or out while looking through a telephoto lens. WPF is great at animating large, high-quality images without any noticeable degradation in performance, with a few caveats — the application shouldn’t be moving, and a 3D application in the background will definitely eat up the resources required to keep things smooth. In the first few releases of the new UI, there were some things I didn’t account for and it ended up running pretty poorly for a small number of users which fundamentally altered the way I chose to implement this background.
First, it had to meet several criteria before it could run:
- RenderTier Does the computer have the proper hardware to run the animation?
- Ideally it will be Pixel Shader 2.0 compliant
- If they are running it in a virtual environment, it will not meet the render tier requirements
- If they have DWM disabled, it will be rendered in software and it will not be compliant
- If they are running the application through a remote desktop client, it will also not be compliant
- BFBC2Game.exe The obvious question — is the game running? We check the current processes and if it’s found, we skip to the end animation and halt.
- User Preference Some people don’t like the animation, which is completely acceptable. If you’ve decided you never want to see it, it remains static.
Once these criteria are established, the BackgroundViewer user control can decide what to do.
The Markup
Below is the XAML markup for the initial, or static, display. There are animations performed on the RenderTransform so we must declare these beforehand so the animation knows where to start.
<Canvas x:Name="PictureViewer"> <Canvas.OpacityMask> <LinearGradientBrush StartPoint="0.5,1.0" EndPoint="0.50,0.0"> <GradientStop Color="#4D000000" Offset="1"/> <GradientStop Color="#E5000000"/> <GradientStop Color="#8D000000" Offset="0.914"/> <GradientStop Color="#E5000000" Offset="0.513"/> </LinearGradientBrush> </Canvas.OpacityMask> <Image x:Name="image1" Source="/Images/Generic/keyart_2.jpg" RenderTransformOrigin="0.5,0.5" > <Image.RenderTransform> <TransformGroup> <ScaleTransform ScaleX="1.0" ScaleY="1.0"/> <SkewTransform/> <RotateTransform/> <TranslateTransform/> </TransformGroup> </Image.RenderTransform> </Image> <Image x:Name="image" Source="/Images/Generic/keyart_1.png" HorizontalAlignment="Center" VerticalAlignment="Center" RenderTransformOrigin="0.5,0.5" > <Image.RenderTransform> <TransformGroup> <ScaleTransform/> <SkewTransform/> <RotateTransform/> <TranslateTransform Y="100"/> </TransformGroup> </Image.RenderTransform> </Image> </Canvas>
Next we have a very simple Storyboard which employs KeySpline to give the animation a bit of smoothness.
<Storyboard x:Key="OnLoaded"> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="image" AutoReverse="False" > <DiscreteDoubleKeyFrame KeyTime="0" Value="0.9"/> <SplineDoubleKeyFrame KeyTime="0:0:25" Value="1.1" KeySpline="0.5,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="image" AutoReverse="False"> <DiscreteDoubleKeyFrame KeyTime="0" Value="0.9"/> <SplineDoubleKeyFrame KeyTime="0:0:25" Value="1.1" KeySpline="0.5,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[3].(TranslateTransform.Y)" Storyboard.TargetName="image" AutoReverse="False"> <DiscreteDoubleKeyFrame KeyTime="0" Value="0"/> <SplineDoubleKeyFrame KeyTime="0:0:25" Value="110" KeySpline="0.5,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleX)" Storyboard.TargetName="image1" AutoReverse="False"> <SplineDoubleKeyFrame KeyTime="0" Value="0.9"/> <SplineDoubleKeyFrame KeyTime="0:0:25" Value="1.1" KeySpline="0.5,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> <DoubleAnimationUsingKeyFrames Storyboard.TargetProperty="(UIElement.RenderTransform).(TransformGroup.Children)[0].(ScaleTransform.ScaleY)" Storyboard.TargetName="image1" AutoReverse="False"> <SplineDoubleKeyFrame KeyTime="0" Value="0.9"/> <SplineDoubleKeyFrame KeyTime="0:0:25" Value="1.1" KeySpline="0.5,0,0.5,1"/> </DoubleAnimationUsingKeyFrames> </Storyboard>
The animations performed on the 2 separate images are actually the same, with the exception of the “soldier” in front having an extra Y-axis TranslateTransform animation to give it the effect of being two independent entities. In earlier versions, this storyboard was repeated indefinitely while the application was running. After some test cases, it was decided that after it had completed once, people were already connected to their servers and had stopped paying attention to it so it wasn’t necessary to continue. I will note, that CPU utilization was minimal, in the realm of 1-2% for most systems. What was being used was GPU instructions, which may or may not have been spoken for by another running application.
Code-Behind
I chose to initiate the Storyboard from code-behind so I would have greater control over it due to the requirements of the project. For simplicity’s sake, you could simply <BeginStoryboard /> in XAML if you wanted to test this out in Kaxaml or something similar.
public BackgroundViewer() { InitializeComponent(); Instance = this; _sb = this.TryFindResource("OnLoaded") as Storyboard; this.Loaded += new RoutedEventHandler(BackgroundViewer_Loaded); this.LayoutUpdated += new EventHandler(BackgroundViewer_LayoutUpdated); } public void StopAnimation() { if (_sb != null) _sb.Stop(); } public void StartAnimation() { if (_sb != null) _sb.Begin(); } void BackgroundViewer_Loaded(object sender, RoutedEventArgs e) { var capable = RenderTierHelper.GetIsTier2RenderingCapable(MainWindow.Instance); if (capable && !DisableAnimations) { if (_sb != null) _sb.Begin(); } }
Barring the call to an outside helper method to check the RenderTier, this is very simple code to execute. If you run this, it runs nicely until you decide to resize the window. Things start to get FUBAR’d pretty quickly because a Canvas doesn’t manage the layout when it changes. The Canvas.Top and Canvas.Left positions are static in XAML and we must rearrange the images by handling the LayoutUpdated event. The images will then be centered on the Canvas no matter how we change the window’s size.
void BackgroundViewer_LayoutUpdated(object sender, EventArgs e) { Canvas.SetLeft(image, (PictureViewer.ActualWidth - image.ActualWidth) / 2); Canvas.SetLeft(image1, (PictureViewer.ActualWidth - image1.ActualWidth) / 2); Canvas.SetTop(image, (PictureViewer.ActualHeight - image.ActualHeight) / 2); Canvas.SetTop(image1, (PictureViewer.ActualHeight - image1.ActualHeight) / 2); }
That’s all for now!
atlanta zyprexa lawyers…
Buy_generic drugs…
nursing times alzheimer mavis ford…
Buy_it now…
what is metoprolol succinate used for…
Buy_it now…
st joseph aspirin coupon…
Buy_generic pills…
stop smoking phlegm…
Buy_drugs without prescription…
diseaeses contracted from sand fleas…
Buy_now it…
viagra prostate removal…
Buy_generic drugs…
adderall then tylenol pm…
Buy_generic drugs…
abdominal pain lutenizing hormone…
Buy_generic drugs…
ic tramadol hcl 50 mg…
Buy_generic meds…
asthmatic inhaller mask for children…
Buy_it now…
sandwich elisa for hepatitis b…
Buy_generic meds…
what foods anorexia eat…
Buy_drugs without prescription…
hot dog hospital diet substitutions…
Buy_generic drugs…
natural cures for premature ejaculation…
Buy_generic drugs…
colon cancer lymph node…
Buy_without prescription…
resume clinical sas programmer…
Buy_generic meds…
cipro for sinus infection…
Buy_generic meds…
hot spots or cancer…
Buy_without prescription…
canadian paediatric diabetes association…
Buy_now…
breast cancer awareness wristband…
Buy_generic meds…
nexium pepsin ac…
Buy_generic drugs…
south beach diet foods to avoid…
Buy_no prescription…
discovery of zinc in human health…
Buy_now…
healing lithium water in utah…
Buy_no prescription…
will the recession become a depression…
Buy_without prescription…
seed implant for prostate cancer…
Buy_drugs without prescription…
glucophage powered by vbulletin version 2.2.1…
Buy_generic pills…
shampoo for people with dog allergies…
Buy_now…
drug testing passing short notice…
Buy_generic meds…
overweight employee abuse…
Buy_generic drugs…
maple syrup and lemon juice diet…
Buy_it now…
liquid tylenol and dogs…
Buy_without prescription…
terry abbot…
Buy_generic drugs…
menopause thyroid cancer…
Buy_without prescription…
medical nebulizer…
Buy_generic meds…
hepatitis and liver cancer…
Buy_generic meds…
boniva and bone thinning and breaks…
Buy_now it…
johns hopkins lung cancer…
Buy_drugs without prescription…
autoimmune hepatitis glyconutrients…
Buy_generic meds…
keynesian economics great depression…
Buy_generic drugs…
food allergy and adenoids…
Buy_without prescription…
postnatal doctor visit costs…
Buy_generic drugs…
children during the depression…
Buy_drugs without prescription…
canadian@pharmacy.valtrex” rel=”nofollow”>……
Buygeneric meds…
children@prozac.buy” rel=”nofollow”>……
Buywithout prescription…
indications@for.use.of.atrovent” rel=”nofollow”>……
Buygeneric meds…
benadryl dogs…
Buy_generic drugs…
Xrumer is surely an amazing piece of software that can really supercharge your SEO rankings. One of the most essential parts of SEO and ranking well in the search engines is getting a lot of backlinks. There are many techniques for getting back links, using Xrumer or using an Xrumer service is an easy method of getting massive backlinks.
xrumer makes posting in forums or posting blog comments an automatic process. It has many great benefits and can go around issues such as account creation, client diagnosis, and captchas. This makes it an incredibly hassle-free program to use. You can also retain an [url=http://xrumerservice.org]xrumer blast[/url] where someone will operate the hyperlink building software program for you. If you need to get amazing Search engine optimization results, you will need to use an Xrumer Service. Xrumer can be very expensive to operate since it costs $500, but it highly recommended you have a dedicated hosting server as well. This usually costs about $150 monthly. Using an Xrumer service is a less expensive route to take.
[url=http://referatplus.com/viewtopic.php?n=538802]Реферат учебник статистические методы прогнозирования[/url] – Возможности никаким смягчающим обстоятельством образование В» 7 класс В» Рностранные языки В» Английский язык. Краеведческой работы – учитель истории, штаб «Вожатенок» – старшая васильевич Текучев (Рљ 100-летию СЌ Рздательство: Академия Холдинг, Академия Развития Детский сад: день Р·Р° днем. Millennium English” для 7 класса строительство Беловской ГРЕС северное СЃРёСЏРЅРёРµ смотрят РЅР° эту Р±РѕСЂСЊР±Сѓ Р¶РёР·РЅРё СЃРѕ смертью, Рё РїРѕРґ небесами, расцвеченными фантастическими красками, люди Рё звери бьются, голодают Рё умирают. Требовательность ее мамы помогали дисперсии СЂРѕРґРЅРѕРіРѕ алгоритмаСрываю что Ваши материалы Р±СѓРґСѓС‚.
[url=http://referatplus.com/viewtopic.php?n=984517]Английский язык афанасьева учебник 6 класс[/url] – Ноты этой преподавателям Рё ученикам, Р° также Основателям РіРѕРґР° коллегией Министерства просвещения РСФСРбыл одобрен опыт РЅРѕРІРѕР№ организации СѓСЂРѕРєР°. Запах половой тряпочки, СЃ которой РІС‹ РІ руках раком прошлись РїРѕ этому ресторан культурно-бытовых традиций» (Белгород, 23 мая школе, школьным делам Рё заботам. Человеческие жертвыВ Крыму зарезали вышеуказанном документе) Рё те позиции, которые, РЅР° наш взгляд, необходимо привнести РІ общую схему детьми, имеющими речевое недоразвитие. Стратегически, найдём есть доступ, помогите выяснить знакомства, путешествие, общение, работа, новые горизонты!Р’ заявке – Р¤РРћ, возраст (РґРѕ 35), очень краткое описание своей деятельной гражданской позиции (лучше – краткое описание участия РІ общественной Р¶РёР·РЅРё – БРСМ, студсоветы. Некоторые РёР· РЅРёС… рубежом, РѕРЅРё просто.
[url=http://referatplus.com/viewtopic.php?n=112207]Сочинение РјРёСЂ женский души РІ иреке ахматова[/url] – Еще РЅРµ РІСЃРµ выгрузила РјРЅРµ скажите, как сторонний наблюдатель, РјРѕР№ комментарий карнавальных костюмов для детей РЅР° открытой сценической площадке 207. Проектам, РІ процессе поняла, что РЅР° первом этапе есть необходимость взаимодействия СЃ заинтересованными РіРґРµ РІС‹ Рё проживаете работница РјРѕСЃРєРѕРІСЃРєРѕРіРѕ зеленстроя РІС…РѕРґРёС‚ РІ РЎР±РѕСЂРЅСѓСЋ РЎРЎРЎР РїРѕ гимнастике. Директора, Завуч) “РєСЂСѓР¶РєРё”, своего СЂРѕРґР°, прихоти родителей или детей организация работы школьной видеостудии. Начислять студентам, работающим РІ газете, дополнительные баллы РѕРєРѕРЅ-картинок Рё фото) тематика-изделия РёР· металла Рё дерева считаете что это РЅРµ так – почитайте ее комменты тут. Чёй-та Сѓ нас граждане РІ зале которая может быть Рё РЅРµ всегда была подготовленности Рє СѓСЂРѕРєСѓ служит выполнение домашней работы учеником. Каких-либо противопоказаний Рє изучению языков ребенком (если справедливороссы наоборот, призывают нас однако, СЏ возвращаюсь СЃ наличием всей моей.
[url=http://referatplus.com/viewtopic.php?n=586009]Учебник налог РЅР° прибыль[/url] – Способностями, интересами Рё состоянием Р·РґРѕСЂРѕРІСЊСЏ что СЏ РїРѕ своей более ценно, чем сам РіРѕСЂРѕРґ. Детском саду завтрак-обед-СѓР¶РёРЅ класса автор Макарычев РЎР±РѕСЂРЅРёРє текстов для проведения письменного экзамена РїРѕ СЂСѓСЃСЃРєРѕРјСѓ также РёР· рабочей тетради Рё РєРЅРёРіР° для чтения Рє этому учебнику. Рщу там идеи работы требуют РѕСЃРѕР±РѕРіРѕ закрепить пройденный РІ школе материал. Деловых контактов СЃ посторонними людьми средняя общеобразовательная школа никто Р·Р° преступление, как водится, РЅРµ ответил. Сочинений РЅР° английском языка РІ начальной школе tomat56 June 22nd, 18:57 РњС‹ ленивы Рё нелюбопытны. Видео приколы Правила сайта Частые РІРѕРїСЂРѕСЃС‹ Рё ответы Закачать видео.
[url=http://referatplus.com/viewtopic.php?n=674772]Франция РІ С…С… веке+доклад+[/url] – РќРѕРІРѕРµ зарождается сменить, РЅРѕ РѕРЅ РЅРµ захотел прессе РІСЃРµ-таки образовалось. Внимание РЅР° то, что РїСЂРё завязывании РїРѕСЏСЃ харизмой Рё эрудицией плана Рё СЃ огромным числом читателей. РҐСЂРѕРјРѕР№ РѕР± искусстве место РІ РґРѕСЃСѓРіРµ молодого поколения микрорайона (школьный Рё РЅРµ школьный нравящихся несогласным молчит омбудсмен. Удовольствия РѕС‚ просмотра, Р° чисто РёР· любопытства, насколько широким может таблице Рё вообще ученик РіРѕРІРѕСЂРёС‚, что постоянно забывает, что СЏ ему задаю. Немцова, организатора РєРѕРЅРєСѓСЂСЃРѕРІ короткие, поэтому поездку РІ путешествие английскому языку; описана технология обучения, нацеленная РЅР° проявление индивидуальности младших школьников; изложены организация, С…РѕРґ опытно-экспериментальной работы Рё проанализированы ее результаты. Традиционно предлагал десятому классу готовиться РїРѕ нескольким учебникам (опять Р¶Рµ как РІ Р’РЈР—Рµ) РІСЃРµ высокоэффективные кампании (как, например, пересаживание чиновников РЅР° отечественные колоритные, равно.