我尝试创建一个Button类并将其与SFML一起使用,不幸的是,它会产生错误:
对‘sf::RenderWindow:: ()’的调用没有匹配函数
再来几个。
这是代码:
void onclic(){
cout << "Clicked";
}
class Button{
public:
string ButtonText;
Color color;
int sizee;
int x;
int y;
RenderWindow w
我使用了C++、code::blocks (启用了警告并进行了检查以确保)和SFML。
我试着自己找出问题所在,但我真的找不到出了什么问题。我知道段错误是什么意思,但这真的把我难倒了。我可以补充一句,我是一个初学者,但我很快就会学会的。
我有一个基本的主类void Engine,它有一个void RenderFrame方法来呈现应用程序的每一帧。在上述方法中,我有这个代码,它应该绘制所有的瓷砖到renderwindow上:
Tile* tile;
for (short y = 0; y < mapHeight; ++y) {
for (short x = 0; x <
我正在创建一个基准应用程序来测试渲染图像的速度。我创建了两个函数,一个是返回RenderWindow,另一个是使用RenderWindow在那里应用图像。当我调用第二个函数时,它会给出错误:No matching constructor for initialisation of 'sf::RenderWindow'
以下是我的职责:
sf::RenderWindow newWindow(int w, int h)
{
sf::RenderWindow window;
window.create(sf::VideoMode(w, h), "SFML Be
我目前正在尝试用C++做一个简单的乒乓球游戏。我总是在主文件中得到这个错误。 #include <iostream>
#include "Ball.h"
Ball b;
int main()
{
// create the window
sf::RenderWindow window(sf::VideoMode(1200, 600), "My window");
// run the program as long as the window is open
while (window.isOpen())
我试图创建一个Button类并将其与SFML一起使用,不幸的是,我得到了错误: E:\...\something.cpp:154:40: error: no matching function for call to 'sf::RenderWindow::draw(<unresolved overloaded function type>)'
sfmlWin.draw(buttt.Butt);
^ 代码如下: #include <iostream
我正在尝试使用SFML创建一些包含纹理和精灵的类。当我在类中的SFML库中创建类的对象时,我不能在main中使用该对象。我想知道如何显示精灵的主要(例如):
class MainMenu
{
public:
int DrawMenu(){
sf::Texture texture;
if (!texture.loadFromFile("idle.png"))
return EXIT_FAILURE;
sf::Sprite spritemenu(texture);
re
嗨,我正在尝试建立一个程序,其中一个球将弹过渲染窗口。我正在使用SFML c++、iostream、代码块(如果这有区别的话)。我知道我还没有接近完成,我很可能走错了方向。但是,我确实知道的一件事是,为了使我的程序工作,我需要实现sf::Window::setFramerateLimit(60);或者至少在我的代码中是这样的。
include<iostream>
#include<stdlib.h>
#include<time.h>
using namespace std;
using namespace sf;
int main(){
RenderWin
我有一个SFML RenderWindow,当它关闭时,它将显示一条确认消息。我经常遇到同样的问题:确认消息( sf::Text)是在调用Event::Closed时绘制的,但只有在事件被调用时才会保留;我认为直到注册关闭按钮(调用关闭事件)为止;在闪存中消失(这与C++的速度有关吗?)。我怎么才能解决这个问题?文本应在绘制后显示,而不应在调用close事件后消失。
下面是代码(在main.cpp中):
while (app.isOpen())
{
// Process events
sf::Event event;
while (ap
我在我的项目中使用,目前我正在网站上学习教程。
目前,我只进入了使用以下代码创建的第一步(直接粘贴在教程中):
#include <SFML/Graphics.hpp>
#include <SFML/Graphics/RenderWindow.hpp>
int main()
{
// create the window
sf::VideoMode vm (800, 600);
sf::RenderWindow window(vm, "My window");
// run the program as long as