#include <QtGui/QApplication>
#include <QLabel>
#include <QtCore>
#include <QSound>
#include <QGraphicsWidget>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
MainWindow m;
m.show();
QPixmap empty
("images/emptyspace.png");
QPixmap hit
("images/hitspace.png");
QPixmap miss
("images/missspace.png");
char data[10][10] = {
{'X', ' ', 'X', 'X', 'S', 'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X', 'X', 'X', ' ', 'X', 'X'},
{'X', 'X', ' ', ' ', 'X', 'X', 'S', 'X', 'X', 'X'},
{'S', 'X', 'X', 'X', 'X', 'X', ' ', ' ', 'S', 'X'},
{'S', 'X', 'X', 'X', 'S', 'X', ' ', 'X', 'S', 'X'},
{'S', 'S', 'X', ' ', 'S', 'X', ' ', 'X', 'S', 'X'},
{'S', 'X', 'X', 'X', 'S', 'X', ' ', 'X', ' ', 'X'},
{'S', 'X', 'X', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
{'S', ' ', ' ', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
};
for (int row = 0; row < 10; ++row) {
for (int col = 0; col < 10; ++col) {
if (data[row][col] == ' '){
m.setCellPixmap(row, col, empty);
}
else if (data[row][col]== 'X'){
m.setCellPixmap(row, col, hit);
}
else m.setCellPixmap(row,col, miss);
}
}
return app.exec();
}
/*QApplication a(argc, argv);
MainWindow w;
w.show();
QImage myImage;
myImage.load("images/hitspace.png");
QLabel myLabel;
myLabel.setPixmap(QPixmap::fromImage(myImage));
myLabel.show();*/
#include <QtGui/QApplication>
#include <QLabel>
#include <QtCore>
#include <QSound>
#include <QGraphicsWidget>
#include "mainwindow.h"
int main(int argc, char *argv[])
{
QApplication app(argc, argv);
MainWindow m;
m.show();
QPixmap empty("images/emptyspace.png");
QPixmap hit("images/hitspace.png");
QPixmap miss("images/missspace.png");
char data[10][10] = {
{'X', ' ', 'X', 'X', 'S', 'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', 'X', 'X', 'X', 'X', ' ', 'X', 'X'},
{'X', 'X', ' ', ' ', 'X', 'X', 'S', 'X', 'X', 'X'},
{'S', 'X', 'X', 'X', 'X', 'X', ' ', ' ', 'S', 'X'},
{'S', 'X', 'X', 'X', 'S', 'X', ' ', 'X', 'S', 'X'},
{'S', 'S', 'X', ' ', 'S', 'X', ' ', 'X', 'S', 'X'},
{'S', 'X', 'X', 'X', 'S', 'X', ' ', 'X', ' ', 'X'},
{'S', 'X', 'X', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
{'S', ' ', ' ', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
{'X', 'X', 'X', ' ', 'X', 'X', 'X', 'X', 'X', 'X'},
};
for (int row = 0; row < 10; ++row) {
for (int col = 0; col < 10; ++col) {
if (data[row][col] == ' '){
m.setCellPixmap(row, col, empty);
}
else if (data[row][col]== 'X'){
m.setCellPixmap(row, col, hit);
}
else m.setCellPixmap(row,col, miss);
}
}
return app.exec();
}
/*QApplication a(argc, argv);
MainWindow w;
w.show();
QImage myImage;
myImage.load("images/hitspace.png");
QLabel myLabel;
myLabel.setPixmap(QPixmap::fromImage(myImage));
myLabel.show();*/
To copy to clipboard, switch view to plain text mode
Bookmarks