1
0
mirror of synced 2024-11-28 01:10:56 +01:00

Lay the basic structure

This commit is contained in:
Stepland 2019-10-22 01:53:08 +02:00
parent 9b9de02e10
commit bd0dc22e1d
3 changed files with 70 additions and 0 deletions

2
.gitignore vendored Normal file
View File

@ -0,0 +1,2 @@
build*/
.vscode/

17
meson.build Normal file
View 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
View 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;
}