DCSIMG
JavaScript - Shai Raiten's Blog

Shai Raiten's Blog

It's all about code...

Browse by Tags

All Tags » JavaScript (RSS)
SignalR Isn’t Working on Samsung Galaxy 3
I know you think the title is wired, because what is the relation between SignalR (WebSockets) and a specific device such as Samsung Galaxy 3? ASP.NET SignalR is a new library for ASP.NET developers that makes it incredibly simple to add real-time web functionality to your applications. What is "real-time web" functionality? It's the ability to have your server-side code push content to the connected clients as it happens, in real-time. While working on a project working with SignalR...
פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 5
זהו החלק האחרון בנושא סופר 8 , אני אמשיך להרחיב בנושא JavaScript ופיתוח מחשקים בכללי אבל היום אני רוצה לסגור את הדברים הבסיסיים בפיתוח משחק סופר 8. בחלק הקודם פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 4 דיברנו על איך להפוך את המשחק ליותר אינטרקטיבי ע”י הוספת רקעים ואלמנטים נוספים למשחק,  ראינו איך אפשר בצורה קלה ונוחה לטעון את כל הגרפיקה (ועוד) בעזרת ספריית PreloadJS ולהתחיל את המשחק כאשר קיבלנו את כל הדברים בנחוצים למשחק. בפוסט היום נראה איך אפשר לבצע קפיצה של המשתמש (לא רק אנימציה...
פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 4
בפוסט הקודם חלק 3 – פיתוח משחקים ב – JavaScript דיברנו על איך להזיז את הדמות במרחב המשחק ואיך לשנות את כיון התמונה שתתאים לכיון שהדמות הולכת אליו. בפוסט הזה נדבר על יצירת אווירה (רקע ואלמנטים נוספים) למשחק, לא סתם איך להוסיף תמונות רקע נדבר על איך לגרום לרקע לנוע יחד עם הדמות עלל מנת ליצור תחושה של תנועה מתמשכת. בפוסט זה נשתמש בספריה נוספת שנקראת – PreloadJS , שגם שייכת לסט הספריות של Create JS. (עד עכשיו השתמשנו ב – EASE JS שגם משתייכת לשם) ספריית Preload JS, מאפשרת טעינה של קבצי מוסיקה, תמונות...
פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 3
בפוסט הקודם חלק 2 בפיתוח משחקים ב – JavaScript דיברנו על מה זה  Sprite ואיך בעזרת ספרייה EASE JS להציג רצף תמונות מאותו מקבץ תמונות על מנת להציג אנימציה למשתמש. בפוסט הזה נדבר על איך להזיז את הדמות במרחב על פי הפעולה שהדמות מבצעת. המשימה הראשונה שלנו היא להזיז את הדמות במרחב המשחק, על מנת לבצע זאת נשנה את פונקציית tick באופן הבא: ראשית, נגדיר תחום משחק – תחום המשחק ימנע מהדמות שלנו לבצע מגבולות המשחק. בתוך פונקציית tick נוסיף את הקוד הבא: if (player.x >= id( "gameCanvas" ).width...
פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 2
בפוסט הקודם חלק 1 – פיתוח משחקים ב – JavaScript דיברנו על פיתוח משחקים ב – JavaScript בעזרת ספרית EASE JS, ספריה המאפשרת לנו לעבוד עם אוביקט Canvas של HTML 5 בצורה קלה ונוחה. בפוסט הקודם הדגמתי איך בצורה קלה נוכל להשתמש באוביקט Stage על מנת להכיל את כל האלמנטים של המשחק ושימוש ב – Ticker על מנת לעדכן את האלמנטים בתוך לולאת המשחק. הפוסט הזה ירחיב את הנושא ונתקדם למימוש פעולות של השחקן עד ידי הפעלת אנימציה ספציפית לכל פעולה. לפני שאנחנו נכנסים לקוד צריך להבין להכיר אוביקט חשוב שנקרא – Sprite: Sprite...
פיתוח משחקים ב JavaScript - מבוסס על משחק סופר 8 - חלק 1
פיתוח משחקים בשבילי זה תחביב ואולי אפילו קצת יותר, אין לי דרך יותר טובה לנסח את זה – זה פשוט מגניב!!! פיתוח משחקים כמעט תמיד הופך למשימה מאוד מורכבת, ככל שרוצים להגיע לרמה גבוה יותר של משחק, אבל בשביל דברים פשוטים אפשר בקלות להתחיל לפתח משחקים לבד ובכל שפה שתרגישו נוח לפתח, אני חושב שלא קיימת שפה שבה לא נוכל לפתח משחקים (חלק אולי פחות מרשימים – אבל בהחלט אפשרי). אין מחקר שמוכיח זאת אבל היום השפה הפופולרית ביותר היא כנראה JavaScript, כמובן בגלל האינטרנט וכניסתו של HTML 5 כתקן עולמי וכמובן זה יכול...
Windows App Cert Kit Failed - The bytecode generation test detected the following errors
In the past couple of weeks I’ve worked on Cordova (PhoneGap) application for Windows 8, just before we intent to publish it to the store I’ve encountered a problem – “bytecode generation test detected“. To give your app the best chance of getting certified you should run the some tests, beside checking for bugs and making sure your application works as expected you should use the App Cert Kit - Windows 8 apps must use the new Windows App Certification Kit to become certified and eligible for sale...
How To: Compress Files In WinRT
Windows Store apps are aligned with PLM philosophy (Only active application will use device resources), and because of this most Windows Store apps needs to save their data locally until the next application execution. Windows Store apps can also use the Roaming folder to save files and settings that will be sync with the user Windows Live account, when saving settings or files to Roaming folder you need to make sure those files are not too big so Windows 8 will be able to sync the Roaming folder...
How To: Keep Windows 8 Device Screen On While User Away
While working with a customer on GPS system for Windows Store app, an important question raised: How we can prevent from Windows to turn off the screen due to user inactivity? Normally, a Windows 8 device will dim the display (and eventually turn it off) to save battery life when the user is away. Now for our system we need to keep the display on at all times, to do that call requestActive function to notify Windows that the app requires the display to remain on. Windows automatically deactivates...
Why Background Audio Isn’t Working?
Using HTML 5 we can play audio very easily in your Windows Store app, all you need to do is setting an audio element specify the object properties and that’s it. var audioElement= document.createElement( 'audio' ); audioElement.setAttribute( "id" , "audtag" ); audioElement.setAttribute( "controls" , "true" ); audioElement.setAttribute( "src" , fileToPlay); audioElement.setAttribute( "autoplay" , "true" ); audioElement.load...
Link To Windows Store App From Web Sites
While working on Windows Store app for a customer he asked me – how I can promote my app on that company web site, I said this is very simple all you need to do is adding a Windows Store protocol link and once the user will click on that link (Only if his using Windows 8), the app page will appear in Windows Store app. Windows Store protocol link So, how do I add a link to my Windows Store app? src or href => ms-windows-store following by the Package Family Name PDP - Open an app listing page...
Creating Windows Store App Using PhoneGap (Cordova)
There is new PhoneGap release called – Cordova or PhoneGap 2.2.0 that supports WinRT features, in this post I’ll demonstrate some of the basics of PhoneGap for Windows Store apps. Download Demo Project What is PhoneGap? PhoneGap is a free and open source framework that allows you to create mobile apps using standardized web APIs for the platforms you care about. This means that using PhoneGap in your Windows Store app can also be used by other Mobile OS such as iOS, Android, Windows Phone 7, Blackberry...
Windows Store App - Resize Image (JavaScript)
In this post I’ll demonstrate how to change picture size using JavaScript while constraining the image proportions. Resize image functionality can be used in several scenarios in Windows Store app, for example: if your app allow the user to download images from the web you might want to resize the image to reduce space usage. Also if you whish to share this image using Roaming Storage you need to make sure the image size is small enough so the Roaming sync will not failed. The first steps for this...
Windows 8 Metro – Code Behind
When I develop Windows 8 Metro App I usually use Windows Store app samples to see code examples features but sometimes you want more… For example I really want to know how “Mail” metro app works: How getting access to other email account, sending email and more. So in order to to that I had to gain access to “Mail” metro app… Let’s start the Hack: Problem: WindowsApps folder is blocked and by default you can’t open this folder. Solution : First open Windows Explorer and navigate into “C:\Program...
Using Live SDK in Windows 8 – JavaScript
In my previous post I talked about Using Live SDK in Windows 8 – C# , now it’s time to see how you can do the same things using JS. Live SDK provides a set of controls and APIs that enable applications to integrate single sign-on (SSO) with Microsoft accounts and access information from SkyDrive, Hotmail, and Windows Live Messenger on Windows Phone and Windows 8. Live SDK support several platforms such as: iOS, Android and of course Windows Phone and Windows 8 applications using C# and JS. In this...
More Posts Next page »