代码拉取完成,页面将自动刷新
同步操作将从 endlesstravel/love2dCS 强制同步,此操作会覆盖自 Fork 仓库以来所做的任何修改,且无法恢复!!!
确定后同步将在后台操作,完成时将刷新页面,请耐心等待。
Create a C# console application
Please install Love2dCS from NuGet to your Visual Studio first.
Put the following code in the file(maybe Program.cs), and save it.
using Love;
namespace Example
{
class Program : Scene
{
public override void Draw()
{
Graphics.Print("Hello World!", 400, 300);
}
public override void Update(float dt)
{
// update every frame here ..
}
static void Main(string[] args)
{
Boot.Run(new Program());
}
}
}
the method of Scene
will be called just as it is named :
KeyPressed(KeyConstant key, Scancode scancode, bool isRepeat)
KeyReleased(KeyConstant key, Scancode scancode)
MouseMoved(float x, float y, float dx, float dy, bool isTouch)
MousePressed(float x, float y, int button, bool isTouch)
MouseReleased(float x, float y, int button, bool isTouch)
MouseFocus(bool focus)
WheelMoved(int x, int y)
JoystickPressed(Joystick joystick, int button)
JoystickReleased(Joystick joystick, int button)
JoystickAxis(Joystick joystick, float axis, float value)
JoystickHat(Joystick joystick, int hat, Joystick.Hat direction)
JoystickGamepadPressed(Joystick joystick, Joystick.GamepadButton button)
JoystickGamepadReleased(Joystick joystick, Joystick.GamepadButton button)
JoystickGamepadAxis(Joystick joystick, Joystick.GamepadAxis axis, float value)
JoystickAdded(Joystick joystick)
JoystickRemoved(Joystick joystick)
TouchMoved(long id, float x, float y, float dx, float dy, float pressure)
TouchPressed(long id, float x, float y, float dx, float dy, float pressure)
TouchReleased(long id, float x, float y, float dx, float dy, float pressure)
TextEditing(string text, int start, int end)
TextInput(string text)
WindowFocus(bool focus)
WindowVisible(bool visible)
WindowResize(int w, int h)
DirectoryDropped(string path)
FileDropped(File file)
Quit()
LowMemory()
Load()
Update(float dt)
Draw()
Debug/Start Debugging
or press F5
using Love;
namespace Example
{
class Program : Scene
{
Image img = null;
public override void Load()
{
img = Graphics.NewImage("logo.png");
}
public override void Update(float dt)
{
// update every frame here ..
}
public override void Draw()
{
Graphics.Draw(img, 300, 200);
}
static void Main(string[] args)
{
Boot.Run(new Program());
}
}
}
using Love;
namespace Example
{
class Program : Scene
{
Source source = null;
public override void Load()
{
source = Audio.NewSource("music.mp3");
source.play();
}
public override void Update(float dt)
{
// update every frame here ..
}
static void Main(string[] args)
{
Boot.Run(new Program());
}
}
}
Escape
to exitusing Love;
namespace Example
{
class Program : Scene
{
public override void KeyPressed(KeyConstant key, Scancode scancode, bool isRepeat)
{
if (KeyConstant.Escape == key)
Event.Quit();
}
public override void Update(float dt)
{
// update every frame here ..
}
static void Main(string[] args)
{
Boot.Run(new Program());
}
}
}
no-game
Sence will automatically runclass Program
{
static void Main(string[] args)
{
Love.Boot.Run();
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。