回文章列表
作者cache.bbs@cpu.tfcis.org (modelslim...哭哭) 看板: itoc
標題[功能] 淡入淡出特效
時間動力核心 (2009/10/01 Thu 16:56:49)
這個 patch 可以美化 popupmenu 的選單背景或者一些功能

原作者是 hrs113355, 已經獲得他的同意發佈   : )



在 theme.h 中適當的地方加入:

+/* ----------------------------------------------------- */
+/* grayout 參數設定                                      */
+/* ----------------------------------------------------- */
+
+#define GRAYOUT_DARK    0
+#define GRAYOUT_BOLD    1
+#define GRAYOUT_NORMAL  2
+



在 visio.c 適當的地方加入:

+/* 090127.cache: 淡入淡出特效 */
+void
+grayout(int type)
+// GRAYOUT_DARK(0): dark, GRAYOUT_BOLD(1): bold, GRAYOUR_NORMAL(2): normal
+{
+  screenline slp[T_LINES], newslp[T_LINES];
+  char *prefix[3] = { "\033[1;30m", "\033[1;37m", "\033[0;37m" };
+  char buf[ANSILINELEN];
+  register int i;
+
+  vs_save(slp);
+  memcpy(newslp, slp, sizeof(newslp));+
+
+  for (i = 0; i < T_LINES; i++)
+  {
+      if (!newslp[i].width)
+  continue;
+
+      newslp[i].oldlen = newslp[i].len;
+      newslp[i].len = newslp[i].width + 7 + 3;
+
+      str_ansi(buf, slp[i].data, slp[i].width + 1);
+      sprintf(newslp[i].data, "%s%s\033[m" , prefix[type], buf);
+  }
+  vs_restore(newslp);
+}



maple.p : /* visio.c */ 

 int vans(char *prompt);
 int vkey(void);
+void grayout(int type);

 /* window.c */
int pans(int x, int y, char *title, char **desc);



之後在想要有效果的地方插入即可

Ex. post.c: post_showBRD_setting()

  blist = (bshm->bcache + bno)->BM; /* 檢視板主清單用 */

+ grayout(GRAYOUT_DARK);

  move(b_lines - 15, 0);
  clrtobot();  /* 避免畫面殘留 */

  prints("\033[1;34m"MSG_BLINE"\033[m");
  prints("\n\033[1;33;44m \033[37m看板設定及資訊查詢: %*s \033[m\n", 55,"");

這樣就會達到 fade in/out 的效果了

如果畫面變色後回不來, 改成 return XO_HEAD 看看  :P


--
=[:摃��:﹎Origin ]|[  Ocpu.tfcis.org  ]|[�搟說:]=
=[:摃�╱�:Author ]|[ netFPGA1.ee.ncku.edu.tw  ]|[�:]=
文章選讀←離開[主題上]主題下(k)上篇(j)下篇S/a搜尋 G串列 TAB精華 ↑↓捲 Pg/Space翻