本文整理汇总了C#中SFML.Graphics.RenderWindow.Capture方法的典型用法代码示例。如果您正苦于以下问题:C# RenderWindow.Capture方法的具体用法?C# RenderWindow.Capture怎么用?C# RenderWindow.Capture使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SFML.Graphics.RenderWindow
的用法示例。
在下文中一共展示了RenderWindow.Capture方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Main
public static void Main(String[] args)
{
RenderWindow window = new RenderWindow(new VideoMode(1000, 700), "title");
RenderTexture tex = new RenderTexture(1000, 700);
Sprite texSprite = new Sprite(tex.Texture);
Fractal fractal = new Fractal();
fractal.CreateTreeFractal(500, 700, 3, 100, 0);
Console.WriteLine(fractal.Nodes.Count);
while (window.IsOpen())
{
window.Clear();
tex.Clear(new Color(0, 0, 0, 200
));
foreach (Shape s in fractal.Nodes)
{
window.Draw(s);
}
tex.Display();
window.Draw(texSprite);
window.Display();
Image img = window.Capture();
img.SaveToFile("C:/i.png");
Console.ReadLine();
}
}
示例2: Main
//MAIN()
static void Main(string[] args)
{
dominosposition = new List<Vector2f>();
GameDomino = new Domino_NormalRules();
GameDomino.start_game();
dominoAi.DominoAI DominoAi = new dominoAi.DominoAI();
DominoAi.set_game(GameDomino);
renderalldominos = new MySFML.RenderAllDominos();
path_ImageBlockDomino = "resources/blockdomino.png";
if (!File.Exists(path_ImageBlockDomino))
{
Console.WriteLine("ImageBlockDomino not founded");
return;
}
renderalldominos.set_image(new Image(path_ImageBlockDomino));
String path_ImageBackground = "resources/background.png";
if (!File.Exists(path_ImageBackground))
{
Console.WriteLine("background not founded");
return;
}
Image imagebackground = new Image(path_ImageBackground);
Texture texturebackground = new Texture(imagebackground);
texturebackground.Repeated = true;
Sprite background = new Sprite(texturebackground, new IntRect(0,0,(int)WidthWindow, (int)HeightWindow));
String path_icon = "resources/icon.png";
if (!File.Exists(path_icon))
{
Console.WriteLine("path_icon not founded");
return;
}
Image image_icon = new Image(path_icon);
path_Font = "resources/font.ttf";
if (!File.Exists(path_Font))
{
Console.WriteLine("Font not founded");
return;
}
Text score = new Text("Dupa", new Font(path_Font));
path_image_button = "resources/button151x54.png";
if (!File.Exists(path_image_button))
{
Console.WriteLine("Image button not founded");
return;
}
//left BUTTON
left = new MySFML.MyButton();
left.load_image(new Image(path_image_button), "left side", new Font(path_Font));
left.set_position(new Vector2f(WidthWindow - 200, 350));
//right BUTTON
right = new MySFML.MyButton();
right.load_image(new Image(path_image_button), "right side", new Font(path_Font));
right.set_position(new Vector2f(WidthWindow - 200, 404));
//draw BUTTON
draw = new MySFML.MyButton();
draw.load_image(new Image(path_image_button), "draw domino", new Font(path_Font));
draw.set_position(new Vector2f(WidthWindow - 200, 458));
//restart BUTTON
restart = new MySFML.MyButton();
restart.load_image(new Image(path_image_button), "restart" , new Font(path_Font));
restart.set_position(new Vector2f(WidthWindow - 200, 512));
score.Color = Color.Black;
score.CharacterSize = 20;
score.Position += new Vector2f(WidthWindow - 200, 100);
ContextSettings contextSettings = new ContextSettings();
contextSettings.DepthBits = 32;
RenderWindow window = new RenderWindow(new VideoMode((uint)WidthWindow, (uint)HeightWindow), "Domino Game", Styles.Default, contextSettings);
window.SetVerticalSyncEnabled(true);
window.SetIcon(32, 32, image_icon.Pixels);
window.Closed += new EventHandler(closed_action);
window.KeyPressed += new EventHandler<KeyEventArgs>(key_pressed);
window.MouseButtonPressed += new EventHandler<MouseButtonEventArgs>(mouse_pressed);
window.SetFramerateLimit(60);
bool openWindow = new bool();
openWindow = true;
windowcapture = new Texture(window.Capture());
score.Color = Color.White;
while (window.IsOpen() && openWindow)
{
try
{
DominoAi.play();
//.........这里部分代码省略.........