SFML编程 遇到的问题(二)
使用顶点数组设计实体
想整一个俄罗斯方块。
What is a vertex, and why they are always in arrays?
A vertex is the smallest graphical entity that you can manipulate. It is a “graphical point” with a 2D position (x, y), a color and a pair of texture coordinates.
Vertices alone don’t do much. They are always grouped into primitives: Points, lines, triangles or quads. You can then combine multiple primitives together to create the final geometry of the entity.
That the reason why we always talk about vertex arrays, and not vertices alone.
A simple vertex array
sf::Vertex class is simply a container which contains three public
如何解决图像文件无法导入的问题
在使用Texture的属性loadFromFile(“路径”)的时候,遇到程序无法导入图像的问题,报错信息为:0x75F935D2 处(位于 test.exe 中)有未经处理的异常: Microsoft C++ 异常: std::length_error,位于内存位置 0x00AFEA48 处。
查了一下,出现这类报错信息的一般原因是指针指向空内存啥的。但是在下的程序中并没有出现指针。后来又把路径改来改去,也没有用。后来,搜索关键词“SMFL loadFromFile”看到有人问类似的问题,解决方法是:属性->链接器->输入->附加依赖项,把里面的和SMFL相关的lib文件后面加上-d就可以了。像这样:sfml-graphics-d.lib sfml-window-d.lib sfml-system-d.lib