我正在尝试添加一个针对Windows Mobile的.css文件,并且media="handheld"对于此设备没有任何帮助,我已按照官方Windows Phone网站的说明进行操作,总结如下:
<!--[if IEMobile 7]>
<p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile 7]>
<p>All other browsers</p>
<![endif]>
Run Code Online (Sandbox Code Playgroud)
正如预期的那样,在Firefox和桌面版的Internet Explorer中,它显示了它应该:"所有其他浏览器".
不幸的是,我的Windows Phone 7还显示"所有其他浏览器".我在条件评论中尝试使用和不使用"7",结果相同.
我的.html中没有任何其他内容可能导致问题,因为我正在对此进行测试:
<html>
<body>
<p>Does work</p>
<!--[if IEMobile 7]>
<p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile 7]>
<p>All other browsers</p>
<![endif]>
</body>
</html>
Run Code Online (Sandbox Code Playgroud)
这个的在线版本暂时在这里.
我复制粘贴官方网站上的代码,我在WP7上的Internet Explorer设置指定移动版本作为首选版本.我也有芒果更新.
在perishablepress.com文章中,我读到media="Screen"在正常的非手持式样式表声明中指定(大写S)将迫使WP7使用media="handheld"声明,但这对我不起作用.
有没有人有使用.css定位WP7的经验?如果是,您的解决方案是什么?
请记住,我真的在寻找如何让WP7选择.css的移动版本,而不是如何解决条件评论问题.感谢您的时间!
我已经添加了一个javascript(谢谢w3schools.com)来询问浏览器信息(使用'navigator'),这是我的设备(Samsung Omnia,btw):
Does work
All other …Run Code Online (Sandbox Code Playgroud) 有条件的评论,如
<!--[if IEMobile]>
<p>Welcome to Internet Explorer Mobile.</p>
<![endif]-->
<![if !IEMobile]>
<p>All other browsers</p>
<![endif]>
Run Code Online (Sandbox Code Playgroud)
不适用于Windows Phone 7!或者,至少不是我的.
有谁知道如何使用这些评论,并在之前测试过它们?WP7上的IE 9甚至支持这个吗?
根据The C++ Programming Language,Special Edition,Bjarne Stroustrup,第13.3.2节:
template<class T> T sqrt(T);
template<class T> complex<T> sqrt(complex<T>);
void f(complex<double> z)
{
sqrt(z); // sqrt<double>(complex<double)
}
Run Code Online (Sandbox Code Playgroud)
他说,尽管两个模板都是有效的候选者,但第二个模板sqrt<double>(complex<double>)将优先于第一个,因为它是最专业的模板.
我尊敬的编译器,gcc version 4.8.4 (Ubuntu 4.8.4-2ubuntu1~14.04)似乎不同意:
ft.cpp: In function ‘void f(std::complex<double>)’:
ft.cpp:28:11: error: call of overloaded ‘sqrt(std::complex<double>&)’ is ambiguous
sqrt(z);
^
ft.cpp:28:11: note: candidates are:
ft.cpp:9:21: note: T sqrt(T) [with T = std::complex<double>]
template<class T> T sqrt(T);
^
ft.cpp:10:30: note: std::complex<_Tp> sqrt(std::complex<_Tp>) [with T = double]
template<class T> complex<T> sqrt(complex<T>);
^ …Run Code Online (Sandbox Code Playgroud) 平均而言,C风格的字符串操作执行速度比库string类操作慢5倍,因为C++ Primer,4th Edition会让我相信吗?
因为当我实际进行性能测试时,事实证明,对于特定示例(本书中使用的一个),C风格的字符串快约50%.
我正在阅读C++ Primer,第4版,(第138页)列出了这段代码:
// C-style character string implementation
const char *pc = "a very long literal string";
const size_t len = strlen(pc +1); // space to allocate
// performance test on string allocation and copy
for (size_t ix = 0; ix != 1000000; ++ix) {
char *pc2 = new char[len + 1]; // allocate the space
strcpy(pc2, pc); // do the copy
if (strcmp(pc2, pc)) // use the new string …Run Code Online (Sandbox Code Playgroud) 我有一个关于单个网格(建筑物)的问题,其中包含一组动画对象(这些对象组成整个建筑物,在构造时从地面上升,以不同的速度和旋转).
网格中的动画对象都有自己的位置和旋转动画轨迹.我将它从3DS Max导出为ASE,将其转换为适当的格式并在我的游戏引擎中使用它.
所以,目前,我可以成功地显示网格中所有动画对象的动画位置.执行以下操作:
比例,旋转和平移变量是建筑物的转换信息.这对所有子对象都有效.pos变量表示相对于建筑物中心的子对象位置.
foreach (GeometricObject geoObject in mesh.GeoObjects)
{
Vector3 pos = geoObject.AnimationData.PositionTrack[(int)m_keyFrameTime];
Vector3 translatedPos = new Vector3(translation.X + pos.X,
translation.Y + pos.Y,
translation.Z + pos.Z)
_eRenderer.ActiveCamera.World = Matrix.CreateScale(scale) *
Matrix.CreateFromQuaternion(rotation) *
Matrix.CreateTranslation(translatedPos);
}
Run Code Online (Sandbox Code Playgroud)
这将完美地显示动画建筑(从地面升起),并且所有子对象都处于正确的位置.
现在,当我尝试旋转子对象时,问题出现了.我尝试了很多不同的方法,但在旋转子对象后,子对象的转换似乎总是搞砸了.这是我现在拥有的,但它仍然搞砸了:
foreach (GeometricObject geoObject in mesh.GeoObjects)
{
Vector3 pos = geoObject.AnimationData.PositionTrack[(int)m_keyFrameTime];
Vector3 translatedPos = new Vector3(translation.X, translation.Y, translation.Z)
Matrix rotateSubObjects;
rotateSubObjects = Matrix.CreateTranslation(new Vector3(pos.X, pos.Y, pos.Z));
rotateSubObjects *= Matrix.CreateFromQuaternion(geoObject.AnimationData.RotationTrack[(int)m_keyFrameTime]);
_eRenderer.ActiveCamera.World = Matrix.CreateScale(scale) *
Matrix.CreateFromQuaternion(rotation) *
Matrix.CreateTranslation(translatedPos) *
rotateSubObjects;
}
Run Code Online (Sandbox Code Playgroud)
我已经读过,我可能需要将子对象转换回原点,使其围绕原点旋转,然后将其转换回世界位置,但我不知道在这种情况下如何做到这一点.
我没有想法,任何帮助将不胜感激!此致,Riaan.