想象一下以下场景:您有一组PNG格式的RPG角色spritesheets,并且您希望在OpenGL应用程序中使用它们.
单独的字符(通常)大小为16乘24像素(即24像素高),并且可以处于任何宽度和高度而不留下填充.有点像:
来自最终幻想VI的Terra http://helmet.kafuka.org/terra.net/nomura/Terra.png
我已经有了代码来确定给定帧索引和大小的基于整数的剪切矩形:
int framesPerRow = sheet.Width / cellWidth;
int framesPerColumn = sheet.Height / cellHeight;
framesTotal = framesPerRow * framesPerColumn;
int left = frameIndex % framesPerRow;
int top = frameIndex / framesPerRow;
//Clipping rect's width and height are obviously cellWidth and cellHeight.
Run Code Online (Sandbox Code Playgroud)
运行此代码frameIndex = 11, cellWidth = 16, cellHeight = 24将返回一个cliprect,(32, 24)-(48, 48)假设它的右/底与宽度/高度相对.
实际的问题
现在,给定一个剪切矩形和一个X/Y坐标来放置精灵,我该如何在OpenGL中绘制它?有在零坐标顶部左侧是首选.
我们正在为我们的应用程序实现自动化回归测试,并正在寻找一个可靠的批量测试实用程序.我们有QuickTest Professional 10.0,它与"Test Batch Runner"捆绑在一起,似乎已被弃用.在以前的版本中出现了"Multi-Test Manager",它也已经停产.
有什么替代品,如果有的话?
我有俯仰,滚转和偏航角度.我如何将这些转换为方向向量?
如果你能给我看一个四元数和/或矩阵表示,那就特别酷了!
我的问题是关于数据库建模.我试图在SO上的其他数据库设计问题中寻找这个问题,但还没有找到它,所以我在这里询问:
在为应用程序设计数据库时要记住哪些一般准则和最佳实践?
数据库设计概念有哪些最好的资源/书籍/大学讲座?
谢谢.
我正在尝试为WPF Toolkit DataGrid控件构建一些简单的自定义样式.
我有一个整体DataGrid风格和风格DataGridColumnHeader.我没有设置任何控件模板,只有基本属性.
以下是我的示例DataGrid在应用自定义样式时的样子:
alt text http://img86.imageshack.us/img86/43/datagridcustomstyle.jpg
标题有渐变蓝色背景,粗体文本,填充等我想要,但有两件事情已经消失:列标题之间的分隔符和ID列的排序箭头(此列目前对其进行降序排序).
如果我没有搞乱任何控件模板,为什么分隔符和排序箭头会消失?
我甚至尝试明确设置SeparatorBrushto Black和SeparatorVisibilityto Visible,但这没有效果.
如果我恢复到默认样式,下面是我的示例DataGrid:
替代文字http://img42.imageshack.us/img42/6533/datagriddefaultstyle.jpg
分隔符和排序箭头又回来了,所以绝对是我的风格.
这是我的自定义DataGridColumnHeader样式
<Style
x:Key="DataGrid_ColumnHeaderStyle"
TargetType="wt:DataGridColumnHeader">
<Setter
Property="Padding"
Value="5,2,5,2" />
<Setter
Property="HorizontalContentAlignment"
Value="Stretch" />
<Setter
Property="VerticalContentAlignment"
Value="Stretch" />
<Setter
Property="FontWeight"
Value="Bold" />
<Setter
Property="BorderBrush"
Value="{StaticResource Media_RaisedBorderBrush}" />
<Setter
Property="Background"
Value="{StaticResource Media_RaisedBackgroundBrush}" />
<Setter
Property="Foreground"
Value="{StaticResource Media_RaisedForegroundBrush}" />
<Setter
Property="SeparatorBrush"
Value="Black" />
<Setter
Property="SeparatorVisibility"
Value="Visible" />
</Style>
Run Code Online (Sandbox Code Playgroud)
这是我的自定义DataGrid样式
<Style
x:Key="DataGrid_Style"
TargetType="wt:DataGrid">
<Setter
Property="ColumnHeaderStyle"
Value="{StaticResource DataGrid_ColumnHeaderStyle}" /> …Run Code Online (Sandbox Code Playgroud) 我在使用该IndexOf()方法时看到的所有示例List<T>都是基本字符串类型.我想知道的是如何根据一个对象变量返回作为对象的列表类型的索引.
List<Employee> employeeList = new List<Employee>();
employeeList.Add(new Employee("First","Last",45.00));
Run Code Online (Sandbox Code Playgroud)
我想找到索引在哪里 employeeList.LastName == "Something"
我正在阅读我的AI教科书,我很好奇启发式的单调性和可接受性之间的区别(我知道它们不是互相排斥的).
据我所知,一个可接受的启发式只是意味着你可以确保获得解决方案的最短路径(如果存在的话).
我正在努力的是单调属性的概念.有人可以用我可能理解的方式向我描述这个吗?
同样,我如何确定给定的启发式是否是单调/可接受的?本书中给出的一个例子是8件式滑动拼图.我正在考虑的一种启发式是不合适的瓦片,直观地我可以说我知道它是可以接受的,但我没有正式的方式来显示它是否是可接受的/单调的.
我即将购买Mac Mini,因此我可以开发iPhone应用程序.
细节是:
1.42ghz
1gb ram
75gb
OS 10.5.08
这对于开发iPhone应用程序是否足够好?
如何通过其类型来控制控件?
我有一个Control集合"TargetControls"
List<Control> TargetControls = new List<Control>();
foreach (Control page in Tabs.TabPages)
{
foreach (Control SubControl in page.Controls)
TargetControls.Add(SubControl);
}
foreach (Control ctrl in TargetControls)...
Run Code Online (Sandbox Code Playgroud)
我需要通过其特定类型访问每个现有控件(组合框,复选框等)并访问其特定属性.我现在这样做的方式只能让我访问通用控件属性.
我不能指定类似......
Combobox current = new ComboBox ["Name"]; ///引用ComboBox'名称'的实例
然后可以访问它(已经存在的)属性进行操作?
我想选择一个表的所有行,后跟一个介于1到9之间的随机数:
select t.*, (select dbms_random.value(1,9) num from dual) as RandomNumber
from myTable t
Run Code Online (Sandbox Code Playgroud)
但是随机数在行与行之间是相同的,仅与查询的每次运行不同.如何在同一执行中使行数不同?