Signed-off-by: gregory guy <gregory-tde@laposte.net>pull/16/head
parent
b0ef1b76e6
commit
749694a3f2
@ -1,94 +0,0 @@
|
|||||||
/*
|
|
||||||
* Asciiquarium - Native KDE Screensaver based on the Asciiquarium program
|
|
||||||
* (c) Kirk Baucom <kbaucom@schizoid.com>, which you can find at
|
|
||||||
* http://www.robobunny.com/projects/asciiquarium/
|
|
||||||
*
|
|
||||||
* Ported to KDE by Maksim Orlovich <maksim@kde.org> and
|
|
||||||
* Michael Pyne <michael.pyne@kdemail.net>.
|
|
||||||
*
|
|
||||||
* Copyright (c) 2003 Kirk Baucom <kbaucom@schizoid.com>
|
|
||||||
* Copyright (c) 2005 Maksim Orlovich <maksim@kde.org>
|
|
||||||
* Copyright (c) 2005 Michael Pyne <michael.pyne@kdemail.net>
|
|
||||||
*
|
|
||||||
* This program is free software; you can redistribute it and/or
|
|
||||||
* modify it under the terms of the GNU General Public License
|
|
||||||
* as published by the Free Software Foundation; either version 2
|
|
||||||
* of the License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU General Public License
|
|
||||||
* along with this program; if not, write to the Free Software
|
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "sprite.h"
|
|
||||||
|
|
||||||
Sprite::Sprite(Screen* screen, int x, int y, int z, int frameDelay):
|
|
||||||
m_screen(screen), m_currentFrame(0), m_x(x), m_y(y), m_z(z),
|
|
||||||
m_isKilled(false), m_killAfterLastFrame(false),
|
|
||||||
m_ticksSinceFrameChange(0), m_frameDelay(frameDelay)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sprite::addFrame(const Frame& frame)
|
|
||||||
{
|
|
||||||
m_frames.append(frame);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sprite::erase()
|
|
||||||
{
|
|
||||||
m_frames[m_currentFrame].erase(m_screen, m_x, m_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
void Sprite::paint()
|
|
||||||
{
|
|
||||||
m_frames[m_currentFrame].paint(m_screen, m_x, m_y);
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::timerTick()
|
|
||||||
{
|
|
||||||
++m_ticksSinceFrameChange;
|
|
||||||
if (m_ticksSinceFrameChange * m_screen->msPerTick() < m_frameDelay)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
//Ring! Ring!
|
|
||||||
m_ticksSinceFrameChange = 0;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool Sprite::tickUpdate()
|
|
||||||
{
|
|
||||||
if (m_frames.size() == 1)
|
|
||||||
return false;
|
|
||||||
|
|
||||||
if (!timerTick())
|
|
||||||
return false;
|
|
||||||
|
|
||||||
erase();
|
|
||||||
|
|
||||||
++m_currentFrame;
|
|
||||||
if (m_currentFrame == m_frames.size())
|
|
||||||
{
|
|
||||||
m_currentFrame = 0;
|
|
||||||
|
|
||||||
if(m_killAfterLastFrame)
|
|
||||||
{
|
|
||||||
erase();
|
|
||||||
kill();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
TQRect Sprite::geom() const
|
|
||||||
{
|
|
||||||
return TQRect(m_x, m_y, m_frames[0].width(), m_frames[0].height());
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// vim: set et ts=8 sw=4:
|
|
@ -0,0 +1,42 @@
|
|||||||
|
include_directories(
|
||||||
|
${CMAKE_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${TDE_INCLUDE_DIR}
|
||||||
|
${TQT_INCLUDE_DIRS}
|
||||||
|
)
|
||||||
|
|
||||||
|
link_directories(
|
||||||
|
${TQT_LIBRARY_DIRS}
|
||||||
|
${TDE_LIB_DIR}
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
##### tdeasciiquarium (executable)
|
||||||
|
|
||||||
|
tde_add_executable( tdeasciiquarium.kss AUTOMOC
|
||||||
|
|
||||||
|
SOURCES
|
||||||
|
aasaver.cpp
|
||||||
|
screen.cpp
|
||||||
|
frame.cpp
|
||||||
|
sprite.cpp
|
||||||
|
AASaverConfig.kcfgc
|
||||||
|
settingswidget.ui
|
||||||
|
LINK
|
||||||
|
tdecore-shared
|
||||||
|
tdeui-shared
|
||||||
|
tdescreensaver-shared
|
||||||
|
|
||||||
|
DESTINATION ${BIN_INSTALL_DIR}
|
||||||
|
)
|
||||||
|
set_source_files_properties( aasaver.cpp PROPERTIES COMPILE_FLAGS -Wno-trigraphs )
|
||||||
|
|
||||||
|
|
||||||
|
##### other data
|
||||||
|
|
||||||
|
tde_create_translated_desktop(
|
||||||
|
SOURCE tdeasciiquarium.desktop
|
||||||
|
DESTINATION ${APPS_INSTALL_DIR}/System/ScreenSavers
|
||||||
|
PO_DIR tdescreensaver-desktops
|
||||||
|
)
|
@ -0,0 +1,26 @@
|
|||||||
|
/*
|
||||||
|
* Asciiquarium - Native KDE Screensaver based on the Asciiquarium program
|
||||||
|
* (c) Kirk Baucom <kbaucom@schizoid.com>, which you can find at
|
||||||
|
* http://www.robobunny.com/projects/asciiquarium/
|
||||||
|
*
|
||||||
|
* Ported to KDE by Maksim Orlovich <maksim@kde.org> and
|
||||||
|
* Michael Pyne <michael.pyne@kdemail.net>.
|
||||||
|
*
|
||||||
|
* Copyright (c) 2003 Kirk Baucom <kbaucom@schizoid.com>
|
||||||
|
* Copyright (c) 2005 Maksim Orlovich <maksim@kde.org>
|
||||||
|
* Copyright (c) 2005 Michael Pyne <michael.pyne@kdemail.net>
|
||||||
|
*
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License
|
||||||
|
* as published by the Free Software Foundation; either version 2
|
||||||
|
* of the License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
|
*/
|
@ -0,0 +1 @@
|
|||||||
|
TDEAsciiquarium gets registered as Miscellaneous from the Trinity Control Center - Screen Saver option
|
@ -1,7 +1,7 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
|
<!DOCTYPE kcfg SYSTEM "http://www.kde.org/standards/kcfg/1.0/kcfg.dtd">
|
||||||
<kcfg>
|
<kcfg>
|
||||||
<kcfgfile name="asciiquariumrc"/>
|
<kcfgfile name="tdeasciiquariumrc"/>
|
||||||
<group name="Settings">
|
<group name="Settings">
|
||||||
<entry name="fishCount" type="Int">
|
<entry name="fishCount" type="Int">
|
||||||
<label>Amount of fish to have in the sea.</label>
|
<label>Amount of fish to have in the sea.</label>
|
@ -0,0 +1,64 @@
|
|||||||
|
#include "sprite.h"
|
||||||
|
|
||||||
|
Sprite::Sprite(Screen* screen, int x, int y, int z, int frameDelay):
|
||||||
|
m_screen(screen), m_currentFrame(0), m_x(x), m_y(y), m_z(z),
|
||||||
|
m_isKilled(false), m_killAfterLastFrame(false),
|
||||||
|
m_ticksSinceFrameChange(0), m_frameDelay(frameDelay)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::addFrame(const Frame& frame)
|
||||||
|
{
|
||||||
|
m_frames.append(frame);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::erase()
|
||||||
|
{
|
||||||
|
m_frames[m_currentFrame].erase(m_screen, m_x, m_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
void Sprite::paint()
|
||||||
|
{
|
||||||
|
m_frames[m_currentFrame].paint(m_screen, m_x, m_y);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::timerTick()
|
||||||
|
{
|
||||||
|
++m_ticksSinceFrameChange;
|
||||||
|
if (m_ticksSinceFrameChange * m_screen->msPerTick() < m_frameDelay)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
//Ring! Ring!
|
||||||
|
m_ticksSinceFrameChange = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool Sprite::tickUpdate()
|
||||||
|
{
|
||||||
|
if (m_frames.size() == 1)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!timerTick())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
erase();
|
||||||
|
|
||||||
|
++m_currentFrame;
|
||||||
|
if (m_currentFrame == m_frames.size())
|
||||||
|
{
|
||||||
|
m_currentFrame = 0;
|
||||||
|
|
||||||
|
if(m_killAfterLastFrame)
|
||||||
|
{
|
||||||
|
erase();
|
||||||
|
kill();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
TQRect Sprite::geom() const
|
||||||
|
{
|
||||||
|
return TQRect(m_x, m_y, m_frames[0].width(), m_frames[0].height());
|
||||||
|
}
|
@ -1,23 +1,23 @@
|
|||||||
[Desktop Entry]
|
[Desktop Entry]
|
||||||
Encoding=UTF-8
|
Encoding=UTF-8
|
||||||
Exec=asciiquarium.kss
|
Exec=tdeasciiquarium.kss
|
||||||
Icon=tdescreensaver
|
Icon=tdescreensaver
|
||||||
Type=Application
|
Type=Application
|
||||||
Actions=InWindow;Root;Setup
|
Actions=InWindow;Root;Setup
|
||||||
Name=Asciiquarium
|
Name=TDEAsciiquarium
|
||||||
X-TDE-Category=Miscellaneous
|
X-TDE-Category=Miscellaneous
|
||||||
|
|
||||||
[Desktop Action InWindow]
|
[Desktop Action InWindow]
|
||||||
Exec=asciiquarium.kss -window-id %w
|
Exec=tdeasciiquarium.kss -window-id %w
|
||||||
Name=Display in specified window
|
Name=Display in specified window
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
|
|
||||||
[Desktop Action Root]
|
[Desktop Action Root]
|
||||||
Exec=asciiquarium.kss -root
|
Exec=tdeasciiquarium.kss -root
|
||||||
Name=Display in root window
|
Name=Display in root window
|
||||||
NoDisplay=true
|
NoDisplay=true
|
||||||
|
|
||||||
[Desktop Action Setup]
|
[Desktop Action Setup]
|
||||||
Exec=asciiquarium.kss -setup
|
Exec=tdeasciiquarium.kss -setup
|
||||||
Name=Display setup dialog
|
Name=Display setup dialog
|
||||||
NoDisplay=true
|
NoDisplay=true
|
Loading…
Reference in new issue