Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual
Page 187

KTD-S0057-I
Page 183 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
// Add some random movement
if (dangerMice.size () > 1 && (qrand () % 10) == 0)
{
if (qrand () % 1)
angle += (qrand () % 100) / 500.0;
else
angle -= (qrand () % 100) / 500.0;
}
speed += (-50 + qrand () % 100) / 100.0;
qreal dx = ::sin (angle) * 10;
mouseEyeDirection = (qAbs (dx / 5) < 1) ? 0 : dx / 5;
setRotation (rotation () + dx);
setPos (mapToParent (0, -(3 + sin (speed) * 3)));
}
The third example refers to the sourcecode from '
Animation Framework Examples/Animated Tiles
'
and
needs also a subdirectory named '
images
' for the PNG-files. Remark: the background JPG-file is absent but
you can download it with the
'qt4-demos' package
- however you can do without it.
This example has to be changed on a large scale because the output from the MOC (Meta-Object Compiler)
is required. Create a new '
main.h
' file, copy all class definitions into this file and delete the definitions in
'
main.cpp
'.
One possible Makefile might look like this:
DEFINES = -DQT_WEBKIT -DQT_NO_DEBUG -DQT_GUI_LIB -DQT_CORE_LIB -DQT_SHARED
CXX := arm-linux-gnueabihf-g++ -march=armv7 -I/usr/include/qt4
LDFLAGS := -l QtCore -l QtGui -l QtDBus -l glib-2.0 -l png12 -l expat -l pcre -l uuid -l z
all: qt
qrc_animatedtiles.cpp: animatedtiles.qrc images/centered.png images/ellipse.png \
images/figure8.png
images/kinetic.png images/random.png images/tile.png
/usr/bin/rcc -name animatedtiles animatedtiles.qrc -o qrc_animatedtiles.cpp
moc_main.cpp: main.h
/usr/bin/moc-qt4 $(DEFINES) -I/usr/include/qt4 main.h -o moc_main.cpp
main.o: main.cpp moc_main.cpp
qt: main.o qrc_animatedtiles.o
$(CXX) -o $@ main.o qrc_animatedtiles.o $(LDFLAGS)
clean:
rm qt main.o qrc_animatedtiles.o