visually recode c# to javascript
Posted: Tue Sep 09, 2014 7:09 pm
Does anyone know of a book or tutorial or any information on how to visually look at a C# program and try to recode it into javascript? Like maybe look at this thing in C# and that would be equevalant to that in javascript. Thank you. For example:
I presume the public virtual void Show(){} down down below in the code mentioned above could be coded into javascript as:
Just having a hard time in trying to think out what it would look like and what to look for in conversion.
Also this code was used as an example from the website tutorial on showing how to make a C# game with XNA. http://xnagpa.net/rpgtutorials.html
Code: Select all
using System;
using System.Collections.Generic;
using System.Linq;
using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;
using Microsoft.Xna.Framework.Net;
using Microsoft.Xna.Framework.Storage;
namespace New2DRPG.CoreComponents
{
public class GameScreen : Microsoft.Xna.Framework.DrawableGameComponent
{
private List<GameComponent> childComponents;
public GameScreen(Game game)
: base(game)
{
childComponents = new List<GameComponent>();
Visible = false;
Enabled = false;
}
public List<GameComponent> Components
{
get { return childComponents; }
}
public override void Initialize()
{ base.Initialize();
}
public override void Update(GameTime gameTime)
{
foreach (GameComponent child in childComponents)
{
if (child.Enabled)
{
child.Update(gameTime);
}
}
base.Update(gameTime);
}
public override void Draw(GameTime gameTime)
{
foreach (GameComponent child in childComponents)
{
if ((child is DrawableGameComponent) &&
((DrawableGameComponent) child).Visible)
{
((DrawableGameComponent) child).Draw(gameTime);
}
}
base.Draw(gameTime);
}
public virtual void Show()
{
Visible = true;
Enabled = true;
}
public virtual void Hide()
{
Visible = false;
Enabled = false;
}
}
}Code: Select all
function Show() {
'use strict';
var visible, enabled;
visible = true;
enabled = true;
}
Also this code was used as an example from the website tutorial on showing how to make a C# game with XNA. http://xnagpa.net/rpgtutorials.html