-
Notifications
You must be signed in to change notification settings - Fork 14
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
provide non hook abstraction for custom update #100
Comments
actually you can do this now: using System;
using Love;
namespace Project1
{
class Issue_100: Scene
{
bool sholdClosed = false;
public override bool Quit()
{
sholdClosed = true; // mark it as true to break loop
return false; // return true will lead Application.Exit();
}
static void Main()
{
Boot.Init();
var scene = new Issue_100();
while (!scene.sholdClosed)
{
Boot.SystemStep(scene); // poll the event
Graphics.Clear(); // clean the window
Graphics.Line(Vector2.Zero, Mouse.GetPosition());
Graphics.Present(); // show the next frame
if (Keyboard.IsPressed(KeyConstant.Space)) // update logic
scene.sholdClosed = true;
Window.SetTitle("fps:" + FPSCounter.GetFPS());
}
Console.WriteLine("-end-");
}
}
} Dose it can meet your requirements ❓ |
kinda ya but It would be better if it required less implementation. |
may be you mean: Main(...)
{
Boot.Init();
while (!Boot.QuitFlag)
{
Boot.SystemStep();
// or do this .....
//Boot.SystemStep(new Boot.SystemStepConfig(){
// OnKeyPressed = (k, s, i) => Console.WriteLine(k),
//});
Graphics.Clear();
Graphics.Line(Vector2.Zero, Mouse.GetPosition());
Graphics.Present();
if (Keyboard.IsPressed(KeyConstant.Space))
Boot.QuitFlag = true;
Window.SetTitle("fps:" + FPSCounter.GetFPS());
}
Console.WriteLine("-end-");
} |
@endlesstravel yep but Main(...)
{
Boot.Init(800, 600, "fps:" + FPSCounter.GetFPS());
///Window.SetTitle(); //optional Boot.Init() can Initialize window width, height and title.
while (!Boot.IsRunning())
{
// Boot.SystemStep is not needed at all it is updated by Boot.Init(); using a object
Graphics.Clear();
Graphics.Line(Vector2.Zero, Mouse.GetPosition());
Graphics.Present();
if (Keyboard.IsPressed(KeyConstant.Space))
Boot.QuitFlag = true;
}
Console.WriteLine("-end-");
}`` |
i will not push the function : I had add new way to |
I'm not sure what you mean by Boot.IsRunning() is confusing. |
so I just was messing around with RayLibCS and I really liked how the main loop worked.
it allowed the user to control the flow of the program and draw inside the things like load and update functions.
here is a example..
I think Love2d cs should allow something like this even if it was a optional thing.
it Love could update the stuff behind the scenes and allow the user to control the flow of the program.
for example..
The text was updated successfully, but these errors were encountered: