[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Views/MainM...
From: |
Matthias Braun |
Subject: |
[netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Views/MainM... |
Date: |
Thu, 06 Nov 2003 14:58:29 -0500 |
CVSROOT: /cvsroot/netpanzer
Module name: netpanzer
Branch:
Changes by: Matthias Braun <address@hidden> 03/11/06 14:58:29
Modified files:
. : ChangeLog
src/NetPanzer/Views/MainMenu/Multi: IRCLobbyView.cpp
src/Lib/2D : Surface.cpp Surface.hpp
src/Lib/View : View.cpp View.hpp cInputField.cpp
cInputField.hpp
Log message:
chat now works on return key
Patches:
Index: netpanzer/ChangeLog
diff -u netpanzer/ChangeLog:1.22 netpanzer/ChangeLog:1.23
--- netpanzer/ChangeLog:1.22 Thu Nov 6 12:53:25 2003
+++ netpanzer/ChangeLog Thu Nov 6 14:58:27 2003
@@ -1,5 +1,7 @@
06-Nov-2003 by Matthias Braun
-cleanups and imporvements to the IRC Lobby code
+-added a callback ability to input lines, when enter is pressed
+-removed chat button and make chat happen on return key
05-Nov-2003 by Matthias Braun
-added manpage contributed by Bartosz Fesnky <address@hidden>
Index: netpanzer/src/Lib/2D/Surface.cpp
diff -u netpanzer/src/Lib/2D/Surface.cpp:1.40
netpanzer/src/Lib/2D/Surface.cpp:1.41
--- netpanzer/src/Lib/2D/Surface.cpp:1.40 Sat Oct 25 11:41:58 2003
+++ netpanzer/src/Lib/2D/Surface.cpp Thu Nov 6 14:58:28 2003
@@ -1190,235 +1190,6 @@
*/
} // end Surface::scale
-// verticalWave3DAll
-//---------------------------------------------------------------------------
-void Surface::verticalWave3DAll(int numWaves, float percent)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- float curOffset = 0;
- float offsetStep = 100.0 / float(frameCount);
-
- for (int curFrame = 0; curFrame < frameCount; curFrame++) {
- setFrame(curFrame);
- verticalWave3D(numWaves, percent, (int) curOffset);
- curOffset += offsetStep;
- }
-} // end Surface::verticalWave3DAll
-
-// verticalWave3D
-//---------------------------------------------------------------------------
-void Surface::verticalWave3D(int numWaves, float percent, int offset)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- Surface temp;
- temp.create(pix.x, pix.y, pix.x, 1);
-
- float angleRadians = (offset * 3.6) / (180.0 / M_PI);
- float angleStep = ((M_PI * 2) * numWaves) / pix.y;
- float amplitude = (percent * pix.y / 2) / 100.0;
-
- blt(temp, 0, 0);
-
- int y = 0;
- for (int offset1 = 0; offset1 < pix.x * pix.y; offset1 += pix.x) {
- int offset2 = max(min(int(((cos(angleRadians) * amplitude + y))),
pix.y - 1), 0) * pix.x;
- y++;
- memcpy((mem + offset1), (temp.mem + offset2), pix.x);
-
- angleRadians += angleStep;
- }
-} // end Surface::VERTICAL WAVE 3D
-
-// horizontalWave3DAll
-//---------------------------------------------------------------------------
-void Surface::horizontalWave3DAll(int numWaves, float percent)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- float curOffset = 0;
- float offsetStep = 100.0 / float(frameCount);
-
- for (int curFrame = 0; curFrame < frameCount; curFrame++) {
- setFrame(curFrame);
- horizontalWave3D(numWaves, percent, (int) curOffset);
- curOffset += offsetStep;
- }
-} // end Surface::horizontalWave3DAll
-
-// horizontalWave3D
-//---------------------------------------------------------------------------
-void Surface::horizontalWave3D(int numWaves, float percent, int offset)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- Surface temp;
- temp.create(pix.x, pix.y, pix.x, 1);
-
- float angleRadians = (offset*3.6) / (180.0 / M_PI);
- float angleStep = ((M_PI * 2) * numWaves) / pix.y;
- float amplitude = (percent * pix.y / 2) / 100.0;
-
- blt(temp, 0, 0);
-
- for (int x = 0; x < pix.x; x++) {
- int xOffset = max(min((int)((cos(angleRadians) * amplitude + x)),
pix.x - 1), 0);
- for (int yOffset = 0; yOffset < pix.x * pix.y; yOffset += pix.x) {
- mem[x + yOffset] = temp.mem[xOffset + yOffset];
- angleRadians += angleStep;
- }
- }
-} // end Surface::horizontalWave3D
-
-// rippleAll
-//---------------------------------------------------------------------------
-void Surface::rippleAll(int numWaves, float percent)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- float curOffset = 0;
- float offsetStep = 100.0 / float(frameCount);
-
- for (int curFrame = 0; curFrame < frameCount; curFrame++) {
- setFrame(curFrame);
- ripple(numWaves, percent, (int) curOffset);
- curOffset += offsetStep;
- }
-} // end Surface::rippleAll
-
-// ripple
-//---------------------------------------------------------------------------
-void Surface::ripple(int numWaves, float percent, int offset)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- Surface temp(pix.x, pix.y, pix.x, 1);
-
- unsigned index = 0;
-
- float piTimes2 = float(M_PI * 2.0);
- float angleRadians = (piTimes2 * percent) / 100.0;
- float maxDist = sqrt(pix.x * pix.x + pix.y * pix.y);
- float scale = (piTimes2 * numWaves) / maxDist;
-
- offset = (int) ((offset * piTimes2) / 100.0);
-
- blt(temp, 0, 0);
-
- for (int y = 0; y < pix.y; y++) {
- for (int x = 0; x < pix.x; x++) {
- float a = sin(sqrt(x * x + y * y) * scale + offset) *
angleRadians;
- float ca = cos(a);
- float sa = sin(a);
-
- int xs = (int)(x * ca - y * sa) + x - center.x;
- int ys = (int)(y * ca + x * sa) + y - center.y;
-
- if (xs >= 0 && xs < x - pix.x && ys >= 0 && ys < y - pix.y)
- mem[index++] = temp.mem[(x - pix.x) * ys + xs];
- else mem[index++] = Color::black;
- }
- }
-} // end Surface::ripple
-
-// horizontalWaveAll
-//---------------------------------------------------------------------------
-void Surface::horizontalWaveAll(int numWaves, float percent)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- float curOffset = 0;
- float offsetStep = 100.0 / float(frameCount);
-
- for (int frame = 0; frame < frameCount; frame++) {
- setFrame(frame);
- horizontalWave(numWaves, percent, (int) curOffset);
- curOffset += offsetStep;
- }
-} // end Surface::horizontalWaveAll
-
-// horizontalWave
-//---------------------------------------------------------------------------
-void Surface::horizontalWave(int numWaves, float percent, int offset)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- Surface temp(pix.x, pix.y, pix.x, 1);
- blt(temp, 0, 0);
-
- float piTimes2 = float(M_PI * 2.0);
- float waveFrequency = (numWaves * piTimes2) / pix.y;
- float waveOffset = (offset * numWaves * piTimes2) / 100.0;
- float radius = (pix.x * percent) / 100.0;
-
- int index = 0;
-
- for (int y = 0; y < pix.y; y++) {
- int xOffset = int(round(sin(y * waveFrequency + waveOffset) * radius));
- for (int x = 0; x < pix.x; x++) {
- if (xOffset >= 0 && xOffset < pix.x)
- mem[index++] = temp.mem[xOffset + pix.x * y];
- else mem[index++] = Color::black;
- xOffset++;
- }
- }
-} // end Surface::horizontalWave
-
-// verticalWaveAll
-//---------------------------------------------------------------------------
-void Surface::verticalWaveAll(int numWaves, float percent)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- float curOffset = 0;
- float offsetStep = 100.0 / float(frameCount);
-
- for (int frame = 0; frame < frameCount; frame++) {
- setFrame(frame);
- verticalWave(numWaves, percent, (int) curOffset);
- curOffset += offsetStep;
- }
-} // end Surface::verticalWaveAll
-
-// verticalWave
-//---------------------------------------------------------------------------
-void Surface::verticalWave(int numWaves, float percent, int offset)
-{
- assert(getDoesExist());
- assert(this != 0);
-
- Surface temp(pix.x, pix.y, pix.x, 1);
- blt(temp, 0, 0);
-
- float piTimes2 = float(M_PI * 2.0);
- float waveFrequency = (numWaves * piTimes2) / pix.y;
- float waveOffset = (offset * numWaves * piTimes2) / 100.0;
- float radius = (pix.x * percent) / 100.0;
-
- for (int x = 0; x < pix.x; x++) {
- int yOffset = int(round(sin(x * waveFrequency + waveOffset) * radius));
-
- for (int y = 0; y < pix.y; y++) {
- if (yOffset >= 0 && yOffset < pix.y) {
- mem[pix.x * y + x] = temp.mem[pix.x * yOffset + x];
- } else {
- mem[pix.x * y + x] = Color::black;
- }
- yOffset++;
- }
- }
-} // end Surface::verticalWave
-
// drawButtonBorder
//---------------------------------------------------------------------------
void Surface::drawButtonBorder(iRect bounds, PIX topLeftColor, PIX
bottomRightColor) const
@@ -2328,13 +2099,10 @@
// Purpose: Blits the specied rom character to the screen at the specified
// location.
//---------------------------------------------------------------------------
-void Surface::bltChar8x8(const iXY &pos, const char &character, const PIX
&color)
+void Surface::bltChar8x8(const iXY &pos, unsigned char character, const PIX
&color)
{
-#ifdef _DEBUG
- if (character > ascii8x8.getFrameCount()) {
- assert(false);
- }
-#endif
+ if (character >= ascii8x8.getFrameCount())
+ return;
ascii8x8.setFrame(character);
ascii8x8.bltTransColor(*this, pos, color);
@@ -2342,17 +2110,13 @@
// bltChar5x5
//---------------------------------------------------------------------------
-void Surface::bltChar5x5(const iXY &pos, const char &character, const PIX
&color)
+void Surface::bltChar5x5(const iXY &pos, unsigned char character, const PIX
&color)
{
-#ifdef _DEBUG
- if (character > ascii5x5.getFrameCount()) {
- assert(false);
- }
-#endif
+ if (character >= ascii5x5.getFrameCount())
+ return;
ascii5x5.setFrame(character);
ascii5x5.bltTransColor(*this, pos, color);
-
} // end Surface::bltChar8x8
// bltString
@@ -2371,7 +2135,6 @@
bltChar8x8(iXY(pos.x + (index << 3), pos.y), string[index], color);
}
-
} // end Surface::bltString
// bltString5x5
@@ -2472,14 +2235,12 @@
}
//---------------------------------------------------------------------------
-void Surface::bltChar8x8VGradient(const iXY &pos, const char &character,
+void Surface::bltChar8x8VGradient(const iXY &pos, unsigned char character,
ColorTable &colorTable)
{
-#ifdef _DEBUG
- if (character > ascii8x8.getFrameCount()) {
- assert(false);
- }
-#endif
+ if (character >= ascii8x8.getFrameCount())
+ return;
+
ascii8x8.setFrame(character);
ascii8x8.bltTransVGradient(*this, pos, colorTable);
}
Index: netpanzer/src/Lib/2D/Surface.hpp
diff -u netpanzer/src/Lib/2D/Surface.hpp:1.17
netpanzer/src/Lib/2D/Surface.hpp:1.18
--- netpanzer/src/Lib/2D/Surface.hpp:1.17 Sat Oct 25 10:52:14 2003
+++ netpanzer/src/Lib/2D/Surface.hpp Thu Nov 6 14:58:28 2003
@@ -323,17 +323,6 @@
drawWindowsBorder(iRect(0, 0, pix.x, pix.y), light, medium, dark);
}
- void verticalWaveAll(int numWaves, float percent);
- void verticalWave(int numWaves, float percent, int offset);
- void horizontalWaveAll(int numWaves, float percent);
- void horizontalWave(int numWaves, float percent, int offset);
- void rippleAll(int numWaves, float percent);
- void ripple(int numWaves, float percent, int offset);
- void verticalWave3DAll(int numWaves, float percent);
- void verticalWave3D(int numWaves, float percent, int offset);
- void horizontalWave3DAll(int numWaves, float percent);
- void horizontalWave3D(int numWaves, float percent, int offset);
-
void blendIn(const Surface &source, iXY min, ColorTable &colorTable) const;
inline void blendIn(const Surface &source, ColorTable &colorTable) const
{
@@ -452,20 +441,20 @@
int loadAllBMPInDirectory(const char *path);
// Blit a single character of text.
- void bltChar8x8(const iXY &pos, const char &character, const PIX &color);
- void bltChar8x8(int x, int y, const char &character, const PIX &color)
+ void bltChar8x8(const iXY &pos, unsigned char character, const PIX &color);
+ void bltChar8x8(int x, int y, unsigned char character, const PIX &color)
{
bltChar8x8(iXY(x, y), character, color);
}
- void bltChar8x8VGradient(const iXY &pos, const char &character, ColorTable
&colorTable);
- void bltChar8x8VGradient(int x, int y, const char &character, ColorTable
&colorTable)
+ void bltChar8x8VGradient(const iXY &pos, unsigned char character,
ColorTable &colorTable);
+ void bltChar8x8VGradient(int x, int y, unsigned char character, ColorTable
&colorTable)
{
bltChar8x8VGradient(iXY(x, y), character, colorTable);
}
- void bltChar5x5(const iXY &pos, const char &character, const PIX &color);
- inline void bltChar5x5(int x, int y, const char &character, const PIX
&color)
+ void bltChar5x5(const iXY &pos, unsigned char character, const PIX &color);
+ inline void bltChar5x5(int x, int y, unsigned char character, const PIX
&color)
{
bltChar5x5(iXY(x, y), character, color);
}
Index: netpanzer/src/Lib/View/View.cpp
diff -u netpanzer/src/Lib/View/View.cpp:1.22
netpanzer/src/Lib/View/View.cpp:1.23
--- netpanzer/src/Lib/View/View.cpp:1.22 Sat Oct 25 10:52:15 2003
+++ netpanzer/src/Lib/View/View.cpp Thu Nov 6 14:58:28 2003
@@ -1524,7 +1524,7 @@
// addInputField
//---------------------------------------------------------------------------
-void View::addInputField(
+cInputField* View::addInputField(
const iXY &pos,
cInputFieldString *string,
const char *excludedCharacters,
@@ -1539,6 +1539,7 @@
selectedInputField = inputFields.getCount() - 1;
}
+ return & (inputFields[inputFields.getCount() - 1]);
} // end addInputField
//---------------------------------------------------------------------------
Index: netpanzer/src/Lib/View/View.hpp
diff -u netpanzer/src/Lib/View/View.hpp:1.12
netpanzer/src/Lib/View/View.hpp:1.13
--- netpanzer/src/Lib/View/View.hpp:1.12 Sat Oct 25 10:52:15 2003
+++ netpanzer/src/Lib/View/View.hpp Thu Nov 6 14:58:29 2003
@@ -220,7 +220,7 @@
void drawTitle(Surface &windowArea);
// Input Field Functions
- void addInputField(const iXY &pos, cInputFieldString *string, const char
*excludedCharacters, const bool &isSelected);
+ cInputField* addInputField(const iXY &pos, cInputFieldString *string,
const char *excludedCharacters, const bool &isSelected);
int findInputFieldContaining(const iXY &pos);
void drawInputFields(Surface &clientArea);
Index: netpanzer/src/Lib/View/cInputField.cpp
diff -u netpanzer/src/Lib/View/cInputField.cpp:1.12
netpanzer/src/Lib/View/cInputField.cpp:1.13
--- netpanzer/src/Lib/View/cInputField.cpp:1.12 Mon Oct 13 10:30:14 2003
+++ netpanzer/src/Lib/View/cInputField.cpp Thu Nov 6 14:58:29 2003
@@ -72,6 +72,7 @@
maxCharCount = 0;
destString = 0;
excludedCharacters = 0;
+ returnaction = 0;
} // end reset
// setPos
@@ -142,15 +143,17 @@
}
} // addChar
+void cInputField::setReturnAction(ACTION_FUNC_PTR action)
+{
+ returnaction = action;
+}
+
// addExtendedChar
//--------------------------------------------------------------------------
void cInputField::addExtendedChar(int newExtendedChar)
{
// Process the extendedChar accordingly.
switch (newExtendedChar) {
- case SDLK_RETURN: {}
- break;
-
case SDLK_HOME: {
cursorPos = 0;
}
@@ -210,6 +213,11 @@
}
break;
+
+ case SDLK_KP_ENTER:
+ case SDLK_RETURN: {
+ returnaction(this);
+ }
default: break;
}
Index: netpanzer/src/Lib/View/cInputField.hpp
diff -u netpanzer/src/Lib/View/cInputField.hpp:1.7
netpanzer/src/Lib/View/cInputField.hpp:1.8
--- netpanzer/src/Lib/View/cInputField.hpp:1.7 Mon Oct 13 10:30:14 2003
+++ netpanzer/src/Lib/View/cInputField.hpp Thu Nov 6 14:58:29 2003
@@ -99,8 +99,11 @@
return bounds.contains(pos);
}
+ typedef void (*ACTION_FUNC_PTR)(cInputField* inputfield);
+
void setPos(iXY pos);
void setInputFieldString(cInputFieldString *string);
+ void setReturnAction(ACTION_FUNC_PTR func);
void setExcludedCharacters(const char *excludedCharacters);
void addChar(int newChar);
void addExtendedChar(int newExtendedChar);
@@ -116,6 +119,7 @@
iRect bounds;
size_t cursorPos;
Surface inputFieldSurface;
+ ACTION_FUNC_PTR returnaction;
void reset();
Index: netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp
diff -u netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.2
netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.3
--- netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp:1.2 Thu Nov
6 12:53:26 2003
+++ netpanzer/src/NetPanzer/Views/MainMenu/Multi/IRCLobbyView.cpp Thu Nov
6 14:58:27 2003
@@ -39,7 +39,7 @@
IRCLobbyView::lobby_connection->refreshServerList();
}
-static void buttonChat(void)
+static void chatReturnPressed(cInputField* )
{
IRCLobbyView::lobby_connection->sendChatMessage(
gameconfig->playername,
@@ -69,10 +69,11 @@
resizeClientArea(area_size);
int chat_y=lobby_view_height-(Surface::getFontHeight()*2);
- addButtonCenterText(iXY(320, chat_y ), 80, "Chat", "", buttonChat);
- addButtonCenterText(iXY(320, chat_y-(Surface::getFontHeight()*2) ), 80,
"Refresh", "", buttonRefresh);
+ //addButtonCenterText(iXY(320, chat_y ), 80, "Chat", "", buttonChat);
+ addButtonCenterText(iXY(320, chat_y), 80, "Refresh", "", buttonRefresh);
szChat.init(" ", 34);
- addInputField(iXY(4, chat_y), &szChat, "", true);
+ cInputField* input = addInputField(iXY(4, chat_y), &szChat, "", true);
+ input->setReturnAction(chatReturnPressed);
}
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [netPanzer-CVS] netpanzer ./ChangeLog src/NetPanzer/Views/MainM...,
Matthias Braun <=