Graphic MapHandler::getNextTile()
{
    //find the appropriate tile graphic and store it
    Graphic temp = Graphic();
    switch(map[xTile][yTile])
    {
        //grass tile
        case '.':
        case 'T':
            if ((rand() % 20) > 0)
            {
                temp = Graphic(0, xTile*TILES_X, yTile*TILES_Y+UI_HEIGHT, 16, 16, 0, 0, 16, 16, SHEET_TILES);
            } else {
                temp = Graphic(0, xTile*TILES_X, yTile*TILES_Y+UI_HEIGHT, 16, 16, 16, 0, 16, 16, SHEET_TILES);
            }
            break;
    }
    
    //increment x/y counters
    xTile++;
    if (xTile >= 30)
    {
        xTile = 0;
        yTile++;
    }
    
    return temp;
}
void PaletteCycleEditor
    ::drawColorPickerGraphic(Graphic& dst) {
  dst = Graphic(colorPicker_.previewWidth(),
                colorPicker_.previewHeight());
  
  colorPicker_.render(dst,
                      Box(0, 0, colorPickerWidth_, colorPickerHeight_),
                      1.00);
}
void TileMapEditor::drawTileMapPreview(Graphic& dst) {
  dst = Graphic(tileMapPreview_.nativeW() * tileMapPreview_.sceneScale(),
                tileMapPreview_.nativeH() * tileMapPreview_.sceneScale());
  
  tileMapPreview_.render(dst,
                         Box(0, 0,
                             tileMapPreview_.nativeW(),
                             tileMapPreview_.nativeH()),
                         1.00);
}
Exemple #4
0
void GraphicsEditor::drawTileGraphic(Graphic& dst) {
  dst = Graphic(editorScene_.nativeTileLayerWidth()
                  * toolManager_.scale(),
                editorScene_.nativeTileLayerHeight()
                  * toolManager_.scale());

  editorScene_.renderTileLayer(dst,
                               Box(0, 0, editorScene_.nativeTileLayerWidth(),
                                         editorScene_.nativeTileLayerHeight()),
                               toolManager_.scale());
}
void PaletteCycleEditor
    ::drawColorPreviewGraphic(Graphic& dst) {
  dst = Graphic(colorPreviewWidth_, colorPreviewHeight_);
  
  int currentNum = colorPicker_.pickedIndex();
  GGColor color = currentCycleState().color(currentNum);
  Color realColor = Color(color.realR(),
                          color.realG(),
                          color.realB(),
                          Color::fullAlphaOpacity);
  colorPreview_.setColor(realColor);
  
  colorPreview_.render(dst,
                       Box(0, 0, colorPreviewWidth_, colorPreviewHeight_),
                       1.00);
}
void IndexedPickerScene::render(Graphic& dst,
                          Box srcbox,
                          double scale) {
  if ((nativeBuffer_.w() != srcbox.w())
      || (nativeBuffer_.h() != srcbox.h())) {
    nativeBuffer_ = Graphic(srcbox.w(), srcbox.h());
  }
                          
  renderNative(nativeBuffer_,
               srcbox);
  
  int scaledW = srcbox.w() * sceneScale_;
  int scaledH = srcbox.h() * sceneScale_;
  
  nativeBuffer_.scale(dst,
                       Box(0, 0,
                           scaledW,
                           scaledH));
      
  if (gridLayerEnabled_) {
    gridLayer_.render(dst,
                      Box(srcbox.x(),
                          srcbox.y(),
                          scaledW,
                          scaledH),
                      sceneScale_);
  }
  
  if ((highlightedSelectableBoxEnabled_)) {
    dst.drawRectBorder(selectableIndexToDrawX(highlightedSelectableIndex_),
                       selectableIndexToDrawY(highlightedSelectableIndex_),
                       selectableWidth_ * sceneScale_,
                       selectableHeight_ * sceneScale_,
                       Color(0xFF, 0x00, 0x00, Color::fullAlphaOpacity),
                       2);
  }
  
  if ((pickedSelectableBoxEnabled_)) {
    dst.drawRectBorder(selectableIndexToDrawX(pickedSelectableIndex_),
                       selectableIndexToDrawY(pickedSelectableIndex_),
                       selectableWidth_ * sceneScale_,
                       selectableHeight_ * sceneScale_,
                       Color(0xFF, 0xFF, 0x00, Color::fullAlphaOpacity),
                       2);
  }
}
void LengthMapLayeredGraphicScene::render(Graphic& dst,
                    Box srcbox,
                    double scale) {
  if ((previewBuffer_.w() != srcbox.w())
      || (previewBuffer_.h() != srcbox.h())) {
    previewBuffer_ = Graphic(srcbox.w(), srcbox.h());
  }
  
  previewBuffer_.clear(Color(0xFF, 0xFF, 0xFF, Color::fullAlphaOpacity));
  
  switch (mapType_) {
  case mapTypeWidth:
    LengthMapDrawer::drawWidthMap(previewBuffer_,
                                  *lengthMap_);
    break;
  case mapTypeHeight:
    LengthMapDrawer::drawHeightMap(previewBuffer_,
                                   *lengthMap_);
    break;
  default:
    break;
  }
  
  int scaledWidth = srcbox.w() * scale;
  int scaledHeight = srcbox.h() * scale;
  
  previewBuffer_.scale(dst,
            Box(0, 0, scaledWidth, scaledHeight),
            Graphic::noTransUpdate);
  
  if (gridLayerEnabled_) {
    gridLayer_.render(dst,
                      srcbox,
                      scale);
  }
}
Exemple #8
0
	Graphic getPreviousGraphic(Graphic& refGraphic)
	{
		return Graphic(Cmiss_rendition_get_previous_graphic(id, refGraphic.getId()));
	}
Exemple #9
0
	Graphic getNextGraphic(Graphic& refGraphic)
	{
		return Graphic(Cmiss_rendition_get_next_graphic(id, refGraphic.getId()));
	}
Exemple #10
0
	Graphic getFirstGraphic()
	{
		return Graphic(Cmiss_rendition_get_first_graphic(id));
	}
Exemple #11
0
	/***************************************************************************//**
	 * Returns the graphic of the specified name from the rendition. Beware that
	 * graphics in the same rendition may have the same name and this function will
	 * only return the first graphic found with the specified name;
	 *
	 * @param rendition  Rendition in which to find the graphic.
	 * @param graphic_name  The name of the graphic to find.
	 * @return  New reference to graphic of specified name, or 0 if not found.
	 */
	Graphic findGraphicByName(const char *graphicName)
	{
		return Graphic(Cmiss_rendition_find_graphic_by_name(id, graphicName));
	}
Exemple #12
0
	Graphic createGraphic(Graphic::GraphicType graphicType)
	{
		return Graphic(Cmiss_rendition_create_graphic(id,
			static_cast<Cmiss_graphic_type>(graphicType)));
	}