Skip to content

Instantly share code, notes, and snippets.

2014-07-07 21:48:23.057 mono[699:507]
No Info.plist file in application bundle or no NSPrincipalClass in the Info.plist file, exiting
/Users/thill/Projects/FNATestGame/FNATestGame/Info.plist
/Users/thill/Projects/FNATestGame/FNATestGame/bin/Debug/FNATestGame.app/Contents/Info.plist
public class Game
{
Sdl2Graphics window;
public static void Main(string[] args)
{
window = new Sdl2Graphics(new Size(450, 450));
}
}
using System;
using System.Drawing;
using SDL2TestGame.RendererSDL2;
namespace SDL2TestGame
{
public class Game
{
static Sdl2Graphics window;
public void DrawSomeRect()
{
SDL.SDL_SetRenderDrawColor(renderer, 0, 175, 175, 0);
SDL.SDL_RenderClear(renderer);
var rectangle = new SDL.SDL_Rect();
rectangle.x = rectangle.y = 50;
rectangle.w = rectangle.h = 50;
SDL.SDL_RenderDrawRect(renderer, ref rectangle);
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
@phrohdoh
phrohdoh / SpeedQuestion.cs
Last active August 29, 2015 14:03
Which is faster? I assume the first.
var near = self.World.FindActorsInCircle(self.CenterPosition, info.Range);
foreach (var actor in near)
{
var foo = actor.TraitOrDefault<FooBar>();
if (foo == null) return;
// do stuff
}
var near = self.World.FindActorsInCircle(self.CenterPosition, info.Range)
.Where(a => a.HasTrait<FooBar>());
// existing code
Actor ChooseTarget(Actor self, WRange range)
{
nextScanTime = self.World.SharedRandom.Next(info.MinimumScanTimeInterval, info.MaximumScanTimeInterval);
var inRange = self.World.FindActorsInCircle(self.CenterPosition, range);
return inRange
.Where(a =>
a.AppearsHostileTo(self) &&
!a.HasTrait<AutoTargetIgnore>() &&
#region Copyright & License Information
/*
* Copyright 2007-2014 The OpenRA Developers (see AUTHORS)
* This file is part of OpenRA, which is free software. It is made
* available to you under the terms of the GNU General Public License
* as published by the Free Software Foundation. For more information,
* see COPYING.
*/
#endregion
class ParaDropOrderGenerator : IOrderGenerator
{
Actor self;
public ParaDropOrderGenerator(Actor self) { this.self = self; }
public IEnumerable<Order> Order(World world, CPos xy, MouseInput mi)
{
if (mi.Button == Game.mouseButtonPreference.Action)
yield return new Order("DoParadrop", self, false) { TargetLocation = xy };
class ParadropOrderTargeter : IOrderTargeter
{
public bool CanTarget(Actor self, Target target, List<Actor> othersAtTarget, TargetModifiers modifiers, ref string cursor)
{
if (target.Type != TargetType.Terrain)
return false;
var location = self.World.Map.CellContaining(target.CenterPosition);
if (!self.World.Map.Contains(location))
return false;