void GLRender::drawTexture(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, const CString& key, GLCamera* camera) { GLCamera* cam = (camera != NULL) ? camera : this->cameras->gui; cam->update(); GLfloat* projection16fv = cam->projection16fv.v; if (shaderSquareTexture == NULL) return; enableBlend(); glUseProgram(shaderSquareTexture->program); glUniformMatrix4fv(shaderSquareTexture->uLayerProjectionMatrix, 1, GL_FALSE, projection16fv); glBindBuffer(GL_ARRAY_BUFFER, m_squareBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(x1, y1, x2, y2), GL_DYNAMIC_DRAW); glVertexAttribPointer(shaderSquareTexture->aVertexPosition, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(shaderSquareTexture->aVertexPosition); glBindBuffer(GL_ARRAY_BUFFER, m_textureBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(0, 0, 1, 1), GL_DYNAMIC_DRAW); glVertexAttribPointer(shaderSquareTexture->aTextureCoord, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(shaderSquareTexture->aTextureCoord); GLuint index = textures->get((wchar_t*)key)->bind(0, shaderSquareTexture->uTexture); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(shaderSquareTexture->aVertexPosition); glDisableVertexAttribArray(shaderSquareTexture->aTextureCoord); cleanup(index); }
void GLRender::drawRect(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, const GLPaint& paint, GLCamera* camera) { GLCamera* cam = (camera != NULL) ? camera : this->cameras->gui; cam->update(); GLfloat* projection16fv = cam->projection16fv.v; if (((paint.m_color & 0xFF000000) != 0) && (shaderSquareFill != NULL)) { if ((paint.m_color & 0xFF000000) != 0xFF000000) enableBlend(); else disableBlend(); glUseProgram(shaderSquareFill->program); glUniformMatrix4fv(shaderSquareFill->uLayerProjectionMatrix, 1, GL_FALSE, projection16fv); GLfloat* c = makeColor(&paint.m_color, 1); glUniform4fv(shaderSquareFill->uColor, 1, c); glBindBuffer(GL_ARRAY_BUFFER, m_squareBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(x1, y1, x2, y2), GL_DYNAMIC_DRAW); glVertexAttribPointer(shaderSquareFill->aVertexPosition, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(shaderSquareFill->aVertexPosition); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(shaderSquareFill->aVertexPosition); glUseProgram(0); } if (((paint.m_strokeColor & 0xFF000000) != 0) && (shaderSquareStroke != NULL)) { enableBlend(); glUseProgram(shaderSquareStroke->program); glUniformMatrix4fv(shaderSquareStroke->uLayerProjectionMatrix, 1, GL_FALSE, projection16fv); GLfloat half = floorf((GLfloat)(paint.m_strokeWidth) / 2.0f); GLfloat corners[4] = { x1 - half, y1 - half, x2 + half, y2 + half }; glUniform2fv(shaderSquareStroke->uCorners, 2, corners); glUniform1f(shaderSquareStroke->uBorder, paint.m_strokeWidth); GLfloat* c = makeColor(&paint.m_strokeColor, 1); glUniform4fv(shaderSquareStroke->uColor, 1, c); glBindBuffer(GL_ARRAY_BUFFER, m_squareBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(x1-half, y1-half, x2+half, y2+half), GL_DYNAMIC_DRAW); glVertexAttribPointer(shaderSquareStroke->aVertexPosition, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(shaderSquareStroke->aVertexPosition); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(shaderSquareStroke->aVertexPosition); glUseProgram(0); } }
void Surface::box(Uint32 color, SDL_Rect *rect, int thickness){ if (!rect) return; SDL_Rect &r = *rect; int half = thickness/2; SDL_FillRect(surface_, &makeRect(r.x - half, r.y - half, r.w + thickness, thickness), color); //u SDL_FillRect(surface_, &makeRect(r.x - half, r.y + r.h - half, r.w + thickness, thickness), color); //d SDL_FillRect(surface_, &makeRect(r.x - half, r.y - half, thickness, r.h + thickness), color); //l SDL_FillRect(surface_, &makeRect(r.x + r.w - half, r.y - half, thickness, r.h + thickness), color); //r }
node *readNode(int address){ ++reads; FILE *f; node *n; int child,size,leaf,i; float x1,x2,y1,y2; char filename[20]; sprintf(filename,"%s/%d",path,address); errno = 0; f=fopen(filename,"rb"); if(f == NULL){ fprintf(stderr, "Error al leer el archivo %s: %s\n", filename, strerror(errno)); exit(1); } n=new(node); n->address=address; for(i = 0; i < 2*b+1; i++) n->values[i]=NULL; //size,leaf fread(&size,4, 1, f); fread(&leaf,4, 1, f); n->leaf = leaf; n->size = size; //mbr fread(&x1, 4, 1, f); fread(&y1, 4, 1, f); fread(&x2, 4, 1 ,f); fread(&y2, 4, 1, f); n->MBR = makeRect(x1,y1,x2,y2); int a; for(i=0;i<size;i++){ fread(&x1, 4, 1, f); fread(&y1, 4, 1, f); fread(&x2, 4, 1 ,f); fread(&y2, 4, 1, f); fread(&child, 4, 1, f); n->values[i] = new(nodeVal); n->values[i]->r = makeRect(x1,y1,x2,y2); n->values[i]->child = child; } fclose(f); return n; }
GXRect operator-(const GXRect& lhs, const GXPoint& rhs) { return makeRect(lhs.origin.x - rhs.x, lhs.origin.y - rhs.y, lhs.size.width , lhs.size.height); }
GXRect operator+(const GXRect& lhs, const GXPoint& rhs) { return makeRect(lhs.origin.x + rhs.x, lhs.origin.y + rhs.y, lhs.size.width , lhs.size.height );// GXRect { lhs.origin + rhs , lhs.size + rhs }; }
void GLRender::drawEffectMobile(GLfloat x1, GLfloat y1, GLfloat x2, GLfloat y2, const CString& key, GLfloat localTime, GLfloat worldTime) { GLCamera* cam = this->cameras->gui; cam->update(); GLfloat* projection16fv = cam->projection16fv.v; GLShader* shader; try { shader = shaders->get(key); } catch (...) { return; } GLuint program = shader->program; GLuint uLayerProjectionMatrix = (GLuint)glGetUniformLocation(program, "uLayerProjectionMatrix"); GLuint aVertexPosition = (GLuint)glGetAttribLocation(program, "aVertexPosition"); GLuint aTextureCoord = (GLuint)glGetAttribLocation(program, "aTextureCoord"); GLuint uTime = (GLuint)glGetUniformLocation(program, "uTime"); GLuint uTexture0 = (GLuint)glGetUniformLocation(program, "uTexture0"); GLuint uTexture1 = (GLuint)glGetUniformLocation(program, "uTexture1"); static Vector<GLint> effectTexturesVector = Vector<GLint>(2); static GLint* effectTextures = effectTexturesVector.items(); effectTextures[0] = uTexture0; effectTextures[1] = uTexture1; enableBlend(); GLuint index = shader->bind(0, effectTexturesVector); glUniform2f(uTime, localTime - floorf(localTime), worldTime - floorf(worldTime)); glUniformMatrix4fv(uLayerProjectionMatrix, 1, GL_FALSE, projection16fv); glBindBuffer(GL_ARRAY_BUFFER, m_squareBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(x1, y1, x2, y2), GL_DYNAMIC_DRAW); glVertexAttribPointer(aVertexPosition, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(aVertexPosition); glBindBuffer(GL_ARRAY_BUFFER, m_textureBuffer); glBufferData(GL_ARRAY_BUFFER, 8 * sizeof(GLfloat), makeRect(0, 0, 1, 1), GL_DYNAMIC_DRAW); glVertexAttribPointer(aTextureCoord, 2, GL_FLOAT, GL_FALSE, 0, NULL); glEnableVertexAttribArray(aTextureCoord); glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); glDisableVertexAttribArray(aVertexPosition); glDisableVertexAttribArray(aTextureCoord); cleanup(index); }
SkRRect makeRRect() { SkRRect rrect; RandomSetRRect rrectType = makeSetRRectType(); if (fPrintName) { SkDebugf("%.*s%s\n", fPathDepth * 3, fTab, gRandomSetRRectNames[rrectType]); } switch (rrectType) { case kSetEmpty: rrect.setEmpty(); break; case kSetRect: { SkRect rect = makeRect(); rrect.setRect(rect); } break; case kSetOval: { SkRect oval = makeRect(); rrect.setOval(oval); } break; case kSetRectXY: { SkRect rect = makeRect(); SkScalar xRad = makeScalar(); SkScalar yRad = makeScalar(); rrect.setRectXY(rect, xRad, yRad); } break; case kSetNinePatch: { SkRect rect = makeRect(); SkScalar leftRad = makeScalar(); SkScalar topRad = makeScalar(); SkScalar rightRad = makeScalar(); SkScalar bottomRad = makeScalar(); rrect.setNinePatch(rect, leftRad, topRad, rightRad, bottomRad); SkDebugf(""); // keep locals in scope } break; case kSetRectRadii: { SkRect rect = makeRect(); SkVector radii[4]; makeVectorArray(SK_ARRAY_COUNT(radii), radii); rrect.setRectRadii(rect, radii); } break; } return rrect; }
GXRect operator-=(const GXRect& lhs, const GXPoint& rhs) { // return GXRect { lhs.origin - rhs , lhs.size - rhs }; return makeRect(lhs.origin.x - rhs.x, lhs.origin.y - rhs.y, lhs.size.width , lhs.size.height ); }
void refreshMBR(node *n){ int i; freeRect(n->MBR); if(n->size==0){ n->MBR=makeRect(0,0,0,0); return; } n->MBR = dupRect(n->values[0]->r); for(i=1; i < n->size; ++i) increaseMBR(n->MBR, n->values[i]->r); }
void MessageBox::draw() const{ if (visible_) if (message_ != ""){ assert (screenBuf); //message surface Surface text(font_, message_, color_); pixels_t width = text->clip_rect.w + margin_; //background if (background_) { SDL_Rect rect1 = makeRect(x_ - margin_, y_ - margin_); SDL_Rect rect2 = makeRect(0, 0, width, height_); background_.draw(screenBuf, &rect1, &rect2); } //message SDL_Rect rect = makeRect(x_ + margin_, y_ + margin_); text.draw(screenBuf, &rect); } }
void RenderQueue::addText(int16 x, int16 y, byte color, uint fontResIndex, byte *text, int len) { Font font(_vm->_res->load(fontResIndex)->data); RenderQueueItem item; item.type = kText; item.flags = kRefresh; item.rect = makeRect(x, y, font.getTextWidth(text), font.getHeight()); item.priority = 1000; item.text.color = color; item.text.fontResIndex = fontResIndex; item.text.text = text; item.text.len = len; _currQueue->push_back(item); }
void RenderQueue::addMask(SegmapMaskRect &mask) { RenderQueueItem item; item.type = kMask; item.flags = kRefresh; item.rect = makeRect(mask.x - _vm->_cameraX, mask.y - _vm->_cameraY, mask.width, mask.height); item.priority = mask.priority; item.mask = mask; // Only add the mask if a sprite intersects its rect if (rectIntersectsItem(item.rect)) { RenderQueueArray::iterator iter = _currQueue->begin(); while (iter != _currQueue->end() && (*iter).priority <= item.priority) { iter++; } _currQueue->insert(iter, item); } }
void RenderQueue::addSprite(SpriteDrawItem &sprite) { RenderQueueItem item; item.type = kSprite; item.flags = kRefresh; item.rect = makeRect(sprite.x - _vm->_cameraX, sprite.y - _vm->_cameraY, sprite.width, sprite.height); item.priority = sprite.priority; item.sprite = sprite; item.sprite.x -= _vm->_cameraX; item.sprite.y -= _vm->_cameraY; // Add sprite sorted by priority RenderQueueArray::iterator iter = _currQueue->begin(); while (iter != _currQueue->end() && (*iter).priority <= item.priority) { iter++; } _currQueue->insert(iter, item); }
void MapperRoomRender::fillWhite(int x, int y, int dx, int dy) { RECT p; makeRect(x,y,dx,dy,&p); m_hdc.FillRect(&p, m_whiteBkg); }
SDL_Rect Vampire::drawRect() const{ return makeRect(-64, -120, 128, 128); }
SDL_Rect Vampire::collisionRect() const{ return makeRect(-20, -20, 40, 40); }
SkPath makePath() { SkPath path; for (uint32_t cIndex = 0; cIndex < fPathContourCount; ++cIndex) { uint32_t segments = makeSegmentCount(); for (uint32_t sIndex = 0; sIndex < segments; ++sIndex) { RandomAddPath addPathType = makeAddPathType(); ++fAddCount; if (fPrintName) { SkDebugf("%.*s%s\n", fPathDepth * 3, fTab, gRandomAddPathNames[addPathType]); } switch (addPathType) { case kAddArc: { SkRect oval = makeRect(); SkScalar startAngle = makeAngle(); SkScalar sweepAngle = makeAngle(); path.addArc(oval, startAngle, sweepAngle); validate(path); } break; case kAddRoundRect1: { SkRect rect = makeRect(); SkScalar rx = makeScalar(), ry = makeScalar(); SkPath::Direction dir = makeDirection(); path.addRoundRect(rect, rx, ry, dir); validate(path); } break; case kAddRoundRect2: { SkRect rect = makeRect(); SkScalar radii[8]; makeScalarArray(SK_ARRAY_COUNT(radii), radii); SkPath::Direction dir = makeDirection(); path.addRoundRect(rect, radii, dir); validate(path); } break; case kAddRRect: { SkRRect rrect = makeRRect(); SkPath::Direction dir = makeDirection(); path.addRRect(rrect, dir); validate(path); } break; case kAddPoly: { SkTDArray<SkPoint> points; makePointArray(&points); bool close = makeBool(); path.addPoly(&points[0], points.count(), close); validate(path); } break; case kAddPath1: if (fPathDepth < fPathDepthLimit) { ++fPathDepth; SkPath src = makePath(); validate(src); SkScalar dx = makeScalar(); SkScalar dy = makeScalar(); SkPath::AddPathMode mode = makeAddPathMode(); path.addPath(src, dx, dy, mode); --fPathDepth; validate(path); } break; case kAddPath2: if (fPathDepth < fPathDepthLimit) { ++fPathDepth; SkPath src = makePath(); validate(src); SkPath::AddPathMode mode = makeAddPathMode(); path.addPath(src, mode); --fPathDepth; validate(path); } break; case kAddPath3: if (fPathDepth < fPathDepthLimit) { ++fPathDepth; SkPath src = makePath(); validate(src); SkMatrix matrix = makeMatrix(); SkPath::AddPathMode mode = makeAddPathMode(); path.addPath(src, matrix, mode); --fPathDepth; validate(path); } break; case kReverseAddPath: if (fPathDepth < fPathDepthLimit) { ++fPathDepth; SkPath src = makePath(); validate(src); path.reverseAddPath(src); --fPathDepth; validate(path); } break; case kMoveToPath: { SkScalar x = makeScalar(); SkScalar y = makeScalar(); path.moveTo(x, y); validate(path); } break; case kRMoveToPath: { SkScalar x = makeScalar(); SkScalar y = makeScalar(); path.rMoveTo(x, y); validate(path); } break; case kLineToPath: { SkScalar x = makeScalar(); SkScalar y = makeScalar(); path.lineTo(x, y); validate(path); } break; case kRLineToPath: { SkScalar x = makeScalar(); SkScalar y = makeScalar(); path.rLineTo(x, y); validate(path); } break; case kQuadToPath: { SkPoint pt[2]; makePointArray(SK_ARRAY_COUNT(pt), pt); path.quadTo(pt[0], pt[1]); validate(path); } break; case kRQuadToPath: { SkPoint pt[2]; makePointArray(SK_ARRAY_COUNT(pt), pt); path.rQuadTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY); validate(path); } break; case kConicToPath: { SkPoint pt[2]; makePointArray(SK_ARRAY_COUNT(pt), pt); SkScalar weight = makeScalar(); path.conicTo(pt[0], pt[1], weight); validate(path); } break; case kRConicToPath: { SkPoint pt[2]; makePointArray(SK_ARRAY_COUNT(pt), pt); SkScalar weight = makeScalar(); path.rConicTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY, weight); validate(path); } break; case kCubicToPath: { SkPoint pt[3]; makePointArray(SK_ARRAY_COUNT(pt), pt); path.cubicTo(pt[0], pt[1], pt[2]); validate(path); } break; case kRCubicToPath: { SkPoint pt[3]; makePointArray(SK_ARRAY_COUNT(pt), pt); path.rCubicTo(pt[0].fX, pt[0].fY, pt[1].fX, pt[1].fY, pt[2].fX, pt[2].fY); validate(path); } break; case kArcToPath: { SkPoint pt[2]; makePointArray(SK_ARRAY_COUNT(pt), pt); SkScalar radius = makeScalar(); path.arcTo(pt[0], pt[1], radius); validate(path); } break; case kArcTo2Path: { SkRect oval = makeRect(); SkScalar startAngle = makeAngle(); SkScalar sweepAngle = makeAngle(); bool forceMoveTo = makeBool(); path.arcTo(oval, startAngle, sweepAngle, forceMoveTo); validate(path); } break; case kClosePath: path.close(); validate(path); break; } } } return path; }
void Vampire::draw(Point offset, Surface &surface) const{ if (!visible) return; // Draw attack under vampire sprite smallAttack.draw(offset, surface); batAttack.draw(offset, surface); // Vampire sprite const Surface *image = 0; switch (dir){ case DIR_E: switch (state){ case IDLE: image = idleE; break; case MOVING: image = movingE; break; case ATTACKING: image = attackingE; break; case BURNING: image = burningR; break; } break; case DIR_F: switch (state){ case IDLE: image = idleF; break; case MOVING: image = movingF; break; case ATTACKING: image = attackingF; break; case BURNING: image = burningR; break; } break; case DIR_G: switch (state){ case IDLE: image = idleG; break; case MOVING: image = movingG; break; case ATTACKING: image = attackingG; break; case BURNING: image = burningL; break; } break; case DIR_H: switch (state){ case IDLE: image = idleH; break; case MOVING: image = movingH; break; case ATTACKING: image = attackingH; break; case BURNING: image = burningL; break; } break; default: // Should not happen assert(false); break; } assert(image); size_t col = 0, row = 0; switch (state){ case IDLE: row = frame / idleColumns; col = frame % idleColumns; break; case MOVING: row = frame / movingColumns; col = frame % movingColumns; break; case ATTACKING: row = frame / attackingColumns; col = frame % attackingColumns; break; case BURNING: row = frame / burningColumns; col = frame % burningColumns; debug("Burning; frame=", frame); break; default: // Should not happen assert(false); break; } SDL_Rect srcRect; srcRect.w = srcRect.h = 128; image->draw(screenBuf, &getDrawRect(offset), &makeRect(col * 128, row * 128, 128, 128)); // Entity debug Entity::draw(offset, surface); }
/** Retrieves the actual dimensions of text. @param text text. @return dimensions. */ Rect<int> getDimensions(const char *text) const { int x, y, w, h; al_get_text_dimensions(get(), text, &x, &y, &w, &h); return makeRect(makePoint(x, y), makeSize(w, h)); }
/** Retrieves the actual dimensions of text. @param text text. @return dimensions. */ Rect<int> getDimensions(const String &text) const { int x, y, w, h; al_get_ustr_dimensions(get(), text.get(), &x, &y, &w, &h); return makeRect(makePoint(x, y), makeSize(w, h)); }
//! constructor CGUIPlot::CGUIPlot( scene::ISceneManager* smgr, IGUIEnvironment* env, IGUIElement* parent, s32 id, const core::rect<s32>& rectangle) : IGUIElement( EGUIET_ELEMENT, env, parent, id, rectangle) //, Viewport(0,0,0,0) , ZoomRect(-1,-4,10,5) , Plotrect(0,0,0,0) , IsDrawBackground(false) , BackgroundColor(video::SColor(255,255,255,255)) , TextColor(video::SColor(255,0,0,0)) , IsDrawGrid(true) , GridColor(video::SColor(255,200,200,200)) , SubGridColor(video::SColor(255,235,235,235)) , SceneManager(smgr) , Root(0) , Camera(0) { #ifdef _DEBUG setDebugName("CGUIPlot"); #endif // this element can be tabbed to setTabStop(false); setTabOrder(-1); IGUISkin *skin = 0; if (Environment) skin = Environment->getSkin(); //FrameRect.UpperLeftCorner.X += skin->getSize(EGDS_TEXT_DISTANCE_X)+1; //FrameRect.UpperLeftCorner.Y += skin->getSize(EGDS_TEXT_DISTANCE_Y)+1; //FrameRect.LowerRightCorner.X -= skin->getSize(EGDS_TEXT_DISTANCE_X)+1; //FrameRect.LowerRightCorner.Y -= skin->getSize(EGDS_TEXT_DISTANCE_Y)+1; // TextColor=skin->getColor(EGDC_HIGH_LIGHT_TEXT); s32 w = rectangle.getWidth(); // in pixels s32 h = rectangle.getHeight(); // in pixels s32 sb_size = 16; // in pixels core::recti r_canvas = makeRect(0,0, (u32)(w-sb_size-1), (u32)(h-sb_size-1) ); core::recti r_scrollH = makeRect(1,h-sb_size, (u32)(w-sb_size-1), (u32)sb_size ); core::recti r_scrollV = makeRect( w-sb_size, 1, (u32)sb_size, (u32)(h-sb_size-1) ); core::recti r_reset = makeRect( w-sb_size, h-sb_size, (u32)sb_size, (u32)sb_size ); Plotrect = r_canvas; //! visible ContentRect, Viewport is projected to this rect ScrollbarH = Environment->addScrollBar(true,r_scrollH,this,-1); ScrollbarH->setVisible(true); ScrollbarH->setSubElement(false); ScrollbarH->setTabStop(false); ScrollbarH->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); ScrollbarH->setSmallStep(3); ScrollbarH->setMin(0); ScrollbarH->setMax(100); ScrollbarH->setPos(0); ScrollbarV = Environment->addScrollBar(false,r_scrollV,this,-1); ScrollbarV->setVisible(true); ScrollbarV->setSubElement(false); ScrollbarV->setTabStop(false); ScrollbarV->setAlignment(EGUIA_LOWERRIGHT, EGUIA_LOWERRIGHT, EGUIA_UPPERLEFT, EGUIA_LOWERRIGHT); ScrollbarV->setMin(0); ScrollbarV->setMax(100); ScrollbarV->setSmallStep(3); ScrollbarV->setPos(0); Environment->addButton( r_reset, this, -1, L"R", L"Reset Zoom Button"); BackgroundColor=skin->getColor(EGDC_WINDOW); ContentPane = 0; Environment->setFocus(this); // // SceneManager = new scene::CSceneManager( // Environment->getVideoDriver(), Environment->getFileSystem(), 0, 0, Environment); _IRR_DEBUG_BREAK_IF( !SceneManager ) // if (!SceneManager) // { // printf("CGUIPlot::Could not create SceneManager\n"); // return; // } Root = SceneManager->addEmptySceneNode( SceneManager->getRootSceneNode(), -1); _IRR_DEBUG_BREAK_IF( !Root ) Camera = SceneManager->addCameraSceneNode( Root, core::vector3df(0,0,-100), core::vector3df(0,0,100), -1, false); _IRR_DEBUG_BREAK_IF( !Camera ) Root->setVisible( false ); /// Prepare some SceneNodes for x,y Axis and Grid //scene::ISceneManager* SceneManager = SceneManager; gui::IGUIFont* font = Environment->getBuiltInFont(); scene::ITextSceneNode* textNode00 = SceneManager->addTextSceneNode( font, L"(0,0)", TextColor, SceneManager->getRootSceneNode(), core::vector3df(0,0,0) ); scene::ITextSceneNode* textNodeX = SceneManager->addTextSceneNode( font, L"X", TextColor, SceneManager->getRootSceneNode(), core::vector3df(ZoomRect.LowerRightCorner.X,0,0) ); scene::ITextSceneNode* textNodeY = SceneManager->addTextSceneNode( font, L"Y", TextColor, SceneManager->getRootSceneNode(), core::vector3df(0, ZoomRect.UpperLeftCorner.Y,0) ); addShape( textNode00, L"Ursprung" ); addShape( textNodeX, L"X-Axis" ); addShape( textNodeY, L"Y-Axis" ); }
void MapperRoomRender::fillExit(int x, int y, int dx, int dy) { RECT p; makeRect(x,y,dx,dy,&p); m_hdc.FillRect(&p, m_exitBkg); }
sm501alpha_t::sm501alpha_t( mode_t mode, unsigned x, unsigned y, unsigned w, unsigned h ) : mode_( mode ) , fd_( open( "/dev/" SM501ALPHA_CLASS, O_RDWR ) ) , pos_( makeRect(0,0,0,0) ) , ram_( 0 ) , ramOffs_( 0 ) { if( isOpen() ){ fcntl( fd_, F_SETFD, FD_CLOEXEC); fbDevice_t &fb = getFB(); if( 0 == w ){ w = fb.getWidth(); if( 0 != x ) w -= x ; } if( 0 == h ){ h = fb.getHeight(); if( 0 != y ) h -= y ; } struct sm501_alphaPlane_t plane ; plane.xLeft_ = pos_.xLeft_ = x ; plane.yTop_ = pos_.yTop_ = y ; plane.width_ = pos_.width_ = w ; plane.height_ = pos_.height_ = h ; plane.mode_ = mode ; plane.planeOffset_ = 0 ; unsigned short const adder = (2<<11)|(4<<5)|2 ; unsigned short *outWords = (unsigned short *)plane.palette_ ; unsigned short palVal = 0 ; // printf( "color palette:\n" ); for( unsigned i = 0 ; i < 16 ; i++ ){ // printf( " %04x\n", palVal ); *outWords++ = palVal ; palVal += adder ; } outWords[-1] = 0xFFFF ; // make it truly white int rval = ioctl( fd_, SM501ALPHA_SETPLANE, &plane ); if( 0 == rval ){ unsigned bytes = plane.width_*plane.height_*2 ; printf( "mapping %u bytes of RAM\n", bytes ); ram_ = (unsigned char *)mmap( 0, bytes, PROT_READ|PROT_WRITE, MAP_SHARED, fd_, 0 ); if( MAP_FAILED == ram_ ){ perror( "mmap sm501alpha" ); ram_ = 0 ; } ramOffs_ = plane.planeOffset_ ; return ; } else perror( "SM501ALPHA_SETPLANE" ); close( fd_ ); fd_ = 0 ; } }
void MapperRoomRender::fillBlack(int x, int y, int dx, int dy) { RECT p; makeRect(x,y,dx,dy,&p); m_hdc.FillRect(&p, m_blackBkg); }
void MapperRoomRender::fillColor(int x, int y, int dx, int dy, COLORREF color) { RECT p; makeRect(x, y, dx, dy, &p); m_hdc.FillSolidRect(&p, color); }