Advertisement

QT SFML C++

Started by July 20, 2012 06:42 PM
26 comments, last by Saint Squireen 12 years, 4 months ago
Wierd........ It didnt fix it........I extracted the files, erased the second target, and changed the include path problem but nothing seemed to be fixed........ It came up with the same error too. The "multiple target patterns. stop. /newline/ File not found: Makefile.Debug" error.... Is there any way to just send you my project and see whats messed up about it? Would that make it help?

~Saint Squireen
[color=#008000]#-------------------------------------------------
[color=#008000]#
[color=#008000]#[color=#c0c0c0] [color=#008000]Project[color=#c0c0c0] [color=#008000]created[color=#c0c0c0] [color=#008000]by[color=#c0c0c0] [color=#008000]QtCreator[color=#c0c0c0] [color=#008000]2012-07-20T14:57:41
[color=#008000]#
[color=#008000]#-------------------------------------------------
[color=#800080]QT[color=#c0c0c0] +=[color=#c0c0c0] core[color=#c0c0c0] gui
[color=#800080]TARGET[color=#c0c0c0] =[color=#c0c0c0] SFML-Test
[color=#800080]TEMPLATE[color=#c0c0c0] =[color=#c0c0c0] app
[color=#800080]SOURCES[color=#c0c0c0] +=[color=#c0c0c0] main.cpp\
[color=#c0c0c0] mainwindow.cpp[color=#c0c0c0] \
[color=#c0c0c0] QSFMLCanvas.cpp
[color=#800080]HEADERS[color=#c0c0c0] +=[color=#c0c0c0] mainwindow.h[color=#c0c0c0] \
[color=#c0c0c0] QSFMLCanvas.hpp
[color=#800080]FORMS[color=#c0c0c0] +=[color=#c0c0c0] mainwindow.ui
[color=#008000]#Location[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]save[color=#c0c0c0] [color=#008000]your[color=#c0c0c0] [color=#008000]executable:
[color=#800080]DESTDIR[color=#c0c0c0] =[color=#c0c0c0] "C:\Users\Griffin[color=#c0c0c0] Laptop\Desktop\SFML-1.6-sdk-windows-mingw"
[color=#008000]#SFML[color=#c0c0c0] [color=#008000]libraries:
[color=#800080]LIBS[color=#c0c0c0] +=[color=#c0c0c0] -lsfml-audio[color=#c0c0c0] -lsfml-graphics[color=#c0c0c0] -lsfml-window[color=#c0c0c0] -lsfml-[color=#808000]system[color=#c0c0c0] -lsfml-main
[color=#008000]#Path[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]linker[color=#c0c0c0] [color=#008000]import[color=#c0c0c0] [color=#008000]files:[color=#c0c0c0] [color=#008000](sfml-audio.a[color=#c0c0c0] [color=#008000]or[color=#c0c0c0] [color=#008000]whatever)
[color=#800080]LIBS[color=#c0c0c0] +=[color=#c0c0c0] -L"C:\Users\Griffin[color=#c0c0c0] Laptop\Desktop\SFML-1.6-sdk-windows-mingw\SFML-1.6\lib"
[color=#008000]#Path[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]SFML[color=#c0c0c0] [color=#008000]headers:
[color=#800080]INCLUDEPATH[color=#c0c0c0] =[color=#c0c0c0] "C:\Users\Griffin[color=#c0c0c0] Laptop\Desktop\SFML-1.6-sdk-windows-mingw\SFML-1.6\[color=#808000]include"






Heres what I have again.

~Saint Squireen
Advertisement
I just left my development machine, so if you post your source files and header file (post them between [ code ] and [ /code ] tags, like this:

MyHeaderName.h
[ code ] my code goes here [ /code ] //But without spaces between the square brackets.

MySourceName.h
[ code ] my code goes here [ /code ]

MyOtherHeader.h
[ code ] my code goes here [ /code ]

Because I'm no longer on my programming machine, and am just using a laptop somewhere else, I can't test your project at the moment, but I will do so tomorrow morning unless you or someone else figures it out before then.
okay I understand 1 second................

~Saint Squireen
main.cpp

[color=#008000]////////////////////////////////////////////////////////////
[color=#008000]//[color=#c0c0c0] [color=#008000]Headers
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]#include[color=#c0c0c0] [color=#008000]"QSFMLCanvas.hpp"
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QApplication>
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QVBoxLayout>
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QFrame>
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QLabel>
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Custom[color=#c0c0c0] [color=#000080]SFML[color=#c0c0c0] [color=#000080]canvas
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]class[color=#c0c0c0] [color=#800080]MyCanvas[color=#c0c0c0] [color=#000000]:[color=#c0c0c0] [color=#808000]public[color=#c0c0c0] QSFMLCanvas
[color=#000000]{
[color=#808000]public[color=#c0c0c0] [color=#000000]:
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Construct[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]canvas
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#800080]MyCanvas[color=#000000](QWidget[color=#000000]*[color=#c0c0c0] [color=#000000]Parent[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] NULL[color=#000000])[color=#c0c0c0] [color=#000000]:
[color=#c0c0c0] QSFMLCanvas[color=#000000](QSize[color=#000000]([color=#000080]100[color=#000000],[color=#c0c0c0] [color=#000080]100[color=#000000]),[color=#c0c0c0] [color=#000080]0[color=#000000],[color=#c0c0c0] [color=#000000]Parent[color=#000000])
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] [color=#000000]}
[color=#808000]private[color=#c0c0c0] [color=#000000]:
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]/see[color=#c0c0c0] [color=#000080]QSFMLCanvas::OnInit
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]void[color=#c0c0c0] [color=#000000]OnInit[color=#000000]()
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Load[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]image
[color=#c0c0c0] [color=#800000]myImage[color=#000000].LoadFromFile[color=#000000]([color=#008000]"datas/qt/sfml.png"[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Setup[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]sprite
[color=#c0c0c0] [color=#800000]mySprite[color=#000000].SetImage[color=#000000]([color=#800000]myImage[color=#000000]);
[color=#c0c0c0] [color=#800000]mySprite[color=#000000].SetCenter[color=#000000]([color=#800000]mySprite[color=#000000].GetSize[color=#000000]()[color=#c0c0c0] [color=#000000]/[color=#c0c0c0] [color=#000080]2.f[color=#000000]);
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]/see[color=#c0c0c0] [color=#000080]QSFMLCanvas::OnUpdate
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]void[color=#c0c0c0] [color=#000000]OnUpdate[color=#000000]()
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] sf[color=#000000]::Event[color=#c0c0c0] [color=#000000]Event[color=#000000];
[color=#c0c0c0] [color=#808000]while[color=#c0c0c0] [color=#000000](GetEvent[color=#000000]([color=#000000]Event[color=#000000]))
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Stick[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]sprite[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]mouse[color=#c0c0c0] [color=#008000]cursor
[color=#c0c0c0] [color=#808000]if[color=#c0c0c0] [color=#000000]([color=#000000]Event[color=#000000].Type[color=#c0c0c0] [color=#000000]==[color=#c0c0c0] sf[color=#000000]::Event[color=#000000]::MouseMoved[color=#000000])
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] [color=#800000]mySprite[color=#000000].SetPosition[color=#000000](ConvertCoords[color=#000000]([color=#000000]Event[color=#000000].MouseMove[color=#000000].X[color=#000000],[color=#c0c0c0] [color=#000000]Event[color=#000000].MouseMove[color=#000000].Y[color=#000000]));
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Adjust[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]size[color=#c0c0c0] [color=#008000]of[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]default[color=#c0c0c0] [color=#008000]view[color=#c0c0c0] [color=#008000]when[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]widget[color=#c0c0c0] [color=#008000]is[color=#c0c0c0] [color=#008000]resized
[color=#c0c0c0] [color=#808000]if[color=#c0c0c0] [color=#000000]([color=#000000]Event[color=#000000].Type[color=#c0c0c0] [color=#000000]==[color=#c0c0c0] sf[color=#000000]::Event[color=#000000]::Resized[color=#000000])
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] GetDefaultView[color=#000000]().SetFromRect[color=#000000](sf[color=#000000]::FloatRect[color=#000000]([color=#000080]0[color=#000000],[color=#c0c0c0] [color=#000080]0[color=#000000],[color=#c0c0c0] [color=#000000]Event[color=#000000].Size[color=#000000].Width[color=#000000],[color=#c0c0c0] [color=#000000]Event[color=#000000].Size[color=#000000].Height[color=#000000]));
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Rotate[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]sprite
[color=#c0c0c0] [color=#800000]mySprite[color=#000000].Rotate[color=#000000](GetFrameTime[color=#000000]()[color=#c0c0c0] [color=#000000]*[color=#c0c0c0] [color=#000080]100.f[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Clear[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]view
[color=#c0c0c0] Clear[color=#000000](sf[color=#000000]::Color[color=#000000]([color=#000080]0[color=#000000],[color=#c0c0c0] [color=#000080]128[color=#000000],[color=#c0c0c0] [color=#000080]0[color=#000000]));
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Draw[color=#c0c0c0] [color=#008000]it
[color=#c0c0c0] Draw[color=#000000]([color=#800000]mySprite[color=#000000]);
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Member[color=#c0c0c0] [color=#000080]data
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] sf[color=#000000]::Image[color=#c0c0c0] [color=#800000]myImage[color=#000000];[color=#c0c0c0] [color=#000080]///<[color=#c0c0c0] [color=#000080]Some[color=#c0c0c0] [color=#000080]image[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]show
[color=#c0c0c0] sf[color=#000000]::Sprite[color=#c0c0c0] [color=#800000]mySprite[color=#000000];[color=#c0c0c0] [color=#000080]///<[color=#c0c0c0] [color=#000080]A[color=#c0c0c0] [color=#000080]sprite[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]display[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]image
[color=#000000]};
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Entry[color=#c0c0c0] [color=#000080]point[color=#c0c0c0] [color=#000080]of[color=#c0c0c0] [color=#000080]application
[color=#008000]///
[color=#000080]///[color=#c0c0c0] [color=#0000ff]\return[color=#c0c0c0] [color=#000080]Application[color=#c0c0c0] [color=#000080]exit[color=#c0c0c0] [color=#000080]code
[color=#008000]///
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]int[color=#c0c0c0] main[color=#000000]([color=#808000]int[color=#c0c0c0] [color=#000000]argc[color=#000000],[color=#c0c0c0] [color=#808000]char[color=#c0c0c0] [color=#000000]**[color=#000000]argv[color=#000000])
[color=#000000]{
[color=#c0c0c0] QApplication[color=#c0c0c0] [color=#000000]App[color=#000000]([color=#000000]argc[color=#000000],[color=#c0c0c0] [color=#000000]argv[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Create[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]main[color=#c0c0c0] [color=#008000]frame
[color=#c0c0c0] QFrame[color=#000000]*[color=#c0c0c0] [color=#000000]MainFrame[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] [color=#808000]new[color=#c0c0c0] QFrame[color=#000000];
[color=#c0c0c0] [color=#000000]MainFrame[color=#000000]->setWindowTitle[color=#000000]([color=#008000]"Qt[color=#c0c0c0] [color=#008000]SFML"[color=#000000]);
[color=#c0c0c0] [color=#000000]MainFrame[color=#000000]->resize[color=#000000]([color=#000080]400[color=#000000],[color=#c0c0c0] [color=#000080]400[color=#000000]);
[color=#c0c0c0] [color=#000000]MainFrame[color=#000000]->show[color=#000000]();
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Create[color=#c0c0c0] [color=#008000]a[color=#c0c0c0] [color=#008000]label[color=#c0c0c0] [color=#008000]for[color=#c0c0c0] [color=#008000]showing[color=#c0c0c0] [color=#008000]some[color=#c0c0c0] [color=#008000]text
[color=#c0c0c0] QLabel[color=#000000]*[color=#c0c0c0] [color=#000000]Label[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] [color=#808000]new[color=#c0c0c0] QLabel[color=#000000]([color=#008000]"This[color=#c0c0c0] [color=#008000]is[color=#c0c0c0] [color=#008000]a[color=#c0c0c0] [color=#008000]SFML[color=#c0c0c0] [color=#008000]window\nembedded[color=#c0c0c0] [color=#008000]into[color=#c0c0c0] [color=#008000]a[color=#c0c0c0] [color=#008000]Qt[color=#c0c0c0] [color=#008000]frame[color=#c0c0c0] [color=#008000]:"[color=#000000],[color=#c0c0c0] [color=#000000]MainFrame[color=#000000]);
[color=#c0c0c0] [color=#000000]Label[color=#000000]->setFont[color=#000000](QFont[color=#000000]([color=#008000]"courier[color=#c0c0c0] [color=#008000]new"[color=#000000],[color=#c0c0c0] [color=#000080]14[color=#000000],[color=#c0c0c0] [color=#000080]1[color=#000000],[color=#c0c0c0] [color=#808000]false[color=#000000]));
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Create[color=#c0c0c0] [color=#008000]a[color=#c0c0c0] [color=#008000]SFML[color=#c0c0c0] [color=#008000]view[color=#c0c0c0] [color=#008000]inside[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]main[color=#c0c0c0] [color=#008000]frame
[color=#c0c0c0] [color=#800080]MyCanvas[color=#000000]*[color=#c0c0c0] [color=#000000]SFMLView[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] [color=#808000]new[color=#c0c0c0] [color=#800080]MyCanvas[color=#000000]([color=#000000]MainFrame[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Create[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]main[color=#c0c0c0] [color=#008000]layout
[color=#c0c0c0] QVBoxLayout[color=#000000]*[color=#c0c0c0] [color=#000000]Layout[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] [color=#808000]new[color=#c0c0c0] QVBoxLayout[color=#000000];
[color=#c0c0c0] [color=#000000]Layout[color=#000000]->addWidget[color=#000000]([color=#000000]Label[color=#000000],[color=#c0c0c0] [color=#000080]0[color=#000000]);
[color=#c0c0c0] [color=#000000]Layout[color=#000000]->addWidget[color=#000000]([color=#000000]SFMLView[color=#000000],[color=#c0c0c0] [color=#000080]1[color=#000000]);
[color=#c0c0c0] [color=#000000]MainFrame[color=#000000]->setLayout[color=#000000]([color=#000000]Layout[color=#000000]);
[color=#c0c0c0] [color=#808000]return[color=#c0c0c0] [color=#000000]App[color=#000000].exec[color=#000000]();
[color=#000000]}



QSFMLCanvas.cpp

[color=#008000]////////////////////////////////////////////////////////////
[color=#008000]//[color=#c0c0c0] [color=#008000]Headers
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]#include[color=#c0c0c0] [color=#008000]"QSFMLCanvas.hpp"
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QEvent>
[color=#008000]//[color=#c0c0c0] [color=#008000]Platform-specific[color=#c0c0c0] [color=#008000]headers
[color=#000080]#ifdef[color=#c0c0c0] Q_WS_X11
[color=#c0c0c0] [color=#000080]#include[color=#c0c0c0] [color=#008000]<Qt/qx11info_x11.h>
[color=#c0c0c0] [color=#000080]#include[color=#c0c0c0] [color=#008000]<X11/Xlib.h>
[color=#000080]#endif
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Construct[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]QSFMLCanvas
[color=#008000]////////////////////////////////////////////////////////////
QSFMLCanvas[color=#000000]::QSFMLCanvas[color=#000000]([color=#808000]const[color=#c0c0c0] QSize[color=#000000]&[color=#c0c0c0] [color=#000000]Size[color=#000000],[color=#c0c0c0] [color=#808000]unsigned[color=#c0c0c0] [color=#808000]int[color=#c0c0c0] [color=#000000]FrameTime[color=#000000],[color=#c0c0c0] QWidget[color=#000000]*[color=#c0c0c0] [color=#000000]Parent[color=#000000])[color=#c0c0c0] [color=#000000]:
QWidget[color=#000000]([color=#000000]Parent[color=#000000])
[color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Resize[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]widget
[color=#c0c0c0] resize[color=#000000]([color=#000000]Size[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Setup[color=#c0c0c0] [color=#008000]some[color=#c0c0c0] [color=#008000]states[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]allow[color=#c0c0c0] [color=#008000]direct[color=#c0c0c0] [color=#008000]rendering[color=#c0c0c0] [color=#008000]into[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]widget
[color=#c0c0c0] setAttribute[color=#000000](Qt[color=#000000]::WA_PaintOnScreen[color=#000000]);
[color=#c0c0c0] setAttribute[color=#000000](Qt[color=#000000]::WA_OpaquePaintEvent[color=#000000]);
[color=#c0c0c0] setAttribute[color=#000000](Qt[color=#000000]::WA_NoSystemBackground[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Set[color=#c0c0c0] [color=#008000]strong[color=#c0c0c0] [color=#008000]focus[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]enable[color=#c0c0c0] [color=#008000]keyboard[color=#c0c0c0] [color=#008000]events[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]be[color=#c0c0c0] [color=#008000]received
[color=#c0c0c0] setFocusPolicy[color=#000000](Qt[color=#000000]::StrongFocus[color=#000000]);
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Setup[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]timer
[color=#c0c0c0] myTimer[color=#000000].setInterval[color=#000000]([color=#000000]FrameTime[color=#000000]);
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Destructor
[color=#008000]////////////////////////////////////////////////////////////
QSFMLCanvas[color=#000000]::~QSFMLCanvas[color=#000000]()
[color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Nothing[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]do...
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Notification[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]derived[color=#c0c0c0] [color=#000080]class[color=#c0c0c0] [color=#000080]that[color=#c0c0c0] [color=#000080]moment[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]good
[color=#000080]///[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]doing[color=#c0c0c0] [color=#000080]initializations
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]void[color=#c0c0c0] QSFMLCanvas[color=#000000]::OnInit[color=#000000]()
[color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Nothing[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]do[color=#c0c0c0] [color=#008000]by[color=#c0c0c0] [color=#008000]default...
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Notification[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]derived[color=#c0c0c0] [color=#000080]class[color=#c0c0c0] [color=#000080]that[color=#c0c0c0] [color=#000080]moment[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]good
[color=#000080]///[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]doing[color=#c0c0c0] [color=#000080]its[color=#c0c0c0] [color=#000080]update[color=#c0c0c0] [color=#000080]and[color=#c0c0c0] [color=#000080]drawing[color=#c0c0c0] [color=#000080]stuff
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]void[color=#c0c0c0] QSFMLCanvas[color=#000000]::OnUpdate[color=#000000]()
[color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Nothing[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]do[color=#c0c0c0] [color=#008000]by[color=#c0c0c0] [color=#008000]default...
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Return[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]paint[color=#c0c0c0] [color=#000080]engine[color=#c0c0c0] [color=#000080]used[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]draw[color=#c0c0c0] [color=#000080]itself
[color=#008000]////////////////////////////////////////////////////////////
QPaintEngine[color=#000000]*[color=#c0c0c0] QSFMLCanvas[color=#000000]::paintEngine[color=#000000]()[color=#c0c0c0] [color=#808000]const
[color=#000000]{
[color=#c0c0c0] [color=#808000]return[color=#c0c0c0] [color=#000080]0[color=#000000];
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Called[color=#c0c0c0] [color=#000080]each[color=#c0c0c0] [color=#000080]time[color=#c0c0c0] [color=#000080]an[color=#c0c0c0] [color=#000080]event[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]received[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080];
[color=#000080]///[color=#c0c0c0] [color=#000080]we[color=#c0c0c0] [color=#000080]use[color=#c0c0c0] [color=#000080]it[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]catch[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]Polish[color=#c0c0c0] [color=#000080]event[color=#c0c0c0] [color=#000080]and[color=#c0c0c0] [color=#000080]initialize
[color=#000080]///[color=#c0c0c0] [color=#000080]our[color=#c0c0c0] [color=#000080]SFML[color=#c0c0c0] [color=#000080]window
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]bool[color=#c0c0c0] QSFMLCanvas[color=#000000]::event[color=#000000](QEvent[color=#000000]*[color=#c0c0c0] [color=#000000]Event[color=#000000])
[color=#000000]{
[color=#c0c0c0] [color=#808000]if[color=#c0c0c0] [color=#000000]([color=#000000]Event[color=#000000]->type[color=#000000]()[color=#c0c0c0] [color=#000000]==[color=#c0c0c0] QEvent[color=#000000]::Polish[color=#000000])
[color=#c0c0c0] [color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Under[color=#c0c0c0] [color=#008000]X11,[color=#c0c0c0] [color=#008000]we[color=#c0c0c0] [color=#008000]need[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]flush[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]commands[color=#c0c0c0] [color=#008000]sent[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]server[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]ensure[color=#c0c0c0] [color=#008000]that
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]SFML[color=#c0c0c0] [color=#008000]will[color=#c0c0c0] [color=#008000]get[color=#c0c0c0] [color=#008000]an[color=#c0c0c0] [color=#008000]updated[color=#c0c0c0] [color=#008000]view[color=#c0c0c0] [color=#008000]of[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]windows
[color=#c0c0c0] [color=#000080]#ifdef[color=#c0c0c0] Q_WS_X11
[color=#c0c0c0] XFlush[color=#000000](QX11Info[color=#000000]::display[color=#000000]());
[color=#c0c0c0] [color=#000080]#endif
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Create[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]SFML[color=#c0c0c0] [color=#008000]window[color=#c0c0c0] [color=#008000]with[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]widget[color=#c0c0c0] [color=#008000]handle
[color=#c0c0c0] Create[color=#000000](winId[color=#000000]());
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Let[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]derived[color=#c0c0c0] [color=#008000]class[color=#c0c0c0] [color=#008000]do[color=#c0c0c0] [color=#008000]its[color=#c0c0c0] [color=#008000]specific[color=#c0c0c0] [color=#008000]stuff
[color=#c0c0c0] OnInit[color=#000000]();
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Setup[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]timer[color=#c0c0c0] [color=#008000]to[color=#c0c0c0] [color=#008000]trigger[color=#c0c0c0] [color=#008000]a[color=#c0c0c0] [color=#008000]refresh[color=#c0c0c0] [color=#008000]at[color=#c0c0c0] [color=#008000]specified[color=#c0c0c0] [color=#008000]framerate
[color=#c0c0c0] connect[color=#000000](&myTimer[color=#000000],[color=#c0c0c0] [color=#808000]SIGNAL[color=#000000](timeout[color=#000000]()),[color=#c0c0c0] [color=#808000]this[color=#000000],[color=#c0c0c0] [color=#808000]SLOT[color=#000000](repaint[color=#000000]()));
[color=#c0c0c0] myTimer[color=#000000].start[color=#000000]();
[color=#c0c0c0] [color=#000000]}
[color=#c0c0c0] [color=#808000]return[color=#c0c0c0] QWidget[color=#000000]::event[color=#000000]([color=#000000]Event[color=#000000]);
[color=#000000]}
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]Called[color=#c0c0c0] [color=#000080]when[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080]needs[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]be[color=#c0c0c0] [color=#000080]painted[color=#c0c0c0] [color=#000080];
[color=#000080]///[color=#c0c0c0] [color=#000080]we[color=#c0c0c0] [color=#000080]use[color=#c0c0c0] [color=#000080]it[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]display[color=#c0c0c0] [color=#000080]a[color=#c0c0c0] [color=#000080]new[color=#c0c0c0] [color=#000080]frame
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]void[color=#c0c0c0] QSFMLCanvas[color=#000000]::paintEvent[color=#000000](QPaintEvent[color=#000000]*)
[color=#000000]{
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Let[color=#c0c0c0] [color=#008000]the[color=#c0c0c0] [color=#008000]derived[color=#c0c0c0] [color=#008000]class[color=#c0c0c0] [color=#008000]do[color=#c0c0c0] [color=#008000]its[color=#c0c0c0] [color=#008000]specific[color=#c0c0c0] [color=#008000]stuff
[color=#c0c0c0] OnUpdate[color=#000000]();
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Display[color=#c0c0c0] [color=#008000]on[color=#c0c0c0] [color=#008000]screen
[color=#c0c0c0] Display[color=#000000]();
[color=#000000]}




QSFMLCanvas.hpp

[color=#000080]#ifndef[color=#c0c0c0] QSFMLCANVAS_HPP
[color=#000080]#define[color=#c0c0c0] QSFMLCANVAS_HPP
[color=#008000]////////////////////////////////////////////////////////////
[color=#008000]//[color=#c0c0c0] [color=#008000]Headers
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]#include[color=#c0c0c0] [color=#008000]<SFML/Graphics.hpp>
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QWidget>
[color=#000080]#include[color=#c0c0c0] [color=#008000]<QTimer>
[color=#808000]class[color=#c0c0c0] [color=#800080]QEvent[color=#000000];
[color=#008000]////////////////////////////////////////////////////////////
[color=#000080]///[color=#c0c0c0] [color=#000080]QSFMLCanvas[color=#c0c0c0] [color=#000080]allows[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]run[color=#c0c0c0] [color=#000080]SFML[color=#c0c0c0] [color=#000080]in[color=#c0c0c0] [color=#000080]a[color=#c0c0c0] [color=#000080]Qt[color=#c0c0c0] [color=#000080]control
[color=#008000]////////////////////////////////////////////////////////////
[color=#808000]class[color=#c0c0c0] [color=#800080]QSFMLCanvas[color=#c0c0c0] [color=#000000]:[color=#c0c0c0] [color=#808000]public[color=#c0c0c0] [color=#800080]QWidget[color=#000000],[color=#c0c0c0] [color=#808000]public[color=#c0c0c0] [color=#800080]sf[color=#000000]::[color=#800080]RenderWindow
[color=#000000]{
[color=#808000]public[color=#c0c0c0] [color=#000000]:
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Construct[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]QSFMLCanvas
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#0000ff]\param[color=#c0c0c0] [color=#000080]Size[color=#c0c0c0] [color=#000080]:[color=#c0c0c0] [color=#000080]Initial[color=#c0c0c0] [color=#000080]size[color=#c0c0c0] [color=#000080]of[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#0000ff]\param[color=#c0c0c0] [color=#000080]FrameTime[color=#c0c0c0] [color=#000080]:[color=#c0c0c0] [color=#000080]Frame[color=#c0c0c0] [color=#000080]duration,[color=#c0c0c0] [color=#000080]in[color=#c0c0c0] [color=#000080]milliseconds[color=#c0c0c0] [color=#000080](0[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]default)
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#0000ff]\param[color=#c0c0c0] [color=#000080]Parent[color=#c0c0c0] [color=#000080]:[color=#c0c0c0] [color=#000080]Parent[color=#c0c0c0] [color=#000080]of[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080](NULL[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]default)
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#800080]QSFMLCanvas[color=#000000]([color=#808000]const[color=#c0c0c0] [color=#800080]QSize[color=#000000]&[color=#c0c0c0] Size[color=#000000],[color=#c0c0c0] [color=#808000]unsigned[color=#c0c0c0] [color=#808000]int[color=#c0c0c0] FrameTime[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] [color=#000080]0[color=#000000],[color=#c0c0c0] [color=#800080]QWidget[color=#000000]*[color=#c0c0c0] Parent[color=#c0c0c0] [color=#000000]=[color=#c0c0c0] NULL[color=#000000]);
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Destructor
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#000000]~[color=#000000]QSFMLCanvas[color=#000000]();
[color=#808000]private[color=#c0c0c0] [color=#000000]:
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Notification[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]derived[color=#c0c0c0] [color=#000080]class[color=#c0c0c0] [color=#000080]that[color=#c0c0c0] [color=#000080]moment[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]good
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]doing[color=#c0c0c0] [color=#000080]initializations
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]void[color=#c0c0c0] [color=#000000]OnInit[color=#000000]();
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Notification[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]derived[color=#c0c0c0] [color=#000080]class[color=#c0c0c0] [color=#000080]that[color=#c0c0c0] [color=#000080]moment[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]good
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]for[color=#c0c0c0] [color=#000080]doing[color=#c0c0c0] [color=#000080]its[color=#c0c0c0] [color=#000080]update[color=#c0c0c0] [color=#000080]and[color=#c0c0c0] [color=#000080]drawing[color=#c0c0c0] [color=#000080]stuff
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]void[color=#c0c0c0] [color=#000000]OnUpdate[color=#000000]();
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Return[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]paint[color=#c0c0c0] [color=#000080]engine[color=#c0c0c0] [color=#000080]used[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]draw[color=#c0c0c0] [color=#000080]itself
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#800080]QPaintEngine[color=#000000]*[color=#c0c0c0] [color=#000000]paintEngine[color=#000000]()[color=#c0c0c0] [color=#808000]const[color=#000000];
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Called[color=#c0c0c0] [color=#000080]each[color=#c0c0c0] [color=#000080]time[color=#c0c0c0] [color=#000080]an[color=#c0c0c0] [color=#000080]event[color=#c0c0c0] [color=#000080]is[color=#c0c0c0] [color=#000080]received[color=#c0c0c0] [color=#000080]by[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080];
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]we[color=#c0c0c0] [color=#000080]use[color=#c0c0c0] [color=#000080]it[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]catch[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]Polish[color=#c0c0c0] [color=#000080]event[color=#c0c0c0] [color=#000080]and[color=#c0c0c0] [color=#000080]initialize
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]our[color=#c0c0c0] [color=#000080]SFML[color=#c0c0c0] [color=#000080]window
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]bool[color=#c0c0c0] [color=#000000]event[color=#000000]([color=#800080]QEvent[color=#000000]*[color=#c0c0c0] Event[color=#000000]);
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]Called[color=#c0c0c0] [color=#000080]when[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]widget[color=#c0c0c0] [color=#000080]needs[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]be[color=#c0c0c0] [color=#000080]painted[color=#c0c0c0] [color=#000080];
[color=#c0c0c0] [color=#000080]///[color=#c0c0c0] [color=#000080]we[color=#c0c0c0] [color=#000080]use[color=#c0c0c0] [color=#000080]it[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]display[color=#c0c0c0] [color=#000080]a[color=#c0c0c0] [color=#000080]new[color=#c0c0c0] [color=#000080]frame
[color=#c0c0c0] [color=#008000]///
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#808000]virtual[color=#c0c0c0] [color=#808000]void[color=#c0c0c0] [color=#000000]paintEvent[color=#000000]([color=#800080]QPaintEvent[color=#000000]*);
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]Member[color=#c0c0c0] [color=#008000]data
[color=#c0c0c0] [color=#008000]////////////////////////////////////////////////////////////
[color=#c0c0c0] [color=#800080]QTimer[color=#c0c0c0] [color=#800000]myTimer[color=#000000];[color=#c0c0c0] [color=#000080]///<[color=#c0c0c0] [color=#000080]Timer[color=#c0c0c0] [color=#000080]used[color=#c0c0c0] [color=#000080]to[color=#c0c0c0] [color=#000080]update[color=#c0c0c0] [color=#000080]the[color=#c0c0c0] [color=#000080]view
[color=#000000]};
[color=#000080]#endif[color=#c0c0c0] [color=#008000]//[color=#c0c0c0] [color=#008000]QSFMLCANVAS_HPP

~Saint Squireen
uuuuuuuummmmmmmmmmmmmmmmm.... is this what you wanted? this looks nothing like what I have in my file........

~Saint Squireen
Advertisement
You need to paste as plain text, otherwise GameDev's text editor abusively beats the crap out of everything. There are a few ways to do this, the three I like are: 1) first paste into something like Notepad (or any plain text editor), and the copy from Notepad into your post, or 2) click the light switch icon in the top left corner of your posting to switch to plain text mode (it's above the bold "B" icon and to the left of the eraser icon), or 3) (my favorite) if you're using Chrome, paste with "Crtl+Shift+v" to do a plain text paste.
[size=2][ I was ninja'd 71 times before I stopped counting a long time ago ] [ f.k.a. MikeTacular ] [ My Blog ] [ SWFer: Gaplessly looped MP3s in your Flash games ]
sorry ive been gone all day:( and i cant really do this till tomorrow sorry. and thanks for the insight Cornstalks, Ill try it it a soon as possible!!!!!

~Saint Squireen

This topic is closed to new replies.

Advertisement