CGContextSetFillColorWithColor(g, [UIColor greyColor].CGColor);
Run Code Online (Sandbox Code Playgroud)
我正在尝试关注O'Reilly的书,iPhone Game Development,但是在第73页第3章我得到了这个错误:
error: request for member 'CGColor' in something not a structure or union
Run Code Online (Sandbox Code Playgroud)
根据这本书的勘误页面,这是一本未经证实的勘误表.该行可以替换哪些功能代码?
额外细节
示例项目可以在这里下载.
我在渲染函数中遇到错误,遵循本书第72页到第73页的说明,在gsMain.m的渲染函数中构建gsMain类(它与示例项目pg77不同)
本书指示构建gsMain类的代码片段如下:
//gsMain.h
@interface gsTest : GameState { }
@end
//gsMain.m
@implementation gsMain
-(gsMain*) initWithFrame:(CGRect)frame andManager:(GameStateManager*)pManager
{
if (self = [super initWithFrame:frame andManager:pManager]) {
NSLog(@"gsTest init");
}
return self;
}
-(void) Render
{
CGContextRef g = UIGraphicsGetCurrentContext();
//fill background with gray
CGContextSetFillColorWithColor(g, [UIColor greyColor].CGColor); //Error Occurs here
CGContextFillRect(g, CGRectMake(0, 0, self.frame.size.width,
self.frame.size.height));
//draw text in …Run Code Online (Sandbox Code Playgroud) 我一直致力于创建图像的网格视图,图像存在于Assets文件夹中.从android链接中的assets文件夹打开文件帮助我使用位图来读取它.我目前的代码是:
public View getView(final int position, View convertView, ViewGroup parent)
{
try
{
AssetManager am = mContext.getAssets();
String list[] = am.list("");
int count_files = imagelist.length;
for(int i= 0;i<=count_files; i++)
{
BufferedInputStream buf = new BufferedInputStream(am.open(list[i]));
Bitmap bitmap = BitmapFactory.decodeStream(buf);
imageView.setImageBitmap(bitmap);
buf.close();
}
}
catch (IOException e)
{
e.printStackTrace();
}
}
Run Code Online (Sandbox Code Playgroud)
我的应用程序确实从Assets文件夹中读取图像,但它没有遍历网格视图中的单元格.网格视图的所有单元格具有从该组图像中拾取的相同图像.任何人都可以告诉我如何迭代细胞仍然有不同的图像?
我在ImageAdapter类中有上面的代码,它扩展了BaseAdapter类,在我的主类中,我将它与我的gridview链接:
GridView gv =(GridView)findViewById(R.id.gridview);
gv.setAdapter(new ImageAdapter(this, assetlist));
Run Code Online (Sandbox Code Playgroud)
Saran,非常感谢您提前提供任何帮助
问题说,我想在c ++中使用ifstream将类的自定义数据类型数据写入文件.需要帮忙.
这个问题实际上有些不同.请参阅@ Tomalak的回答以了解OP真正想要的内容.:(
有没有办法在一个数组中的for-each循环期间存储变量/ param,并在另一个模板中使用它,即<xsl:template match="Foundation.Core.Classifier.feature">.classname应存储for-each期间出现的所有值.你会如何在XSLT中实现它?这是我目前的代码.
<xsl:for-each select="Foundation.Core.Class">
<xsl:for-each select="Foundation.Core.ModelElement.name">
<xsl:param name="classname">
<xsl:value-of select="Foundation.Core.ModelElement.name"/>
</xsl:param>
</xsl:for-each>
<xsl:apply-templates select="Foundation.Core.Classifier.feature" />
</xsl:for-each>
Run Code Online (Sandbox Code Playgroud)
这是classname应该使用参数的模板.
<xsl:template match="Foundation.Core.Classifier.feature">
<xsl:for-each select="Foundation.Core.Attribute">
<owl:DatatypeProperty rdf:ID="{Foundation.Core.ModelElement.name}">
<rdfs:domain rdf:resource="$classname" />
</owl:DatatypeProperty>
</xsl:for-each>
</xsl:template>
Run Code Online (Sandbox Code Playgroud)
目前我在JSP中有这样的东西
<c:url value="/teams/${contact.id}/${contact.name}" />
Run Code Online (Sandbox Code Playgroud)
我的URL的重要部分是ID,我只是为了SEO而把它的名字放在它上面(就像stackoverflow.com那样).
我只是想知道是否有一种快速而干净的方式来编码名称(更改每个+的空格,拉丁字符删除等).我希望它是这样的:
<c:url value="/teams/${contact.id}/${supercool(contact.name)}" />
Run Code Online (Sandbox Code Playgroud)
有没有这样的功能或我应该自己做?
我在Windows 7上使用GCC(使用TDM的构建).我安装了MSYS,可以使用makefile 执行Make和编译.但是,每次启动MSYS Bash shell,导航到项目目录并运行都很繁琐make.
我想要的是自动化这个过程.我更喜欢在Windows中有一个批处理文件,或类似的东西,然后我从中调用MSYS Bash shell.它应该导航到批处理文件所在的目录并调用make.
这可能吗?我可以从cmd向MSYS Bash发送命令(如导航/调用make)吗?或者我可以让MSYS Bash运行"Bash脚本",它将命令设置为像批处理脚本一样执行?
PS:这类似于Stack Overflow问题从带有参数的cmd.exe执行MSYS.
我得到以下结论:
T(n) = T(n - 1) + n = O(n^2)
Run Code Online (Sandbox Code Playgroud)
现在,当我解决这个问题时,我发现边界非常宽松.我做错了什么或是这样吗?
很可能是一个愚蠢的问题,因为我对Java/Jython/JRuby /字节码不太了解,但..
今天我偶然发现了_why的邪恶 ......它允许你从Ruby代码输出Python字节码.基本上允许它们生成相同的字节码..
Jython输出Java字节码,就像JRuby一样.由于这些都编译为相同的字节码,这是否意味着您可以使用Ruby中的任何Python库和Python中的Ruby库?
我已在无符号变量中指定了补码值.
那么为什么这个C程序输出一个负数?
#include<stdio.h>
#include<conio.h>
int main()
{
unsigned int Value = 4; /* 4 = 0000 0000 0000 0100 */
unsigned int result = 0;
result = ~ Value; /* -5 = 1111 1111 1111 1011 */
printf("result = %d", result); /* -5 */
getch();
return 0;
}
Run Code Online (Sandbox Code Playgroud) 有人可以解释下面的代码吗?
#if 1
// loop type
#define FOR_IS_FASTER 1
#define WHILE_IS_FASTER 0
// indexing type
#define PREINCREMENT_IS_FASTER 1
#define POSTINCREMENT_IS_FASTER 0
#else
// loop type
#define FOR_IS_FASTER 1
#define WHILE_IS_FASTER 0
// indexing type
#define PREINCREMENT_IS_FASTER 0
#define POSTINCREMENT_IS_FASTER 1
#endif
#if PREINCREMENT_IS_FASTER
#define ZXP(z) (*++(z))
#define ZX(z) (*(z))
#define PZ(z) (++(z))
#define ZP(z) (z)
#define ZOFF (1)
#elif POSTINCREMENT_IS_FASTER
#define ZXP(z) (*(z)++)
#define ZX(z) (*(z))
#define PZ(z) (z)
#define ZP(z) ((z)++)
#define ZOFF (0)
#endif
Run Code Online (Sandbox Code Playgroud)
我可以理解这些功能在做什么,但是例如,如果我们稍后再调用它,预处理器如何选择执行哪个ZXP?1和0代表什么?
c++ ×3
c ×2
algorithm ×1
android ×1
big-o ×1
bytecode ×1
cgcolor ×1
el ×1
fstream ×1
gcc ×1
image ×1
inserter ×1
iostream ×1
iphone ×1
java ×1
jruby ×1
jsp ×1
jython ×1
macros ×1
makefile ×1
msys ×1
objective-c ×1
python ×1
recurrence ×1
ruby ×1
seo ×1
uicolor ×1
unsigned ×1
url-encoding ×1
xslt ×1