Beispiel #1
0
Datei: draw.c Projekt: elhmn/mod1
static void	draw_vertical(t_lst *a, t_lst *b, t_env *e)
{
	int		y;
	char	rev;

	rev = a->y_pix > b->y_pix ? 1 : 0;
	y = a->y_pix;
	while (y != b->y_pix)
	{
		mlx_pixel_put(e->mlx, e->win, a->x_pix, y, clr(a, b, e));
		rev ? y-- : y++;
	}
}
Beispiel #2
0
/* ------------- reset the MENUBAR -------------- */
static void reset_menubar(WINDOW wnd)
{
    ATTRCHR * cp = GetText(wnd) = DFrealloc(GetText(wnd), (SCREENWIDTH+5) * sizeof(ATTRCHR));
	int attr = clr(WndForeground(wnd), WndBackground(wnd));
	int i;
	for (i=0; i < SCREENWIDTH +5; i++)
	{
		cp->ch = ' ';
		cp->attrib = attr;
		cp++;
	}
    (GetText(wnd)+WindowWidth(wnd))->ch = '\0';
}
Beispiel #3
0
void init() {
	int i;
	if ((lcd_fd = open("/dev/dbox/lcd0",O_RDWR)) < 0) {
		perror("open(/dev/dbox/lcd0)");
		exit(1);
	}
	clr();

	i = LCD_MODE_BIN;
	if (ioctl(lcd_fd,LCD_IOCTL_ASC_MODE,&i) < 0) {
		perror("init(LCD_MODE_BIN)");
		exit(1);
	}
}
void GColorStatic::OnPaint() {

    CPaintDC paintdc(this);

    CDC * cdc = GetDC();
    if (cdc == NULL) {
//        logger.log("cdc null in GColorStatic::OnPaint()");
        return;
    }
    CRect rect;
    GetClientRect(rect);

	COLORREF clr(RGB(212,208,200));
	clr=RGB(170,170,170);



	COLORREF crblack = RGB(0,0,0);
	CBrush brush(crblack);
//	CGdiObject * oldbrush = cdc->SelectObject(brush);
	cdc->FrameRect(rect, &brush);
	rect.DeflateRect(1,1,1,1);
	cdc->FrameRect(rect, &brush);
	rect.DeflateRect(1,1,1,1);
	cdc->FrameRect(rect, &brush);
//	cdc->SelectObject(oldbrush);


	cdc->FillSolidRect( mRect.TopLeft().x, mRect.TopLeft().y,
		mRect.Width(), mRect.Height(), clr);


	ReleaseDC(cdc);



class CUseBrush {
	CGdiObject* m_OldBrush;
	CDC* m_pDC;
public:
	CUseBrush(CDC* pDC, CGdiObject * br) {
		m_pDC=pDC; 
		m_OldBrush=pDC->SelectObject(br);
	}
	~CUseBrush() {
		m_pDC->SelectObject(m_OldBrush);
	}
};

}
Beispiel #5
0
void init(int n)
{
        globalCnt=0;
        flagCycle=false;
        head=1;
        for(int i=0;i<=n;i++)
        {
            adj[i].clear();adj_shrink[i].clear();
            tarjan.clear();
        }
        clr(vis);clr(color);  clr(indeg);clr(outdeg);
        clr(low);clr(disc);clr(cycle);
}
Beispiel #6
0
void menuNewRaid(){
    clr();
    int n;
    printf("\n\tNueva Unidad RAID\n\n");
    printf("Ingrese la ruta de la nueva unidad\n");
    printf("raid-manager> ");
    char *path = readln(256);
    printf("\n %s Ruta Seleccionada!\nIngrese el tamaño de la nueva unidad (mb) \n",path);
    printf("Min: 2(mb) Max: 10(mb)\n");
    scanf("%i",&n);
    newraid(path,n);
    printf("\nPresione cualquier tecla para continuar...");
    readchar();
    
}
Beispiel #7
0
LOCAL BOOL ListBox_OnCreate(HWND hWindow, CREATESTRUCT FAR* lpCreateStruct)
/***********************************************************************/
{
LPLISTBOXDATA lpData;
LONG lResult;

lpData = (LPLISTBOXDATA)Alloc(sizeof(LISTBOXDATA));
if (!lpData)
	return(FALSE);
clr((LPTR)lpData, sizeof(LISTBOXDATA));
lpData->fEnableMove = TRUE;
SetWindowLong(hWindow, ListBox_WindowExtra, (long)lpData);
lResult = FORWARD_WM_CREATE(hWindow, lpCreateStruct, ListBox_CallWindowProc);
return(lResult >= 0);
}
Beispiel #8
0
void ins() {
    int tmp, i, n;
    int h = 0;
    scanf("%d", &n);
    while(n--) {
        scanf("%d", &tmp);
        tmp--;
        if(node[h].next[tmp] == 0) {
            clr();
            node[h].next[tmp] = tot;
        }
        h = node[h].next[tmp];
    }
    node[h].id++;
}
Beispiel #9
0
void Eular()
{
	clr(check,false);
    totp = 0;
	for (int i = 2; i < N; i++)
	{
		if (!check[i]) prime[totp++] = i;
		for (int j = 0; j < totp; j++)
		{
			if (i * prime[j] >= N) break;
			check[i * prime[j]] = true;
			if (i % prime[j] == 0) break;
		}
	}
}
Beispiel #10
0
int main(int argc, char *argv[])
{
    screen_t screen;
    int x, y;
//	int D=atoi(argv[1]);
#define D	3
    // try other values
    pthread_t ut;
    init();

    memset(intensity, 0, LCD_ROWS*LCD_COLS*8);
    pthread_create(&ut, 0, update_thread, 0);

    for (y=0; y<65; y++)
    {
        for (x=0; x<120; x++)
            image[LCD_COLS*y+x]=0;
    }

    while (1)
    {
        int x, y, yy, pix;
        for (y=0; y<LCD_ROWS; y++) {
            for (x=0; x<LCD_COLS; x++) {
                pix = 0;
                for (yy=0; yy<8; yy++) {
                    int off=(8*y+(7-yy))*LCD_COLS+x;
                    int val, t=image[off];

                    if (intensity[off] < t)
                        val=1;
                    else
                        val=0;

                    pix = (pix<<1) + val;

                    intensity[off]=(intensity[off])*(256-D)/256;
                    intensity[off]+=val*D;
                }
                screen[y*LCD_COLS+x] = pix;
            }
        }

        draw_screen(screen);
    }
    clr();
    return 0;
}
Beispiel #11
0
void Graph::set_colorlines(const std::vector<std::string> &_colorlines) {
    this->colorlines = _colorlines;
    std::string delimiter = "#";
    for(std::vector<std::string>::const_iterator it = this->colorlines.begin();
        it != this->colorlines.end(); ++it) {

        std::string value = it->substr(0, it->find(delimiter));
        std::string rgb = it->substr(it->find(delimiter) + 1);

        this->colorline_values.push_back( str2float(value) );
        Color clr(hex2int(rgb.substr(0,2)),
                  hex2int(rgb.substr(2,2)),
                  hex2int(rgb.substr(4,2)) );
        this->colorline_colors.push_back(clr);
    }
}
Beispiel #12
0
int phi_table(int n){
    clr (check, 0); phi[1] = 1;
    int tot = 0;
    for (int i = 2; i <= n; ++ i){
        if (!check[i]) prm[ tot++ ] = i, phi[i] = i - 1;
        for (int j = 0; j < tot; j ++){
            if (i * prm[j] > n) break;
            check[ i*prm[j] ] = 1;
            if (i % prm[j] == 0){
                phi[ i*prm[j] ] = phi[i] * prm[j]; break;
            }
            else phi[ i*prm[j] ] = phi[i] * (prm[j] - 1);
        }
    }
    return tot;
}
Beispiel #13
0
int main(struct multiboot *mboot_ptr)
{
    int i, j;
    char ch = 'a';
//	initializegdt();
    clr ();
    // int a = 204800000;
    //asm volatile("mov %0, %%esp" : : "r" (a));
    // asm volatile("cli");
    initializegdt();
    initializeidt();
    DetectBios32Service();
    DetectPciBiosService();
    // InitializePaging();

    StrobePciDevices();
    //asm volatile("sti");
    // pci_scan();
    // StrobePciDevices();
    DetectNetworkDevices();
    asm volatile("sti");

    putch('\n');
//	asm volatile ("int $0x10");
//	asm volatile ("int $0x0");
//	asm volatile ("int $0x2");
//	asm volatile("sti");
//        while(1)
    {
        //    int  *pointer = (uint32 *)kmalloc(12000000);
        //      }
//        int *pointer = (uint32 *) 0x10000000;
        //      if( pointer )
        //				*pointer = 201;
        //		  else
        //			   puts("Failed to allocate");
        //         putint(*pointer);
//			 puts("unknown\n");
//          kfree(pointer);
    }
//        while(1);
//	clr();
//	test();
//	puts("rajnesh\n");
//	putint(12323);
    return 0xDEADBABA;
}
/////////////////////////////////////
// Purpose:	render texture as
//			billboard. Texture will be
//			displayed on GFXSceneRender
// Output:	scene added
// Return:	TRUE if success
/////////////////////////////////////
u32 IgfxTexture::BltBillboard(const Vec3D & center, f32 size, f32 rot, const Vec4D *pClr)
{
	//check for frustrum
	if(!FrustrumCheckCube(center.x, center.y, center.z, size))
		return TRUE;

	Matrix trans; MtxIdentity(&trans);

	if(rot != 0)
	{
		Matrix axisM; MtxAxisRotation(&g_txtDir, rot, &axisM);

		trans._11 = size*axisM._11;
		trans._21 = size*axisM._21;
		trans._31 = size*axisM._31;

		trans._12 = size*axisM._12;
		trans._22 = size*axisM._22;
		trans._32 = size*axisM._32;

		trans._13 = size*axisM._13;
		trans._23 = size*axisM._23;
		trans._33 = size*axisM._33;

		trans._14 = size*axisM._14;
		trans._24 = size*axisM._24;
		trans._34 = size*axisM._34;

		trans._41 = center.x; trans._42 = center.y; trans._43 = center.z;
	}
	else
	{
		trans._11 = size; trans._22 = size; trans._33 = size;
		trans._41 = center.x; trans._42 = center.y; trans._43 = center.z;
	}

	if(pClr)
		Blt3DEX(s_pTxtBBVtxBuff, GFXPT_TRIANGLEFAN, 4, 2, &trans, *pClr);
	else
	{
		Vec4D clr(1,1,1,1);
		Blt3DEX(s_pTxtBBVtxBuff, GFXPT_TRIANGLEFAN, 4, 2, &trans, clr);
	}

	return TRUE;
}
Beispiel #15
0
//-----------------------------------------------------------------------------
mglCanvas::mglCanvas(int w, int h) : mglBase()
{
	clr(MGL_DISABLE_SCALE);
	set(MGL_VECT_FRAME);	// NOTE: require a lot of memory!
	Z=0;	C=G=G4=GB=0;	OI=0;	gif=0;
	CurFrameId=0;	Delay=0.5;
	Width=Height=Depth=0;	ObjId=-1;
	fscl=ftet=0;		PlotId = "frame";
	pnt_col = 0;

	ac.ch='c';
	ax.dir = mglPoint(1,0,0);	ax.a = mglPoint(0,1,0);	ax.b = mglPoint(0,0,1);	ax.ch='x';
	ay.dir = mglPoint(0,1,0);	ay.a = mglPoint(1,0,0);	ay.b = mglPoint(0,0,1);	ay.ch='y';
	az.dir = mglPoint(0,0,1);	az.a = mglPoint(0,1,0);	az.b = mglPoint(1,0,0);	az.ch='z';

	SetSize(w,h);	SetQuality(MGL_DRAW_NORM);	DefaultPlotParam();
}
void dijkstra(int s) {
	priority_queue<PII, vector<PII>, greater<PII> > que;
	clr(dis, INF);
	dis[s] = 0;
	que.push(PII(0, s));
	while (!que.empty()) {
		PII p = que.top(); que.pop();
		int v = p.se;
		if (dis[v] < p.fi) continue;
		for (int i = head[v]; i != -1; i = e[i].next) {
			int u = e[i].to, cost = e[i].cost;
			if (dis[u] > dis[v] + cost) {
				dis[u] = dis[v] + cost;
				que.push(PII(dis[u], u));
			}
		}
	}
}
Beispiel #17
0
void ChartWidget::paintEvent(QPaintEvent* e)
{
	Q_UNUSED(e);

	QPainter painter(this);

	painter.fillRect(e->rect(), Qt::white);

	if (m_chartS->isRedrawRequired())
	{
		QSize sz = calcPixmapSize();
		m_chartS->draw(sz);

		QRect rcScroll(m_rcPixmapMax.left(), m_rcPixmapMax.top() + sz.height(), sz.width(), 20);
		if (rcScroll != m_scrollbar->geometry())
			m_scrollbar->setGeometry(rcScroll);
	}

	m_rcPixmap = m_pixmap->borderRect();
	m_rcPixmap.moveTo(m_rcPixmapMax.topLeft());
	painter.drawPixmap(m_rcPixmap.topLeft(), m_pixmap->pixmap());

	// If the user is currently selecting an area to zoom in on:
	if (m_bDragging && m_bSelecting)
	{
		int x0 = m_ptClickWidget.x();
		int x1 = m_ptMouseWidget.x();
		if (x0 > x1)
			qSwap(x0, x1);
		x0 = qMax(x0, m_rcPixmap.left());
		x1 = qMin(x1, m_rcPixmap.right());
		
		QRect rcBorder = m_rcPixmap;
		QRect rc(QPoint(x0, rcBorder.top() + 1), QPoint(x1, rcBorder.bottom() - 1));
		QColor clr(0, 0, 255, 100);
		painter.fillRect(rc, clr);
	}

	if (m_bForceStatusUpdate)
	{
		m_bForceStatusUpdate = false;
		updateStatus();
	}
}
Beispiel #18
0
void CChromaMask::MaskAddChroma(LPIMAGE lpImage, LPMASK lpMask, LPRECT lpRect, BOOL MaskExist)
{
	int         dx, dy, i, depth;
	LPTR        lpAlphaLine;
	LPTR        lpLine;
	LPOBJECT    lpBase = ImgGetBase(lpImage);
   	int         top = -1;
   	int         bottom = 0;
   	FRMTYPEINFO TypeInfo;

	ProgressBegin(1,PROGRESS_ID(IDS_CHROMA_APPLY));
	PixmapGetInfo(&lpMask->Pixmap, PMT_EDIT, &dx, &dy, NULL, NULL);
	
   	ImgGetTypeInfo(lpImage, &TypeInfo);
   	if (!(depth = FrameDepth(ObjGetEditFrame(lpBase))))
    	depth = 1; // never worry about lineart
	
   	xExtL = 10000;
   	xExtR = 0;
   	lpLine = Alloc((long)dx*depth);
	for (i = 0; i < dy; ++i)
	{
    	AstralClockCursor(i, dy, NO);
      	Dirty = FALSE;
		lpAlphaLine = PixmapPtr( &lpMask->Pixmap, PMT_EDIT, 0, i, YES);
      	if (Delete)
			clr(lpAlphaLine, dx);
      	ImgGetLine(lpImage, lpBase, 0, i, dx, lpLine, NULL);
      	ChromaProc(dx, TypeInfo, lpLine, lpAlphaLine, MaskExist);
      	if (Dirty)
        {
        	if (top == -1)
            	top = i;
         	if (i > bottom)
            bottom = i;
        }
	}
	lpRect->left   = xExtL;
   	lpRect->right  = xExtR;
   	lpRect->top    = top;
   	lpRect->bottom = bottom;
   	FreeUp(lpLine);
	ProgressEnd();
}
Beispiel #19
0
BOOL BasicScene::Init() {
    IDirect3DVertexBuffer9* floor;
    m_D3DDev->CreateVertexBuffer(6 * sizeof(Vertex), 0, Vertex::FVF, D3DPOOL_MANAGED, &floor, NULL);
    m_Floor.Attach(floor);

    Vertex* v = 0;
    floor->Lock(0, 0, (void**) &v, 0);

    v[0] = Vertex(-20.0f, -2.5f, -20.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f);
    v[1] = Vertex(-20.0f, -2.5f,  20.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f);
    v[2] = Vertex( 20.0f, -2.5f,  20.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f);

    v[3] = Vertex(-20.0f, -2.5f, -20.0f, 0.0f, 1.0f, 0.0f, 0.0f, 1.0f);
    v[4] = Vertex( 20.0f, -2.5f,  20.0f, 0.0f, 1.0f, 0.0f, 1.0f, 0.0f);
    v[5] = Vertex( 20.0f, -2.5f, -20.0f, 0.0f, 1.0f, 0.0f, 1.0f, 1.0f);

    floor->Unlock();

    ID3DXMesh* pillar;
    D3DXCreateCylinder(m_D3DDev, 0.5f, 0.5f, 5.0f, 20, 20, &pillar, NULL);
    m_Pillar.Attach(pillar);

    IDirect3DTexture9* tex;
    HRESULT hr = D3DXCreateTextureFromFile(m_D3DDev, TextureFile, &tex);
    SGL_FAILED_DO(hr, MYTRACE_DX("D3DXCreateTextureFromFile", hr); return FALSE);
    m_FloorTex.Attach(tex);

    // Pre-Render Setup
    m_D3DDev->SetSamplerState(0, D3DSAMP_MAGFILTER, D3DTEXF_LINEAR);
    m_D3DDev->SetSamplerState(0, D3DSAMP_MINFILTER, D3DTEXF_LINEAR);
    m_D3DDev->SetSamplerState(0, D3DSAMP_MIPFILTER, D3DTEXF_POINT);

    D3DXVECTOR3 dir(0.707f, -0.707f, 0.707f);
    D3DXCOLOR clr(1.0f, 1.0f, 1.0f, 1.0f);
    D3DLIGHT9 light;
    SGL::InitDirLight(&light, dir, clr);

    m_D3DDev->SetLight(0, &light);
    m_D3DDev->LightEnable(0, TRUE);
    m_D3DDev->SetRenderState(D3DRS_NORMALIZENORMALS, TRUE);
    m_D3DDev->SetRenderState(D3DRS_SPECULARENABLE, TRUE);

    return TRUE;
}
Beispiel #20
0
int main() {
  FILE *fi,*fo;
  int i,t;
  fi=fopen("input","r");
  fo=fopen("output","w");
  for(i=0;i<N;i++) {
    clr(i);
  }
  while(fscanf(fi,"%d",&t)!=EOF) {
    set(t);
  }
  for(i=0;i<N;i++) {
    if(test(i))
      fprintf(fo,"%d\n",i);
  }
  fclose(fi);
  fclose(fo);
  return 0;
}
Beispiel #21
0
Datei: draw.c Projekt: elhmn/mod1
static void	draw_rev(t_lst *a, t_lst *b, t_env *e)
{
	double	alpha;
	int		beta;
	int		x;
	int		y;
	char	rev;

	rev = a->y_pix > b->y_pix ? 1 : 0;
	alpha = (double)(b->y_pix - a->y_pix) / (double)(b->x_pix - a->x_pix);
	beta = (b->x_pix * a->y_pix - a->x_pix * b->y_pix) / (b->x_pix - a->x_pix);
	y = a->y_pix;
	while (y != b->y_pix)
	{
		x = (int)((y - beta) / alpha);
		mlx_pixel_put(e->mlx, e->win, x, y, clr(a, b, e));
		rev ? y-- : y++;
	}
}
Beispiel #22
0
int menu(){
    int o;
    clr();
    printf("\n\t==============================\n");
    printf("\tRaid Manager vr. 2.11.34-alpha\n");
    printf("\t==============================\n");
    printf("\t\t2013 (c) Dennis Higueros\n\n");
    printf("\tOPCIONES:\n");
    printf("\t\t0. Salir\n");
    printf("\t\t1. Crear Unidad RAID\n");
    printf("\t\t2. Montar Unidad RAID\n");
    printf("\t\t3. Desmontar Unidad RAID\n");
    printf("\t\t4. Utilizar Unidad RAID\n");
    printf("\t\t5. Mostrar Contenido (CSV)\n\n");
    printf("raid-manager> ");
    scanf("%i",&o);
    return o;
    
}
Ogre::MaterialPtr AssetLoader::createMaterial(Ogre::String name, int index, aiMaterial* mat)
{
	Ogre::MaterialManager* omatMgr = Ogre::MaterialManager::getSingletonPtr();

	std::ostringstream matname;
	matname << name.data() << "_mat";
	matname.widen(4);
	matname.fill('0');
	matname << index;
	Ogre::String matName = matname.str();

	Ogre::ResourceManager::ResourceCreateOrRetrieveResult status = omatMgr->createOrRetrieve(matName, Ogre::ResourceGroupManager::DEFAULT_RESOURCE_GROUP_NAME, true);
	Ogre::MaterialPtr omat = status.first;

	aiColor4D clr(1.0, 1.0, 1.0, 1.0);
	aiGetMaterialColor(mat, AI_MATKEY_COLOR_DIFFUSE, &clr);
	omat->getTechnique(0)->getPass(0)->setDiffuse(clr.r, clr.g, clr.b, clr.a);
	
	aiGetMaterialColor(mat, AI_MATKEY_COLOR_SPECULAR, &clr);
	omat->getTechnique(0)->getPass(0)->setSpecular(clr.r, clr.g, clr.b, clr.a);
	
	aiGetMaterialColor(mat, AI_MATKEY_COLOR_AMBIENT, &clr);
	omat->getTechnique(0)->getPass(0)->setAmbient(clr.r, clr.g, clr.b);
	
	aiGetMaterialColor(mat, AI_MATKEY_COLOR_EMISSIVE, &clr);
	omat->getTechnique(0)->getPass(0)->setSelfIllumination(clr.r, clr.g, clr.b);

	omat->getTechnique(0)->getPass(0)->setShadingMode(Ogre::SO_GOURAUD);
	omat->getTechnique(0)->getPass(0)->setSceneBlending(Ogre::SBT_TRANSPARENT_ALPHA);
	omat->getTechnique(0)->getPass(0)->setLightingEnabled(true);
	omat->getTechnique(0)->getPass(0)->setDepthCheckEnabled(true);
	//omat->getTechnique(0)->getPass(0)->setVertexColourTracking(Ogre::TVC_DIFFUSE);
	
	aiString path;
	aiReturn res = mat->GetTexture(aiTextureType_DIFFUSE, 0, &path);
	if (res == AI_SUCCESS) {
		Ogre::TextureUnitState* stateBase = omat->getTechnique(0)->getPass(0)->createTextureUnitState();
		stateBase->setColourOperation(Ogre::LBO_MODULATE);
		stateBase->setTextureName(path.data);
	}
	
	return omat;
}
Beispiel #24
0
void sfml_drawsurface::draw_text(std::string text, Point& a, int red, int green, int blue, int font_size) {
	this->font_size = font_size;
	
	if (!font_loaded) {
		this->load_font("arial.ttf", this->font_size);
	}

	sf::Color clr(red, green, blue);
	
	sf::Text _text;
	
	_text.setFont(this->font);
	_text.setCharacterSize(font_size);
	_text.setPosition(sf::Vector2f(a.get_x(), a.get_y()));
	_text.setFillColor(clr);
	_text.setString(text);

	this->window.draw(_text);
}
Beispiel #25
0
//************************************
// Method:    getComplexImage
// FullName:  CFFTMachine::getComplexImage
// Access:    protected 
// Returns:   LPCOMPLEX
// Qualifier:
// Parameter: CImgSource * in_pSrcImg
//************************************
procStatus CFFTMachine::getComplexImage( CImgSource* in_pSrc, LPCOMPLEX* out_ppComplex )
{
	procStatus eRetCode = eNormal;

	Bitmap* pBmp = in_pSrc->GetSourceRef();
	ASSERT(pBmp != NULL);
	ASSERT(out_ppComplex);
	

	INT nWidth = pBmp->GetWidth();
	INT nHeight= pBmp->GetHeight();
	
	SourceType eType = in_pSrc->GetType();
	Status sts = Ok;
	BYTE nVal = 0;

	for (INT y=0;y<nHeight;y++)	//for all rows
	{
		for (INT x=0;x<nWidth; x++) //for all col
		{
			nVal = 0;
			Color clr(0,0,0);
			sts = pBmp->GetPixel(x,y, &clr);
			if(sts == Ok)
			{
				nVal = CUtility::GetMonoPixelValue(clr, eType);
				out_ppComplex[y][x].real = nVal; 
			}
			else
			{
				break;
			}
		}
		if(sts != Ok) break;
	}
	
	if (sts != Ok)
	{
		eRetCode = eSystemErr;
	}
	return eRetCode;
}
Beispiel #26
0
void read_responses()
{
	clr(responses);
	gets(s);
	int pos = 0;
	while(s[pos] != '[')
		pos++;
	for(int i = 0; i < max_vals; i++)
	{
		if (s[pos+3] != 'x')
			throw 42;
		pos += 4;
		for(int j = 0; j < 16; j++)
		{
			responses[i] = (responses[i] << 4) + (s[pos] <= '9' ? s[pos] - '0' : s[pos] - 'A' + 10); 
			pos++;
		}
		pos ++;
	}
}
Beispiel #27
0
void		Window::refresh( void ) {
	clr();
	int	i = modules.size();
	int p = 0;
	int posX = 0;

	struct winsize w;
	ioctl(0, TIOCGWINSZ, &w);
	width = w.ws_col;
	height = w.ws_row - 1;

	print(0, 0, "System Monitor", 'R');
	while (p < i) {
		if (posX + modules[p].getWidth() > width)
			return ;
		modules[p].draw(posX, 1, *this);
		posX += modules[p].getWidth();
		++p;
	}
}
void CVerticalLayoutWnd::OnPaint()
{
	//CPaintDC dc(this); // device context for painting
	// TODO: 在此处添加消息处理程序代码
	// 不为绘图消息调用 CBaseContainerWnd::OnPaint()

	GetClientRect(m_rcClient);

	if (m_pRender)
	{
		m_pRender->BeginRender();

		CColorUtil clr(0,0,255);

		m_pRender->DrawRectangle(m_rcClient, clr);
		//m_pRender->DrawText(m_rcClient, _T("垂直容器"), clr);

		m_pRender->EndRender();
	}
}
Beispiel #29
0
//-----------------------------------------------------------------------------
bool mglCanvasGL::Alpha(bool enable)
{
	if(enable)
	{
		set(MGL_ENABLE_ALPHA);
		glDisable(GL_DEPTH_TEST);
		glEnable(GL_ALPHA_TEST);
		glEnable(GL_BLEND);
		if((Flag&3)==1)	glBlendFunc(GL_DST_COLOR, GL_ZERO);
		else if((Flag&3)==2) glBlendFunc(GL_SRC_ALPHA, GL_ONE);
		else glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
	}
	else
	{
		clr(MGL_ENABLE_ALPHA);
		glEnable(GL_DEPTH_TEST);
		glDisable(GL_ALPHA_TEST);
		glDisable(GL_BLEND);
	}
	return mglCanvas::Alpha(enable);
}
Beispiel #30
0
int keypress(struct s3d_evt *event)
{
    struct s3d_key_event *keys = (struct s3d_key_event *)event->buf;
    int key=keys->keysym;
    int mod=keys->modifier;
    switch (key)
    {
    case S3DK_LEFT:
        pos--;
        break;
    case S3DK_RIGHT:
        pos++;
        break;
    case S3DK_UP:
        aim--;
        break;
    case S3DK_DOWN:
        aim++;
        break;
    case S3DK_RETURN:
        savel2();
        break;
    case S3DK_DELETE:
        del();
        break;
    case S3DK_INSERT:
//		    ins();
        break;
    case S3DK_c:
        clr();
        break;
    case S3DK_SPACE:
        spc();
        break;
    case S3DK_F8:
        ll2();
        break;
    }
    disp();
}