【发布时间】:2020-01-04 13:03:43
【问题描述】:
我有 sfml 窗口。我需要为我的窗口在屏幕的顶部(或底部)保留空间。像这样做polybar,lemonbar等。我该怎么做?
在这一步,我只有一个简单的 sfml 窗口:
#include <SFML/Graphics.hpp>
using namespace sf;
int main()
{
unsigned int bar_x = 1920, bar_y = 20;
RenderWindow window(VideoMode(bar_x, bar_y), "bar", Style::None);
Vector2u bar_size(bar_x, bar_y);
Vector2i bar_position(0,0);
while (window.isOpen())
{
Event event;
while (window.pollEvent(event))
{
// Here should be blocking position function...
if (event.type == Event::Closed)
window.close();
if (event.type == Event::Resized)
window.setSize(bar_size);
if (event.type == Event::Resized)
window.setPosition(Vector2i(0,0));
}
window.clear();
// window.draw(shape);
window.display();
}
return 0;
}
【问题讨论】: