bctitle.c

来自「用你的语音Modem实现像电话一样通话的程序」· C语言 代码 · 共 63 行

C
63
字号
#include "bctitle.h"BC_Title::BC_Title(int x, int y, char *text, int font, int color) : BC_Tool(x, y, w, h){	this->font = font;	this->color = color;	strcpy(this->text, text);}BC_Title::create_tool_objects(){	w = get_text_width(font, text) + 5;	h = get_text_height(font);	create_window(x, y, w, h, subwindow->color);	draw();}BC_Title::set_color(int color){	this->color = color;	draw();}BC_Title::resize(int w, int h){	draw();}BC_Title::resize_tool(int x, int y){	resize_window(x, y, w, h);	draw();}BC_Title::update(char *text){	strcpy(this->text, text);	static int new_w;		new_w = get_text_width(font, text) + 5;	if(new_w > w)	{		resize_window(x, y, new_w, h);	}	else	{		BC_Tool::set_color(BC_Tool::color);		draw_box(0, 0, w, h);      // wipe clear	}	draw();}BC_Title::draw(){	set_font(font);	BC_Tool::set_color(color);	draw_text(0, get_text_ascent(font), text);	set_font(LARGEFONT);    // reset	flash();}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?