Lay the basic structure
This commit is contained in:
parent
9b9de02e10
commit
bd0dc22e1d
2
.gitignore
vendored
Normal file
2
.gitignore
vendored
Normal file
@ -0,0 +1,2 @@
|
||||
build*/
|
||||
.vscode/
|
17
meson.build
Normal file
17
meson.build
Normal file
@ -0,0 +1,17 @@
|
||||
project(
|
||||
'jujube',
|
||||
'cpp',
|
||||
default_options : ['cpp_std=c++17'],
|
||||
version : '0.1.0-alpha',
|
||||
)
|
||||
|
||||
sfml = []
|
||||
foreach module : ['system', 'window', 'graphics', 'audio']
|
||||
sfml += [dependency('sfml-'+module, version : '>=2.5.1')]
|
||||
endforeach
|
||||
|
||||
executable(
|
||||
'jujube',
|
||||
'src/Main.cpp',
|
||||
dependencies: sfml
|
||||
)
|
51
src/Main.cpp
Normal file
51
src/Main.cpp
Normal file
@ -0,0 +1,51 @@
|
||||
#include <iostream>
|
||||
#include <SFML/Graphics.hpp>
|
||||
|
||||
int main(int argc, char const *argv[])
|
||||
{
|
||||
|
||||
sf::RenderWindow window(sf::VideoMode(800,600), "jujube");
|
||||
window.setVerticalSyncEnabled(true);
|
||||
|
||||
bool fullscreen = false;
|
||||
while (window.isOpen())
|
||||
{
|
||||
sf::Event event;
|
||||
while (window.pollEvent(event))
|
||||
{
|
||||
switch (event.type)
|
||||
{
|
||||
case sf::Event::KeyPressed:
|
||||
switch (event.key.code)
|
||||
{
|
||||
case sf::Keyboard::Enter:
|
||||
if (event.key.alt)
|
||||
{
|
||||
window.close();
|
||||
if (fullscreen)
|
||||
{
|
||||
window.create(sf::VideoMode(800,600), "jujube");
|
||||
} else {
|
||||
auto width = sf::VideoMode::getDesktopMode().width;
|
||||
auto height = sf::VideoMode::getDesktopMode().height;
|
||||
window.create(sf::VideoMode(width,height), "jujube", sf::Style::Fullscreen);
|
||||
}
|
||||
fullscreen = not fullscreen;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
case sf::Event::Closed:
|
||||
window.close();
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
window.clear(sf::Color::Black);
|
||||
window.display();
|
||||
}
|
||||
return 0;
|
||||
}
|
Loading…
Reference in New Issue
Block a user