tag:blogger.com,1999:blog-28989286257604232322024-03-13T10:20:48.606-07:00G-Level Apps & MusicKinda cool things I am creating on my free time.Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-2898928625760423232.post-86201624239117406622015-11-02T09:28:00.000-08:002015-11-02T09:28:56.761-08:00Comment ordonner des lignes ou colonnes dans Excel sans TCD ?Une fois n'est pas coutume, voici un article en français, et pas de la part du propriétaire des lieux.<br />
<br />
L'objectif ici est d'ordonner dynamiquement un tableau Excel en fonction d'une donnée spécifique.<br />
Dynamiquement, cela signifie pas de tableaux croisé dynamique et pas de fonction de tri d'Excel. Le but est bien d'avoir l’ordre des éléments qui change en fonction des données source.<br />
<br />
Prenons un exemple : Je propose un sondage sur ce blog.<br />
Noter les éléments suivant selon 5 critères : Très intéressant, Intéressant, Neutre, Inintéressant, Très inintéressant.<br />
<br />
Voici les résultats des sondages :<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguzaSv6ax9BWA5THiFBwp56USbawx-D3l0Y7WDw8DzHfxKR-v5W5GAiogh7ilveuK0CR6dApHsTHOnBNGvKuExyV5rpiH-RtBrvxUagoKWjomjI96H4NFeVtRuGhqw-o_wRTA-TTomWcI/s1600/Capture.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="182" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEguzaSv6ax9BWA5THiFBwp56USbawx-D3l0Y7WDw8DzHfxKR-v5W5GAiogh7ilveuK0CR6dApHsTHOnBNGvKuExyV5rpiH-RtBrvxUagoKWjomjI96H4NFeVtRuGhqw-o_wRTA-TTomWcI/s640/Capture.PNG" width="640" /></a></div>
<br />
<br />
Si je fais un graphique, sur base de ces données, j'ai ceci :<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqQq-kjhl-w4k_PRsgsFaZfzQJAUfioaUayKY0RiA03lGLiveUmSfoQLTczwHzNqmcrh8SEakKARJ33xYvDazBeHUE31Jybrp6TkiYp0KOF3xK7i4NRJ9-vpqO1NRmUMYGclxRF8kRD3M/s1600/Capture2.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="241" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiqQq-kjhl-w4k_PRsgsFaZfzQJAUfioaUayKY0RiA03lGLiveUmSfoQLTczwHzNqmcrh8SEakKARJ33xYvDazBeHUE31Jybrp6TkiYp0KOF3xK7i4NRJ9-vpqO1NRmUMYGclxRF8kRD3M/s400/Capture2.PNG" width="400" /></a></div>
<br />
<br />
Pas très lisible...<br />
Je souhaite alors avoir la même chose, mais ordonné. Je souhaite ordonner par celui qui à le plus de "Très intéressant". En cas d’égalité, celui qui à le plus de "Intéressant", etc.<br />
<br />
Je vais donc construire une note globale pour chacun des sujets, qui me permettra d’ordonner le tableau sur base de cette seule note. Pour cela, je vais écrire le résultat dans une base numérique à définir. Il faut que la base soit supérieure au maximum du nombre de réponses dans chacune des cases. Je prend donc 40 ici.<br />
<br />
Le problème, c'est que j'ai deux notes identiques. Ainsi, je ne pourrai pas ordonner par la suite (croyez moi, vous allez galérer).<br />
Pour éviter les égalités, je vais ajouter un nombre aléatoire à toutes les notes, trop petit pour changer réellement l'ordre (donc <1), mais assez pour éviter les égalités parfaites (sauf gros coup de malchance).<br />
Il me manque donc un petit "+ALEA()" en fin de formule.<br />
<div class="separator" style="clear: both; text-align: center;">
</div>
<br />
Maintenant, j'utilise la fonction RANG.POURCENTAGE.INCLURE pour obtenir l’ordre. Petit conseil : fixez la précision.<br />
<br />
Ensuite, je reprend les même valeur mais je les places dans l’ordre dans lequel je veux les afficher. Pour cela je recalcule les pourcentages, et je les tronques car la fonction de rang tronque les valeurs. Avec la même précision que précédemment naturellement.<br />
<br />
Ensuite, je fais un RECHERCHEH sur le nouvel ordre que je viens de définir, afin de retrouver le sujet qui lui correspond. A noter que pour cela, et comme RECHERCHEH ne fonctionne que du haut vers le bas, je dois reporter le sujet dans une nouvelle ligne en dessous.<br />
<br />
Ensuite, avec un RECHERCHEH bien senti je récupère les résultats.<br />
<br />
Au final, voici le tableau :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu-gbH9OXeBymzura5na7A0_JYZDDENmbOhLCn8x9e3LLi2s3DYjFROG9ENIajvHwydmFZ0QKSpZG9nWkPw7bhLoguOx7tRJLj3oqPhuDb0qbmLMwyzLdHDcvFF3UPk8guAuXT5tNRofE/s1600/Capture5.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="368" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhu-gbH9OXeBymzura5na7A0_JYZDDENmbOhLCn8x9e3LLi2s3DYjFROG9ENIajvHwydmFZ0QKSpZG9nWkPw7bhLoguOx7tRJLj3oqPhuDb0qbmLMwyzLdHDcvFF3UPk8guAuXT5tNRofE/s640/Capture5.PNG" width="640" /></a></div>
<br />
<br />
Le même avec les formules (pour les copieurs !) (désolé pour la mise en forme :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwTxw7oh8JELwo8MQ_JilmIjZvwdXDpZmxB3_86D72LsnIBHaVwRr1DHCKm7JKegNQa9fFXe1ddVjjz7GcfzbsE8j_IGI1CrzLi2db0gcHk32BpmjpwY52WYWGa6CU64XIFTDRWqdxr6s/s1600/Capture7.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiwTxw7oh8JELwo8MQ_JilmIjZvwdXDpZmxB3_86D72LsnIBHaVwRr1DHCKm7JKegNQa9fFXe1ddVjjz7GcfzbsE8j_IGI1CrzLi2db0gcHk32BpmjpwY52WYWGa6CU64XIFTDRWqdxr6s/s1600/Capture7.PNG" /></a></div>
<br />
<br />
<br />
Et le graphique qui va avec :<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidrwGX84Tdo3GM8I5vvBrIN7t9Dxoy7yhMKwmpON3FVYXgBOHy4GgfVCGjWSF3lJkNs4_aCltQTBtBFNnkwJt6NZsWnWmU6YLOuBxvdsoUFBjI0aA_hQEHIaZ0yB1oSvppvP9ZUmigDp8/s1600/Capture6.PNG" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="242" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEidrwGX84Tdo3GM8I5vvBrIN7t9Dxoy7yhMKwmpON3FVYXgBOHy4GgfVCGjWSF3lJkNs4_aCltQTBtBFNnkwJt6NZsWnWmU6YLOuBxvdsoUFBjI0aA_hQEHIaZ0yB1oSvppvP9ZUmigDp8/s400/Capture6.PNG" width="400" /></a></div>
<br />
<br />
<br />
<br />
Le tout garanti 100% dynamique !<br />
<br />
<br />
<br />
<br />
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/14499398799981351802noreply@blogger.com0tag:blogger.com,1999:blog-2898928625760423232.post-2611598265630450112014-04-29T09:38:00.001-07:002014-04-29T09:38:50.058-07:00WWII : Market Garden - Promo Video !<div style="text-align: center;">
<iframe allowfullscreen="" frameborder="0" height="270" src="//www.youtube.com/embed/WXb-hy1Fcvk" width="480"></iframe></div>
Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com1tag:blogger.com,1999:blog-2898928625760423232.post-59972205639337493362014-04-04T04:13:00.002-07:002014-04-04T04:13:29.355-07:00Top-down soldiers heavy inkscaping !<br />
<br />
I finally managed to finish the top-down assets for my super cool new Android game called WWII : Market Garden.<br />
<br />
Here are the US and german soldiers sprites with shooting, hiding, death, and moving positions.<br />
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsndQGaNa9T6A0N74Q2KUDc3iKNnwXW4KyOIamht31-rmhxDbR-s-TAtAoblxkyQu33auLaqfLRstyTa33n9z7UsndHKqLtKU-zIQq7O1M-3hJwqNbCLg3nT53zqwTIZhFQgsrUiGLN78/s1600/usa_bazooka_soldier.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjsndQGaNa9T6A0N74Q2KUDc3iKNnwXW4KyOIamht31-rmhxDbR-s-TAtAoblxkyQu33auLaqfLRstyTa33n9z7UsndHKqLtKU-zIQq7O1M-3hJwqNbCLg3nT53zqwTIZhFQgsrUiGLN78/s1600/usa_bazooka_soldier.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkfjMU3LgOby5Pb_ZEMMrK3cWThQt1ACaApzm_xDbArT03JTejO23mfNeQ9FQ6b_AB7AhC2q0yUgVVlrlaGXa2m2vlNPAt5Y1dZ1Lnhc956BIql1xPFo6SBNtvFojlcjQZelfbDUvsdKE/s1600/german_rifle_soldier.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjkfjMU3LgOby5Pb_ZEMMrK3cWThQt1ACaApzm_xDbArT03JTejO23mfNeQ9FQ6b_AB7AhC2q0yUgVVlrlaGXa2m2vlNPAt5Y1dZ1Lnhc956BIql1xPFo6SBNtvFojlcjQZelfbDUvsdKE/s1600/german_rifle_soldier.png" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
It took me 3 hours to get it done using Inkscape, inspired by this awesome blog post :</div>
<div class="separator" style="clear: both; text-align: center;">
<a href="http://2dgameartforprogrammers.blogspot.co.uk/2012/04/top-down-view-soldier.html">http://2dgameartforprogrammers.blogspot.co.uk/2012/04/top-down-view-soldier.html </a></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
The moving animation is very simple but it does the job in game !</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
<div class="separator" style="clear: both; text-align: center;">
<br /></div>
Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com5tag:blogger.com,1999:blog-2898928625760423232.post-8689883941861107032014-03-22T09:41:00.003-07:002014-03-22T09:56:48.311-07:00Your lonely Island in HTML 5<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSd4v2THS7eILKgU9wZwOzL6yLb5xyDJMNH_v7iRQQBp_zpkSQots2uvlGAgQWQZKrHVfHwt1zbmOCXofogMpcpAOQ3RU7vuF_G7KiHBvqPtQM0PK6QXtrbXa96itsNi1-HBu9r78Ops/s1600/Screenshot+from+2014-02-26+00:15:42.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEhxSd4v2THS7eILKgU9wZwOzL6yLb5xyDJMNH_v7iRQQBp_zpkSQots2uvlGAgQWQZKrHVfHwt1zbmOCXofogMpcpAOQ3RU7vuF_G7KiHBvqPtQM0PK6QXtrbXa96itsNi1-HBu9r78Ops/s1600/Screenshot+from+2014-02-26+00:15:42.png" height="341" width="640" /></a></div>
<br />
<br />
<div style="text-align: center;">
<div style="text-align: left;">
Have you ever dreamt of having a private Island on your own ? </div>
<div style="text-align: left;">
<br /></div>
<div style="text-align: left;">
Now dreams come true with this fun Web project in HTML5 / three.js / WebGL : walk on your own peaceful lonely island and have an ultra zen rest listening to the ocean.</div>
</div>
<div style="text-align: center;">
<br />
<br />
<u>Link</u>: <a href="http://www.gouchstudio.com/island">http://www.gouchstudio.com/island</a><br />
<br /></div>
<div style="text-align: center;">
<u>Sources</u> : <a href="https://github.com/guillaume-gouchon/island">https://github.com/guillaume-gouchon/island</a> </div>
<div style="text-align: center;">
<br />
<br /></div>
Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com0tag:blogger.com,1999:blog-2898928625760423232.post-7690790682731778392014-01-28T09:16:00.004-08:002014-01-28T09:31:19.080-08:00Whaaaaat ? A complete Warcraft-like playable in a Web Browser ?<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Wq7wbDWfHmufsUN9jd3oVbQXtxwZ6NcJQGsOiWb5bMfeWGVGtKATLq3-BuTftl-ThueLmbhmX0LHnGg8SoGYRlGKruVsMfhftMP7jmm_MpTE53uWKQj9OAEa-F8K0jaDmVE6StqTg3U/s1600/Capture+du+2014-01-28+16:37:08.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEh7Wq7wbDWfHmufsUN9jd3oVbQXtxwZ6NcJQGsOiWb5bMfeWGVGtKATLq3-BuTftl-ThueLmbhmX0LHnGg8SoGYRlGKruVsMfhftMP7jmm_MpTE53uWKQj9OAEa-F8K0jaDmVE6StqTg3U/s1600/Capture+du+2014-01-28+16:37:08.png" height="362" width="640" /></a></div>
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;"><br /></span>
<br />
<div style="text-align: justify;">
<span style="font-family: inherit;"><a href="http://warnode.com/">Warnode.com</a> is a 3D Multiplayer Real-Time Strategy Game in HTML5 / WebGL, a kind of tribute to Warcraft 3, Age Of Empires and Starcraft.</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">IMAO, 3D Gaming in the browser is going to be huge in the following years. </span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">Advantages are numerous : let's imagine you have a 20 minutes break at work, you just have to open a new tab in your browser to start playing against your neighbors; no more need to install stuff, check versions, update clients, etc... It can also attract many casual players, bored by poor farm and candy games.</span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;"><br /></span></div>
<div style="text-align: justify;">
<span style="font-family: inherit;">Recently, I restarted to work on Warnode : I have added some animations (finally !), cool-looking heightmaps, more stability and better visuals. </span><br />
<span style="font-family: inherit;"><br /></span>
<span style="font-family: inherit;">It is still under development but one day... it will look awesome !</span></div>
<br />
<br />
<br />Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com1tag:blogger.com,1999:blog-2898928625760423232.post-39170536717443759912013-10-09T03:03:00.002-07:002013-10-09T03:07:31.857-07:00How to implement a cool falling letter effect on Android ?<br />
Hey bros and sistas !<br />
<br />
Here I'll describe how to create a super animation of letters falling one after the other, which can be used in a splashscreen for example ...<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td style="text-align: center;"><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6T9v45y9DB02VrOzieMVNcFUxZhH5jiNHJYnyoWY4P_C18qzaTLyP0OvJyqzmrOVgx_hcfY4B4XziTlzbQmZma7yfGHnukO4FTRPTfBdkWWFSSEig-6Jyf_wWbpX6gjsTEhGonsf8Hkg/s1600/device-2013-10-09-103112.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEj6T9v45y9DB02VrOzieMVNcFUxZhH5jiNHJYnyoWY4P_C18qzaTLyP0OvJyqzmrOVgx_hcfY4B4XziTlzbQmZma7yfGHnukO4FTRPTfBdkWWFSSEig-6Jyf_wWbpX6gjsTEhGonsf8Hkg/s640/device-2013-10-09-103112.png" /></a></td></tr>
<tr><td class="tr-caption" style="text-align: center;">WWII Splashscreen</td></tr>
</tbody></table><div><br />
</div><div>Let's start with the a simple horizontal LinearLayout.</div><div><br />
</div><pre class="brush: csharp">[...]
<LinearLayout
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="horizontal" >
</LinearLayout>
[...]
</pre><div><br />
</div><div>The two animations we will use : the title's general bounce effect and the individual letters' animation.</div><div><br />
</div><pre class="brush: csharp"><?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="50"
android:fromYDelta="0%"
android:repeatCount="2"
android:repeatMode="reverse"
android:toYDelta="1%" />
<?xml version="1.0" encoding="utf-8"?>
<translate xmlns:android="http://schemas.android.com/apk/res/android"
android:duration="200"
android:fillAfter="true"
android:fromYDelta="-100%p"
android:interpolator="@android:anim/accelerate_interpolator"
android:startOffset="100"
android:toYDelta="0%p" />
</pre><br />
<div>Then, in the UI setup, add one text view for each letter of the word displayed.</div><div><br />
</div><pre class="brush: csharp">[...]
String appPublisher = getString(R.string.app_publisher);
for (int n = 0; n < appPublisher.length(); n++) {
char c = appPublisher.charAt(n);
TextView letterTV = new TextView(this);
letterTV.setText("" + c);
letterTV.setVisibility(View.GONE);
mTitleLayout.addView(letterTV);
}
[...]
</pre><br />
<div>Now, initialize the animations !</div><div><br />
</div><pre class="brush: csharp">[...]
mBounceAnimation = AnimationUtils.loadAnimation(this, R.anim.bounce_effect);
mLetterAnimation = AnimationUtils.loadAnimation(this, R.anim.falling_letter);
mLetterAnimation.setAnimationListener(new AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationRepeat(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
// start next letter animation and the general bounce effect
startNextFallingLetterAnimation();
mTitleLayout.startAnimation(mBounceAnimation);
}
});
[...]
</pre><div><br />
</div><div>As you can see, when one letter animation is over, it runs the method "startNextFallingLetterAnimation". Let's implement this method now !</div><div><br />
</div><pre class="brush: csharp">private int mCurrentAnimationPlaying = 0;
[...]
private void startNextFallingLetterAnimation() {
if (mCurrentAnimationPlaying < mTitleLayout.getChildCount()) {
// reset previous view's animation
if (mCurrentAnimationPlaying > 0) {
mTitleLayout.getChildAt(mCurrentAnimationPlaying - 1).setAnimation(null);
}
// play next animation
View nextLetter = mTitleLayout.getChildAt(mCurrentAnimationPlaying);
nextLetter.setVisibility(View.VISIBLE);
nextLetter.startAnimation(mLetterAnimation);
mCurrentAnimationPlaying++;
}
}
</pre><br />
<div>Aaaaannnnnd that's it ! Each letter will fall one after the other and each time a bounce effect on the overall title view will be visible. And it really looks cool !</div><div><br />
</div><div>See you for a next article through WWII project's advancement !</div><div><br />
</div><div>Cheers</div>Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com0tag:blogger.com,1999:blog-2898928625760423232.post-81114731802147911012013-10-07T03:03:00.001-07:002013-10-07T07:24:36.452-07:00How to implement an awesome fullscreen video background on Android ?<br />
Hey folks !<br />
<br />
I'll describe here how I managed to get this awesome fullscreen video background for my next Android Game Project : WWII.<br />
<br />
<table align="center" cellpadding="0" cellspacing="0" class="tr-caption-container" style="margin-left: auto; margin-right: auto; text-align: center;"><tbody>
<tr><td><a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1fc3WO3OE_K9LFB1BrPc7hsSBBW8uD-MzluEkUpo8cnQ-sMhYJbfuYo45TLOtg6uv_mvTl4sAfsPYHVvAEJshTelFwlxPyh0cgKmE0gTBObaNUCmBScgwdKlSl5OMafC0z9lybqdPe-c/s1600/device-2013-10-07-100332.png" imageanchor="1" style="margin-left: auto; margin-right: auto;"><img border="0" height="360" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEi1fc3WO3OE_K9LFB1BrPc7hsSBBW8uD-MzluEkUpo8cnQ-sMhYJbfuYo45TLOtg6uv_mvTl4sAfsPYHVvAEJshTelFwlxPyh0cgKmE0gTBObaNUCmBScgwdKlSl5OMafC0z9lybqdPe-c/s640/device-2013-10-07-100332.png" width="640" /></a></td></tr>
<tr><td class="tr-caption" style="font-size: 13px;">The screenshot is in a quite low quality I am afraid !</td></tr>
</tbody></table>
<br />
So, first in the layout, let's add a simple VideoView into a RelativeLayout :<br />
<pre class="brush: csharp"><RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/rootLayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:color/black" >
<VideoView
android:id="@+id/backgroundVideo"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true" />
[...]
</RelativeLayout>
</pre>
In order to stretch the video to make it fullscreen, the dirty hack resides in the four "layout_align..." values.<br />
<br />
Ok now, let's have a look at the code :<br />
<br />
<pre class="brush: csharp">[...]
// setup background video
mBackgroundVideoView = (VideoView) findViewById(R.id.backgroundVideo);
Uri videoUri = Uri.parse("android.resource://" + getPackageName() + "/"
+ R.raw.video_bg_home);
mBackgroundVideoView.setVideoURI(videoUri);
[...]
</pre>
<br />
Now let's start and pause the video according to the Activity's lifecycle :<br />
<br />
<pre class="brush: csharp">private int mVideoStopPosition = 0;
[...]
@Override
protected void onStart() {
super.onStart();
mBackgroundVideoView.seekTo(mVideoStopPosition);
mBackgroundVideoView.start();
}
@Override
protected void onPause() {
super.onPause();
// store the stop position to restart the video at the correct position
mVideoStopPosition = mBackgroundVideoView.getCurrentPosition();
mBackgroundVideoView.pause();
if (mAboutDialog != null) {
mAboutDialog.dismiss();
}
}
</pre>
<br />
If you want to disable the sound of the video and make it repeat when it ends, here is how I did it :<br />
<br />
<pre class="brush: csharp">[...]
mBackgroundVideoView.setOnPreparedListener(mPreparedListener);
[...]
// remove background video sound - enable video looping
MediaPlayer.OnPreparedListener mPreparedListener = new MediaPlayer.OnPreparedListener() {
@Override
public void onPrepared(MediaPlayer m) {
try {
if (m.isPlaying()) {
m.stop();
m.release();
m = new MediaPlayer();
}
// disable sound
m.setVolume(0f, 0f);
// repeat video
m.setLooping(true);
m.start();
} catch (Exception e) {
e.printStackTrace();
}
}
};
</pre>
<br />
That's it for now ! Watch out this blog for further cool tips through WWII advancement.
<br />
Tchuss !Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com0tag:blogger.com,1999:blog-2898928625760423232.post-54756184370402992122013-04-02T16:36:00.002-07:002013-04-02T16:36:12.544-07:00Week 3 : Project Code Awesome (3D Multiplayer RTS Game) <div class="separator" style="clear: both; text-align: center;">
<object width="320" height="266" class="BLOGGER-youtube-video" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0" data-thumbnail-src="http://i.ytimg.com/vi/I_9092VmlRk/0.jpg"><param name="movie" value="http://www.youtube.com/v/I_9092VmlRk?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" /><param name="bgcolor" value="#FFFFFF" /><param name="allowFullScreen" value="true" /><embed width="320" height="266" src="http://www.youtube.com/v/I_9092VmlRk?version=3&f=user_uploads&c=google-webdrive-0&app=youtube_gdata" type="application/x-shockwave-flash" allowfullscreen="true"></embed></object></div>
<br />Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.comtag:blogger.com,1999:blog-2898928625760423232.post-13334529156715569452013-03-27T17:43:00.001-07:002013-03-27T17:45:03.299-07:00+ 2 Weeks : my new 3D Multiplayer Online RTS Side Project <div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/zOzMHjqm0hw?feature=player_embedded' frameborder='0'></iframe></div>
<br />Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.comtag:blogger.com,1999:blog-2898928625760423232.post-84860721280160732002013-03-08T09:45:00.000-08:002013-03-08T09:45:38.775-08:00Dungeon Quest - Main Theme<div class="separator" style="clear: both; text-align: center;">
<iframe allowfullscreen='allowfullscreen' webkitallowfullscreen='webkitallowfullscreen' mozallowfullscreen='mozallowfullscreen' width='320' height='266' src='https://www.youtube.com/embed/9t212cka3q4?feature=player_embedded' frameborder='0'></iframe></div>
<br />Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.comtag:blogger.com,1999:blog-2898928625760423232.post-42820866191537240972012-08-02T10:22:00.001-07:002013-05-24T04:03:58.712-07:00DQ : statistics after 20 days<span style="font-family: Verdana, sans-serif;">Heeeey guys, </span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">Here are some Dungeon Quest's interesting figures, 20 days after its release(which has </span><span style="font-family: Verdana, sans-serif;">now</span><span style="font-family: Verdana, sans-serif;"> become the Year 0 of humanity) :</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">- 4521 bugs (joke).</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">- <b>2600</b> downloads ! With <b>41%</b> of active users !</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">- <b>24</b> ratings (less than 1% of players), with an average of <b>4.5/5.</b></span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">- <b>2.3%</b> of users have bought the full Game with in-app payment.</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<span style="font-family: Verdana, sans-serif;">It is quite motivating as I haven't done any advertisement so far and as the next update will reach an amazing level of awesomeness !</span><br />
<span style="font-family: Verdana, sans-serif;"><br /></span>
<div class="separator" style="clear: both; text-align: center;">
<a href="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzZrO6hj0sqGmEFkMTXo-yTtMjG0RiJVHIqRdJDMFEAiaaFe708G_qg-NCEEm0U3NU2uAogv-ytLPBP0SCNwyD7KLxdQY9jZf5SOz0Qg1RNO-z-OtHxApyj0QwrhNzMEqU2NrWGVld5f8/s1600/promo2.png" imageanchor="1" style="margin-left: 1em; margin-right: 1em;"><img border="0" height="180" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjzZrO6hj0sqGmEFkMTXo-yTtMjG0RiJVHIqRdJDMFEAiaaFe708G_qg-NCEEm0U3NU2uAogv-ytLPBP0SCNwyD7KLxdQY9jZf5SOz0Qg1RNO-z-OtHxApyj0QwrhNzMEqU2NrWGVld5f8/s320/promo2.png" width="320" /></a></div>
<div class="separator" style="clear: both; text-align: center;">
</div>
Anonymoushttp://www.blogger.com/profile/07712962881028332458noreply@blogger.com