本文整理汇总了C#中SFML.Graphics.RenderWindow.SetFramerateLimit方法的典型用法代码示例。如果您正苦于以下问题:C# RenderWindow.SetFramerateLimit方法的具体用法?C# RenderWindow.SetFramerateLimit怎么用?C# RenderWindow.SetFramerateLimit使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.RenderWindow
的用法示例。
在下文中一共展示了RenderWindow.SetFramerateLimit方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
static void Main(string[] args)
{
game = new Game();
game.Start();
StartupForm startup = new StartupForm();
DialogResult startupResult;
do
{
startupResult = startup.ShowDialog();
if (startupResult == DialogResult.Abort)
{
Application.Exit();
Environment.Exit(1);
return;
}
}
while(startupResult == DialogResult.Cancel);
app = new RenderWindow(new VideoMode(800, 600), "FTLEdit: Ship Editor", Styles.Default);
app.Closed += new EventHandler(OnClosed);
app.KeyPressed += new EventHandler<SFML.Window.KeyEventArgs>(OnKeyPressed);
app.SetFramerateLimit(30);
while (app.IsOpen())
{
app.DispatchEvents();
app.Clear();
game.Draw(app);
game.Update();
app.Display();
if(game.cursorMode != CursorMode.PlacedBGCursor)
Application.DoEvents();
}
}
示例2: createDisplay
public static void createDisplay(bool VSync = false,int FPSCap = 60)
{
try
{
//Configure the settings of the Window
ContextSettings settings = new ContextSettings(24, 8, 4, 3, 2);
window = new RenderWindow(new VideoMode(Convert.ToUInt32(WIDTH), Convert.ToUInt32(HEIGHT)), "OpenGL", Styles.Default, settings);
Logger.Log(window.Settings.ToString(), Logger.Symbols.Warning);
if (VSync)
{
window.SetVerticalSyncEnabled(VSync);
}else
{
window.SetFramerateLimit(Convert.ToUInt32(FPSCap));
}
//Setup EventHandler
window.Closed += new EventHandler(OnClosed);
window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
window.Resized += new EventHandler<SizeEventArgs>(OnResized);
//Init OpenTK
Toolkit.Init();
OpenTK.Graphics.GraphicsContext context = new OpenTK.Graphics.GraphicsContext(new ContextHandle(IntPtr.Zero), null);
GL.Viewport(0, 0, WIDTH, HEIGHT);
}
catch (Exception e)
{
Console.Error.WriteLine(e.StackTrace);
}
}
示例3: Initialize
static void Initialize()
{
Environment.SetEnvironmentVariable("PATH", Environment.GetEnvironmentVariable("PATH") + ";" + Environment.CurrentDirectory + "\\libs");
dtClock = new Stopwatch();
textFps = new Text("0", new Font(new FileStream("assets\\fonts\\arial.ttf", FileMode.Open, FileAccess.Read)));
window = new RenderWindow(new VideoMode(1280, 768), "Test", Styles.Default);
window.SetFramerateLimit(60);
window.SetTitle("NATE");
tiles = new TileManager("assets\\tilemaps\\rpgtiles.png", 32);
iMap = new MapInterface();
//map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), true); -- for random
//map = new Map(new Vector2i(32, 32), ((int)tiles.image.Size.X / tiles.tileSize) * ((int)tiles.image.Size.Y / tiles.tileSize), false); -- blank
map = iMap.ReadMap("map1.ntm");
scaling = new Vector2f(2, 2);
textureCollection = new Texture[(tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize)];
camera = new Camera();
camera.speed = 1000;
window.Closed += (s, a) => window.Close();
window.KeyPressed += (s, a) => { if (a.Code == Keyboard.Key.Z) { iMap.WriteMap("map0.ntm", map); } };
window.MouseWheelMoved += (s, a) => { scaling.X += a.Delta * 0.075f; scaling.Y += a.Delta * 0.075f; };
dtClock.Start();
for (int i = 0; i < (tiles.image.Size.X / tiles.tileSize) * (tiles.image.Size.Y / tiles.tileSize); i++)
{
textureCollection[i] = tiles.GetTile(i);
textureCollection[i].Smooth = false;
}
}
示例4: Game
public Game()
{
window = new RenderWindow(new VideoMode(800, 600), "LoL");
window.Closed += (object sender, EventArgs e) => { (sender as Window).Close(); };
window.SetFramerateLimit(200);
gTime = new GameTime();
}
示例5: Client
public Client(RenderWindow window, ImageManager imageManager)
: base(window, imageManager)
{
this.window = window;
world = new RenderImage(800, 600);
inputManager = new InputManager(this);
ticker = new Ticker();
window.ShowMouseCursor (false);
window.SetFramerateLimit (60);
NetPeerConfiguration netConfiguration = new NetPeerConfiguration("2dThing");
client = new NetClient(netConfiguration);
uMsgBuffer = new UserMessageBuffer();
otherClients = new Dictionary<int, NetworkClient>();
chat = new Chat(this);
LoadRessources();
blockTypeDisplay = new Cube(blockType, imageManager);
blockTypeDisplay.Position = new Vector2f(window.Width - 2*Cube.WIDTH, window.Height - 2* Cube.HEIGHT);
layerDisplay = new LayerDisplay(imageManager);
layerDisplay.Position = blockTypeDisplay.Position - new Vector2f(0, 50);
mouse = new Sprite (imageManager.GetImage("mouse"));
}
示例6: initialise
public static void initialise()
{
window = new RenderWindow(new VideoMode(RESOLUTION_X, RESOLUTION_Y), "Asialaide");
// Video settings.
window.SetFramerateLimit(FRAME_LIMIT);
window.SetVerticalSyncEnabled(VSYNC);
}
示例7: Main
public static void Main()
{
VideoMode videoMode = VideoMode.DesktopMode;
videoMode.Width = 800;
videoMode.Height = 600;
using (RenderWindow renderWindow = new RenderWindow(videoMode, "SFML Test"))
{
renderWindow.SetFramerateLimit(60);
Game.Window = renderWindow;
Game.Init();
renderWindow.Closed += (sender, e) =>
{
renderWindow.Close();
};
Stopwatch stopwatch = new Stopwatch();
stopwatch.Start();
while (renderWindow.IsOpen)
{
renderWindow.DispatchEvents();
float dTime = stopwatch.ElapsedMilliseconds / 1000f;
stopwatch.Restart();
Game.ElapsedTime += dTime;
if (false && Game.Entities.OfType<Enemy>().Count() < 3)
{
Game.Entities.Add(new Enemy(Game.Player)
{
Position = Vector2.Random(renderWindow.Size.X, renderWindow.Size.Y)
});
}
if (Keyboard.IsKeyPressed(Keyboard.Key.Escape))
{
renderWindow.Close();
}
// Update code goes here
foreach (Entity entity in Game.Entities.ToArray())
{
entity.Update(dTime);
}
// Rendering code goes here
renderWindow.Clear();
foreach (Entity entity in Game.Entities.OrderBy(e => e.RenderPriority))
{
renderWindow.Draw(entity);
}
renderWindow.Display();
}
renderWindow.Close();
}
}
示例8: intialize
public override void intialize(RenderWindow window)
{
base.intialize(window);
window.SetView(new View(new FloatRect(0, 0, Game1.drawResolution.X, Game1.drawResolution.Y)));
window.SetFramerateLimit(60);
window.MouseButtonPressed += window_MouseButtonPressed;
window.KeyPressed += window_KeyPressed;
window.Resized += window_Resized;
}
示例9: Main
static void Main(string[] args)
{
//init stage and input metadata
stage = new RenderWindow(new VideoMode(800, 640), "WarGames");
stage.SetFramerateLimit(60);
//init game and start it
game = new Game(stage);
game.start();
}
示例10: Example
public Example()
{
// Create a TextDisplay to render onto our window
_example = new TextDisplay(Width, Height);
// Setup an SFML window
_window = new RenderWindow(new VideoMode(Width * _example.CharacterWidth, Height * _example.CharacterHeight), "Texter Example", Styles.Close);
_window.SetFramerateLimit(60);
_window.Closed += (sender, e) => _window.Close();
}
示例11: Game
Game()
{
Window = new RenderWindow(new VideoMode(1024u, 768u), "Living Space");
Window.SetVisible(true);
Window.SetVerticalSyncEnabled(true);
Window.SetFramerateLimit(30);
Window.Closed += OnWindowClosed;
}
示例12: Main
public static void Main(string[] args)
{
Window = new RenderWindow(new VideoMode(640, 480), "", Styles.Close);
Window.SetFramerateLimit(60);
Window.Closed += (sender, eventArgs) => Window.Close();
Window.Resized += (sender, eventArgs) =>
{
var view = new View();
view.Size = new Vector2f(eventArgs.Width, eventArgs.Height);
view.Center = view.Size / 2;
Window.SetView(view);
};
Machine = new VirtualMachine(512 * 1024);
var prog = File.ReadAllBytes("bios.bin");
for (var i = 0; i < prog.Length; i++)
Machine.Memory[i] = prog[i];
var kbd = new Devices.Keyboard(0x02, Window);
Machine.Attach(kbd);
var display = new Devices.Display(0x06, Machine, Window);
Machine.Attach(display);
var hdd = new Devices.HardDrive(0x08, "disk.img");
Machine.Attach(hdd);
var running = true;
var stepThread = new Thread(() =>
{
while (running)
{
Machine.Step();
}
});
stepThread.Start();
while (Window.IsOpen())
{
Window.DispatchEvents();
Window.Clear();
Window.Draw(display);
Window.Display();
}
running = false;
stepThread.Join();
Machine.Dispose();
}
示例13: Initialize
public void Initialize()
{
Window = new RenderWindow(new VideoMode(Screensize.X, Screensize.Y), "Planetary Explorers", Styles.Close | Styles.Titlebar, new ContextSettings(32, 32, 8, 1, 0));
var spaceMap = new SpaceMap.SpaceMap(new Vector2u(80, 30), new Vector2u(400, 300));
GM = new GameManager(Window, spaceMap);
Window.SetFramerateLimit(60);
Window.Closed += window_Closed;
}
示例14: Game
/// <summary>
/// Initializes a new instance of the <see cref="Game"/> class in debug mode.
/// </summary>
/// <param name="path">Path to the project directory.</param>
/// <param name="x">X co-ordinate of the window</param>
/// <param name="y">Y co-ordinate of the window</param>
/// <param name="width">Width of the window</param>
/// <param name="height">Height of the window</param>
public Game(string path, uint x, uint y, uint width, uint height)
{
if (!ProjectManager.Instance.LoadProject(path)) return;
RenderWindow = new RenderWindow(new VideoMode(width, height), ProjectManager.Instance.Project.Name);
RenderWindow.SetFramerateLimit(60);
if (x != 0 && y != 0)
RenderWindow.Position = new Vector2i((int)x, (int)y);
RenderWindow.Closed += OnClose;
}
示例15: SetupWindow
public void SetupWindow()
{
// create window
_window = new RenderWindow (new VideoMode (1000, 800), "Equation Invasion! - Tainted Mustard", Styles.Close);
_window.SetVerticalSyncEnabled (true);
_window.SetFramerateLimit(60);
// setup SFML event handlers
_window.Closed += new EventHandler(OnClosed);
_window.KeyPressed += new EventHandler<KeyEventArgs>(OnKeyPressed);
_window.KeyReleased += new EventHandler<KeyEventArgs> (OnKeyReleased);
_window.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(OnMouseClicked);
_window.TextEntered += new EventHandler<TextEventArgs>(OnTextEntered);
}