* \param text texte à écrire
* \param flags paramètres d'alignement
*
+ * \see drawText(int, int, const std::string &, int)
* \see drawTextBg, setColor
* \see QPainter::drawText
*/
safeUnlock(syncMutex);
}
+//! Écrit du texte.
+/*!
+ * \see drawText(int, int, const char *, int)
+ */
+void DrawingWindow::drawText(int x, int y, const std::string &text, int flags)
+{
+ drawText(x, y, text.c_str(), flags);
+}
+
//! Écrit du texte sur fond coloré.
/*!
* Écrit du texte comme drawText, mais l'arrière-plan est coloré avec
* \param text texte à écrire
* \param flags paramètres d'alignement
*
+ * \see drawTextBg(int, int, const std::string &, int)
* \see drawText, setColor, setColorBg
*/
void DrawingWindow::drawTextBg(int x, int y, const char *text, int flags)
painter->setBackgroundMode(Qt::TransparentMode);
}
+//! Écrit du texte sur fond coloré.
+/*!
+ * \see drawTextBg(int, int, const char *, int)
+ */
+void DrawingWindow::drawTextBg(int x, int y, const std::string &text, int flags)
+{
+ drawTextBg(x, y, text.c_str(), flags);
+}
+
//! Retourne la couleur d'un pixel.
/*!
* Retourne la couleur du pixel de coordonnées (x, y). La valeur
#include <QWaitCondition>
#include <QWidget>
#include <Qt>
+#include <string>
class DrawingThread;
void fillTriangle(int x1, int y1, int x2, int y2, int x3, int y3);
void drawText(int x, int y, const char *text, int flags = 0);
+ void drawText(int x, int y, const std::string &text, int flags = 0);
void drawTextBg(int x, int y, const char *text, int flags = 0);
+ void drawTextBg(int x, int y, const std::string &text, int flags = 0);
unsigned int getPointColor(int x, int y);
Qt::AlignHCenter);
std::stringstream s;
s << score1 << " / " << score2;
- w.drawText(rtowX(w, 0), rtowY(w, 0) + 8, s.str().c_str(),
+ w.drawText(rtowX(w, 0), rtowY(w, 0) + 8, s.str(),
Qt::AlignHCenter);
}
msg << " a perdu ! ";
w.setColor("darkred");
w.setBgColor("white");
- w.drawTextBg(w.width / 2, w.height / 3, msg.str().c_str(),
+ w.drawTextBg(w.width / 2, w.height / 3, msg.str(),
Qt::AlignCenter);
w.sync();
std::cout << msg.str() << std::endl;