[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Stratagus-CVS] stratagus/src clone/mainloop.c editor/editloop....
From: |
address@hidden |
Subject: |
[Stratagus-CVS] stratagus/src clone/mainloop.c editor/editloop.... |
Date: |
16 Dec 2003 22:46:04 +1100 |
CVSROOT: /home/strat
Module name: stratagus
Changes by: <address@hidden> 03/12/16 22:46:03
Modified files:
src/clone : mainloop.c
src/editor : editloop.c
src/game : intro.c
src/include : menus.h
src/ui : menu_proc.c menus.c
Log message:
Added support for 50 % translucide menus (some bad tabs unfortunately)
Patches:
Index: stratagus/src/clone/mainloop.c
diff -u stratagus/src/clone/mainloop.c:1.169
stratagus/src/clone/mainloop.c:1.170
--- stratagus/src/clone/mainloop.c:1.169 Sun Dec 14 07:54:12 2003
+++ stratagus/src/clone/mainloop.c Tue Dec 16 22:45:59 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: mainloop.c,v 1.169 2003/12/13 20:54:12 jsalmon3 Exp $
+// $Id: mainloop.c,v 1.170 2003/12/16 11:45:59 mohydine Exp $
//@{
@@ -275,29 +275,32 @@
}
if (NetworkFildes == (Socket)-1) {
if (TheUI.MenuButton.X != -1) {
+ //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.MenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive
: 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0),
+ (GameMenuButtonClicked ? MenuButtonClicked : 0), /*Transparent
*/ 0,
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
TheUI.MenuButton.X, TheUI.MenuButton.Y,
GameFont, TheUI.MenuButton.Text, NULL, NULL);
}
} else {
if (TheUI.NetworkMenuButton.X != -1) {
+ //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.NetworkMenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderNetworkMenu ?
MenuButtonActive : 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0),
+ (GameMenuButtonClicked ? MenuButtonClicked : 0), /*Transparent
*/ 0,
TheUI.NetworkMenuButton.Width, TheUI.NetworkMenuButton.Height,
TheUI.NetworkMenuButton.X, TheUI.NetworkMenuButton.Y,
GameFont, TheUI.NetworkMenuButton.Text, NULL, NULL);
}
if (TheUI.NetworkDiplomacyButton.X != -1) {
+ //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.NetworkDiplomacyButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderNetworkDiplomacy ?
MenuButtonActive : 0) |
- (GameDiplomacyButtonClicked ? MenuButtonClicked : 0),
+ (GameDiplomacyButtonClicked ? MenuButtonClicked : 0),
/*Transparent */ 0,
TheUI.NetworkDiplomacyButton.Width,
TheUI.NetworkDiplomacyButton.Height,
TheUI.NetworkDiplomacyButton.X, TheUI.NetworkDiplomacyButton.Y,
GameFont, TheUI.NetworkDiplomacyButton.Text, NULL, NULL);
Index: stratagus/src/editor/editloop.c
diff -u stratagus/src/editor/editloop.c:1.149
stratagus/src/editor/editloop.c:1.150
--- stratagus/src/editor/editloop.c:1.149 Sun Dec 14 07:54:13 2003
+++ stratagus/src/editor/editloop.c Tue Dec 16 22:46:00 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: editloop.c,v 1.149 2003/12/13 20:54:13 jsalmon3 Exp $
+// $Id: editloop.c,v 1.150 2003/12/16 11:46:00 mohydine Exp $
//@{
@@ -933,10 +933,11 @@
TheUI.MenuPanel.Graphic->Height,
TheUI.MenuPanelX, TheUI.MenuPanelY);
}
+ //FIX ME: Transparent flag, 3rd param, has been hardcoded.
DrawMenuButton(TheUI.MenuButton.Button,
(ButtonAreaUnderCursor == ButtonAreaMenu
&& ButtonUnderCursor == ButtonUnderMenu ? MenuButtonActive : 0) |
- (GameMenuButtonClicked ? MenuButtonClicked : 0),
+ (GameMenuButtonClicked ? MenuButtonClicked : 0), /* Transparent */ 0,
TheUI.MenuButton.Width, TheUI.MenuButton.Height,
TheUI.MenuButton.X,TheUI.MenuButton.Y,
GameFont,TheUI.MenuButton.Text, NULL, NULL);
Index: stratagus/src/game/intro.c
diff -u stratagus/src/game/intro.c:1.114 stratagus/src/game/intro.c:1.115
--- stratagus/src/game/intro.c:1.114 Sun Dec 14 07:54:14 2003
+++ stratagus/src/game/intro.c Tue Dec 16 22:46:01 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: intro.c,v 1.114 2003/12/13 20:54:14 jsalmon3 Exp $
+// $Id: intro.c,v 1.115 2003/12/16 11:46:01 mohydine Exp $
//@{
@@ -207,7 +207,7 @@
*/
local void DrawContinueButton(void)
{
- DrawMenuButton(MBUTTON_GM_HALF, ContinueButtonFlags,
+ DrawMenuButton(MBUTTON_GM_HALF, ContinueButtonFlags, 0,
106, 27,
ContinueButtonX, ContinueButtonY,
LargeFont, "~!Continue", NULL, NULL);
Index: stratagus/src/include/menus.h
diff -u stratagus/src/include/menus.h:1.116 stratagus/src/include/menus.h:1.117
--- stratagus/src/include/menus.h:1.116 Sun Dec 14 07:54:15 2003
+++ stratagus/src/include/menus.h Tue Dec 16 22:46:01 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.h,v 1.116 2003/12/13 20:54:15 jsalmon3 Exp $
+// $Id: menus.h,v 1.117 2003/12/16 11:46:01 mohydine Exp $
#ifndef __MENUS_H__
#define __MENUS_H__
@@ -222,6 +222,7 @@
int yofs;
unsigned flags;
int font;
+ int transparent; /// Add the transparent flag to
draw a transparent flag
void (*initfunc)(struct _menuitem_ *); /// constructor
void (*exitfunc)(struct _menuitem_ *); /// destructor
struct _menus_ *menu; /// backpointer for speedups
@@ -347,7 +348,7 @@
/// Draw menu
extern void DrawMenu(Menu *menu);
/// Draw menu button
-extern void DrawMenuButton(MenuButtonId button,unsigned flags,int w,int h,
+extern void DrawMenuButton(MenuButtonId button,unsigned flags,int
transparent,int w,int h,
int x,int y,const int font,const unsigned char *text,
char *normalcolor, char *reversecolor);
/// Set menu backgound and draw it
Index: stratagus/src/ui/menu_proc.c
diff -u stratagus/src/ui/menu_proc.c:1.114 stratagus/src/ui/menu_proc.c:1.115
--- stratagus/src/ui/menu_proc.c:1.114 Sun Dec 14 07:54:07 2003
+++ stratagus/src/ui/menu_proc.c Tue Dec 16 22:46:02 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menu_proc.c,v 1.114 2003/12/13 20:54:07 jsalmon3 Exp $
+// $Id: menu_proc.c,v 1.115 2003/12/16 11:46:02 mohydine Exp $
//@{
@@ -207,6 +207,7 @@
**
** @param button Button identifier
** @param flags State of Button (clicked, mouse over...)
+** @param transparent State of button transparency: 0=No, 1=Yes
** @param w Button width (for border)
** @param h Button height (for border)
** @param x X display position
@@ -216,7 +217,7 @@
** @param normalcolor
** @param reversecolor
*/
-global void DrawMenuButton(MenuButtonId button, unsigned flags, int w, int h,
+global void DrawMenuButton(MenuButtonId button, unsigned flags, int
transparent, int w, int h,
int x, int y, const int font, const unsigned char* text,
char* normalcolor, char* reversecolor)
{
@@ -284,7 +285,12 @@
}
}
if (rb < MenuButtonGfx.Sprite->NumFrames) {
- VideoDrawClip(MenuButtonGfx.Sprite, rb, x, y);
+ if (transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x, y);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, rb, x, y);
+ }
+
} else {
if (rb < button) {
VideoDrawRectangleClip(ColorGray, x + 1, y + 1, w - 2, h - 2);
@@ -504,7 +510,11 @@
while (i--) {
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1 +
oh * i);
+ } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + oh * i);
+ }
PopClipping();
text = mi->d.pulldown.options[i];
if (text) {
@@ -536,7 +546,11 @@
} else {
SetClipping(0, 0, x + w - 1, VideoHeight - 1);
}
- VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
+ }
PopClipping();
if (!(mi->d.pulldown.state & MI_PSTATE_PASSIVE)) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_DOWN_ARROW + rb -
MBUTTON_PULLDOWN,
@@ -606,7 +620,11 @@
while (i--) {
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + 18 * i);
+ } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1 + 18 * i);
+ }
PopClipping();
if (!(flags & MenuButtonDisabled)) {
if (i < mi->d.listbox.noptions) {
@@ -692,16 +710,26 @@
if (flags & MenuButtonDisabled) {
PushClipping();
SetClipping(0, 0, VideoWidth - 1, y + h - 20);
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y - 2);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x,
y - 2);
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x,
y + h / 2);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y -
2);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT - 1, x, y + h /
2);
+ }
PopClipping();
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_UP_ARROW - 1, x, y - 2);
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_DOWN_ARROW - 1, x, y + h -
20);
} else {
PushClipping();
SetClipping(0, 0, VideoWidth - 1, y + h - 20);
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y - 2);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y -
2);
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y +
h / 2);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y - 2);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_VCONT, x, y + h / 2);
+ }
PopClipping();
if (mi->d.vslider.cflags & MI_CFLAGS_UP) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_UP_ARROW + 1, x, y - 2);
@@ -785,16 +813,26 @@
if (flags & MenuButtonDisabled) {
PushClipping();
SetClipping(0, 0, x + w - 20, VideoHeight - 1);
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x - 2, y);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x -
2, y);
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x +
w / 2, y);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x - 2,
y);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT - 1, x + w / 2,
y);
+ }
PopClipping();
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_LEFT_ARROW - 1, x - 2, y);
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_RIGHT_ARROW - 1, x + w -
20, y);
} else {
PushClipping();
SetClipping(0, 0, x + w - 20, VideoHeight - 1);
- VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2, y);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2,
y);
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x + w /
2, y);
+ } else {
+ VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x - 2, y);
VideoDrawClip(MenuButtonGfx.Sprite, MBUTTON_S_HCONT, x + w / 2, y);
+ }
PopClipping();
if (mi->d.hslider.cflags & MI_CFLAGS_LEFT) {
VideoDraw(MenuButtonGfx.Sprite, MBUTTON_LEFT_ARROW + 1, x - 2,
y);
@@ -939,7 +977,11 @@
PushClipping();
SetClipping(0, 0, x + w, VideoHeight - 1);
+ if (mi->transparent) {
+ VideoDrawClipTrans50(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
+ } else {
VideoDrawClip(MenuButtonGfx.Sprite, rb, x - 1, y - 1);
+ }
PopClipping();
text = mi->d.input.buffer;
if (text) {
@@ -1068,7 +1110,7 @@
SetDefaultTextColors(oldnc, oldrc);
break;
case MI_TYPE_BUTTON:
- DrawMenuButton(mi->d.button.button, mi->flags,
+ DrawMenuButton(mi->d.button.button, mi->flags, mi->transparent,
mi->d.button.xsize, mi->d.button.ysize,
menu->X + mi->xofs, menu->Y + mi->yofs,
mi->font, mi->d.button.text,
Index: stratagus/src/ui/menus.c
diff -u stratagus/src/ui/menus.c:1.597 stratagus/src/ui/menus.c:1.598
--- stratagus/src/ui/menus.c:1.597 Sun Dec 14 07:54:08 2003
+++ stratagus/src/ui/menus.c Tue Dec 16 22:46:02 2003
@@ -26,7 +26,7 @@
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
// 02111-1307, USA.
//
-// $Id: menus.c,v 1.597 2003/12/13 20:54:08 jsalmon3 Exp $
+// $Id: menus.c,v 1.598 2003/12/16 11:46:02 mohydine Exp $
//@{
@@ -451,8 +451,8 @@
** Help-items for the Net Multiplayer Setup and Client Menus
*/
local Menuitem NetMultiButtonStorage[] = {
- { MI_TYPE_PULLDOWN, 40, 32, 0, GameFont, NULL, NULL, NULL, {{NULL,0}} },
- { MI_TYPE_DRAWFUNC, 40, 32, 0, GameFont, NULL, NULL, NULL, {{NULL,0}} },
+ { MI_TYPE_PULLDOWN, 40, 32, 0, GameFont, 0, NULL, NULL, NULL,
{{NULL,0}} },
+ { MI_TYPE_DRAWFUNC, 40, 32, 0, GameFont, 0, NULL, NULL, NULL,
{{NULL,0}} },
};
local void InitNetMultiButtonStorage() {
MenuitemPulldown i0 = { mgptsoptions, 172, 20, MBUTTON_PULLDOWN,
MultiGamePTSAction, 3, -1, 0, 0, 0};