online compiler and debugger for c/c++

code. compile. run. debug. share.
Source Code    Language
/****************************************************************************** Welcome to GDB Online. GDB online is an online compiler and debugger tool for C, C++, Python, PHP, Ruby, C#, VB, Perl, Swift, Prolog, Javascript, Pascal, HTML, CSS, JS Code, Compile, Run and Debug online from anywhere in world. *******************************************************************************/ #include <stdio.h> #include <SFML/Graphics.hpp> using namespace sf; int main() { const int M = 20; // высота игрового поля const int N = 10; // ширина игрового поля int field[M][N] = { 0 }; // игровое поле // Массив фигурок-тетрамино int figures[7][4] = { 1,3,5,7, // I 2,4,5,7, // S 3,5,4,6, // Z 3,5,4,7, // T 2,3,5,7, // L 3,5,7,6, // J 2,3,4,5, // O }; struct Point { int x, y; } a[4], b[4]; RenderWindow window(VideoMode(320, 480), "The Game!"); // Создание и загрузка текстуры Texture texture; texture.loadFromFile("D:\\cpp\\images\\tiles.png"); // Создание спрайта Sprite sprite(texture); // Вырезаем из спрайта отдельный квадратик размером 18х18 пикселей sprite.setTextureRect(IntRect(0, 0, 18, 18)); int dx = 0; // переменная для горизонтального перемещения тетрамино bool rotate = 0; // переменная для вращения тетрамино // Главный цикл приложения: выполняется, пока открыто окно while (window.isOpen()) { // Обрабатываем события в цикле Event event; while (window.pollEvent(event)) { // Пользователь нажал на «крестик» и хочет закрыть окно? if (event.type == Event::Closed) // тогда закрываем его window.close(); if (event.type == Event::KeyPressed) // Этой клавишей была стрелка вверх? if (event.key.code == Keyboard::Up) rotate = true; // Или может стрелка влево? else if (event.key.code == Keyboard::Left) dx = -1; // Или стрелка вправо? else if (event.key.code == Keyboard::Right) dx = 1; } // Горизонтальное перемещение for (int i = 0; i < 4; i++) a[i].x += dx; int n = 3; // Первое появление тетрамино на поле? if (a[0].x == 0) for (int i = 0; i < 4; i++) { a[i].x = figures[n][i] % 2; a[i].y = figures[n][i] / 2; } dx = 0; // Задаём цвет фона - белый window.clear(Color::White); for (int i = 0; i < 4; i++) { // Устанавливаем позицию каждого кусочка тетрамино sprite.setPosition(a[i].x * 18, a[i].y * 18); // Отрисовка спрайта window.draw(sprite); } // Отрисовка окна window.display(); } return 0; }

Compiling Program...

Command line arguments:
Standard Input: Interactive Console Text
×

                

                

Program is not being debugged. Click "Debug" button to start program in debug mode.

#FunctionFile:Line
VariableValue
RegisterValue
ExpressionValue