for(int bufferPosition=0; bufferPosition < objectsBuffer.getBufferSize(); ++bufferPosition) {
sf::Drawable* object = ObjectDrawer::drawObject(objectsBuffer.getReferenceBuffer()[bufferPosition], window);
std::cout << object
}
static sf::Drawable* drawObject(LevelObject& object, sf::RenderWindow &window) {
if(!object.hidden) {
if(object.lobjecttype == LevelObjectType::RECTANGLE) {
sf::RectangleShape rectangleShape(sf::Vector2f(object.objectWidth, object.objectHeight));
rectangleShape.setPosition(sf::Vector2f(object.objectX, object.objectY));
if(object.objectRotation.has_value()) {
rectangleShape.setOrigin(object.objectWidth / 2.f, object.objectHeight / 2.f);
rectangleShape.setRotation(object.objectRotation.value());
}
rectangleShape.setFillColor(object.objectColor);
window.draw(rectangleShape);
return rectangleShape;
} // другие if else
}
sf::Drawable
а не sf::Drawable*
(sf::Drawable* drawObject()
, но ошибки все еще есть:sf::RectangleShape rectangleShape(sf::Vector2f(object.objectWidth, object.objectHeight));
rectangleShape.setPosition(sf::Vector2f(object.objectX, object.objectY));
if(object.objectRotation.has_value()) {
rectangleShape.setOrigin(object.objectWidth / 2.f, object.objectHeight / 2.f);
rectangleShape.setRotation(object.objectRotation.value());
}
rectangleShape.setFillColor(object.objectColor);
window.draw(rectangleShape);
return rectangleShape;
sfml.ld2d\objdrawer.h: In static member function 'static sf::Drawable* ObjectDrawer::drawObject(LevelObject&, sf::RenderWindow&)':
sfml.ld2d\objdrawer.h:36:24: error: cannot convert 'sf::RectangleShape' to 'sf::Drawable*' in return
36 | return rectangleShape;
t = perf_counter_ns()
k=[2,3,3,4,1,50,5]
f = 1
for i in range(1, len(k)):
m = k[i]
n = k[i-1]
f = 1
if m>=n:
continue
for j in range(i-2, -1, -1):
if m > k[j]:
del k[i]
k.insert(j+1, m)
f = 0
break
if f == 1:
y = k[i]
del k[i]
k.insert(0, y)
print(perf_counter_ns() - t)
t = perf_counter_ns()
sort_insertion([2, 3, 3, 4, 1, 50, 5]) # => [1, 2, 3, 3, 4, 5, 50]
print(perf_counter_ns() - t)
все еще нету методов