static VIDEO_UPDATE( alg ) { /* composite the video */ if (!video_skip_this_frame()) { mame_bitmap *vidbitmap; rectangle fixedvis = Machine->screen[screen].visarea; fixedvis.max_x++; fixedvis.max_y++; /* first lay down the video data */ laserdisc_get_video(discinfo, &vidbitmap); if (video_texture == NULL) video_texture = render_texture_alloc(vidbitmap, NULL, 0, TEXFORMAT_YUY16, NULL, NULL); else render_texture_set_bitmap(video_texture, vidbitmap, NULL, 0, TEXFORMAT_YUY16); /* then overlay the Amiga video */ if (overlay_texture == NULL) overlay_texture = render_texture_alloc(tmpbitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16, NULL, NULL); else render_texture_set_bitmap(overlay_texture, tmpbitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16); /* add both quads to the screen */ render_screen_add_quad(0, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), video_texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); render_screen_add_quad(0, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), overlay_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1)); } /* display disc information */ if (discinfo != NULL) popmessage("%s", laserdisc_describe_state(discinfo)); return 0; }
static void create_bitmap(running_machine &machine, int player) { int x, y; char filename[20]; rgb_t color = crosshair_colors[player]; /* if we have a bitmap and texture for this player, kill it */ if (global.bitmap[player] == NULL) global.bitmap[player] = global_alloc(bitmap_argb32); machine.render().texture_free(global.texture[player]); emu_file crossfile(machine.options().crosshair_path(), OPEN_FLAG_READ); if (global.name[player][0] != 0) { /* look for user specified file */ sprintf(filename, "%s.png", global.name[player]); render_load_png(*global.bitmap[player], crossfile, NULL, filename); } else { /* look for default cross?.png in crsshair\game dir */ sprintf(filename, "cross%d.png", player + 1); render_load_png(*global.bitmap[player], crossfile, machine.system().name, filename); /* look for default cross?.png in crsshair dir */ if (!global.bitmap[player]->valid()) render_load_png(*global.bitmap[player], crossfile, NULL, filename); } /* if that didn't work, use the built-in one */ if (!global.bitmap[player]->valid()) { /* allocate a blank bitmap to start with */ global.bitmap[player]->allocate(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE); global.bitmap[player]->fill(MAKE_ARGB(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ UINT32 *dest0 = &global.bitmap[player]->pix32(y); UINT32 *dest1 = &global.bitmap[player]->pix32(CROSSHAIR_RAW_SIZE - 1 - y); /* extract to two rows simultaneously */ for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color; } } /* create a texture to reference the bitmap */ global.texture[player] = machine.render().texture_alloc(render_texture::hq_scale); global.texture[player]->set_bitmap(*global.bitmap[player], global.bitmap[player]->cliprect(), TEXFORMAT_ARGB32); }
UINT32 laserdisc_device::screen_update(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { // handle the overlay if present screen_bitmap &overbitmap = m_overbitmap[m_overindex]; if (overbitmap.valid() && (!m_overupdate_ind16.isnull() || !m_overupdate_rgb32.isnull())) { // scale the cliprect to the overlay size rectangle clip(m_overclip); clip.min_y = cliprect.min_y * overbitmap.height() / bitmap.height(); if (cliprect.min_y == screen.visible_area().min_y) clip.min_y = MIN(clip.min_y, m_overclip.min_y); clip.max_y = (cliprect.max_y + 1) * overbitmap.height() / bitmap.height() - 1; // call the update callback if (!m_overupdate_ind16.isnull()) m_overupdate_ind16(screen, overbitmap.as_ind16(), clip); else m_overupdate_rgb32(screen, overbitmap.as_rgb32(), clip); } // if this is the last update, do the rendering if (cliprect.max_y == screen.visible_area().max_y) { // update the texture with the overlay contents if (overbitmap.valid()) m_overtex->set_bitmap(overbitmap, m_overclip, overbitmap.texformat()); // get the laserdisc video bitmap_yuy16 &vidbitmap = get_video(); m_videotex->set_bitmap(vidbitmap, vidbitmap.cliprect(), TEXFORMAT_YUY16); // reset the screen contents screen.container().empty(); // add the video texture if (m_videoenable) screen.container().add_quad(0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), m_videotex, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); // add the overlay if (m_overenable && overbitmap.valid()) { float x0 = 0.5f - 0.5f * m_overscalex + m_overposx; float y0 = 0.5f - 0.5f * m_overscaley + m_overposy; float x1 = x0 + m_overscalex; float y1 = y0 + m_overscaley; screen.container().add_quad(x0, y0, x1, y1, MAKE_ARGB(0xff,0xff,0xff,0xff), m_overtex, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1)); } // swap to the next bitmap m_overindex = (m_overindex + 1) % ARRAY_LENGTH(m_overbitmap); } return 0; }
static void create_bitmap(running_machine *machine, int player) { int x, y; char filename[20]; rgb_t color = crosshair_colors[player]; /* if we have a bitmap for this player, kill it */ if (global.bitmap[player] != NULL) bitmap_free(global.bitmap[player]); if (global.name[player][0] != 0) { /* look for user specified file */ sprintf(filename, "%s.png", global.name[player]); global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL); } else { /* look for default cross?.png in crsshair\game dir */ sprintf(filename, "cross%d.png", player + 1); global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, machine->gamedrv->name, filename, NULL, NULL); /* look for default cross?.png in crsshair dir */ if (global.bitmap[player] == NULL) global.bitmap[player] = render_load_png(OPTION_CROSSHAIRPATH, NULL, filename, NULL, NULL); } /* if that didn't work, use the built-in one */ if (global.bitmap[player] == NULL) { /* allocate a blank bitmap to start with */ global.bitmap[player] = bitmap_alloc(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE, BITMAP_FORMAT_ARGB32); bitmap_fill(global.bitmap[player], NULL, MAKE_ARGB(0x00,0xff,0xff,0xff)); /* extract the raw source data to it */ for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ UINT32 *dest0 = BITMAP_ADDR32(global.bitmap[player], y, 0); UINT32 *dest1 = BITMAP_ADDR32(global.bitmap[player], CROSSHAIR_RAW_SIZE - 1 - y, 0); /* extract to two rows simultaneously */ for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color; } } /* create a texture to reference the bitmap */ global.texture[player] = render_texture_alloc(render_texture_hq_scale, NULL); render_texture_set_bitmap(global.texture[player], global.bitmap[player], NULL, TEXFORMAT_ARGB32, NULL); }
void StatePlaying::initiate() { float farClippingPlane = 2000.0f; // Set far clipping plane gRenderer.setNearFarClippingPlanes(1.0f,farClippingPlane); m_objects = new Ned3DObjectManager(); m_objects->setNumberOfDeadFrames(2); m_tetherCamera = new TetherCamera(m_objects); // Create terrain terrain = new Terrain(8,"terrain.xml"); //powers of two for terrain size m_objects->spawnTerrain(terrain); // Load models m_objects->setModelManager(gModelManager); gModelManager.importXml("models.xml"); // Loads game objects like the crows, plane, and silo resetGame(); // set fog gRenderer.setFogEnable(true); gRenderer.setFogDistance(farClippingPlane - 1000.0f,farClippingPlane); gRenderer.setFogColor(MAKE_ARGB(0,60,180,254)); // set lights gRenderer.setAmbientLightColor(MAKE_ARGB(255,100,100,100)); gRenderer.setDirectionalLightColor(0XFFFFFFFF); Vector3 dir = Vector3(5.0f,-5.0f, 6.0f); dir.normalize(); gRenderer.setDirectionalLightVector(dir); // Create water now that we know what camera to use float fov = degToRad(gGame.m_currentCam->fov); water = new Water(fov, farClippingPlane, "water.xml"); m_objects->spawnWater(water); // aquire sounds gSoundManager.setDopplerUnit(1.0f/3.0f); // sound factors // get windmill sound m_windmillSound = gSoundManager.requestSoundHandle("windmill2.wav"); m_windmillSoundInstance = gSoundManager.requestInstance(m_windmillSound); // add console commands gConsole.addFunction("camerafollow","",consoleSetFollowCamera); gConsole.addFunction("cameratarget","s",consoleSetCameraTarget); gConsole.addFunction("godmode","b",consoleGodMode); }
static void crosshair_init(void) { input_port_entry *ipt; int player; /* determine who needs crosshairs */ crosshair_needed = 0x00; for (ipt = Machine->input_ports; ipt->type != IPT_END; ipt++) if (ipt->analog.crossaxis != CROSSHAIR_AXIS_NONE) crosshair_needed |= 1 << ipt->player; /* all visible by default */ crosshair_visible = crosshair_needed; /* loop over each player and load or create a bitmap */ for (player = 0; player < MAX_PLAYERS; player++) if (crosshair_needed & (1 << player)) { char filename[20]; /* first try to load a bitmap for the crosshair */ sprintf(filename, "cross%d.png", player); crosshair_bitmap[player] = render_load_png(NULL, filename, NULL, NULL); /* if that didn't work, make one up */ if (crosshair_bitmap[player] == NULL) { rgb_t color = crosshair_colors[player]; int x, y; /* allocate a blank bitmap to start with */ crosshair_bitmap[player] = bitmap_alloc_format(CROSSHAIR_RAW_SIZE, CROSSHAIR_RAW_SIZE, BITMAP_FORMAT_ARGB32); fillbitmap(crosshair_bitmap[player], MAKE_ARGB(0x00,0xff,0xff,0xff), NULL); /* extract the raw source data to it */ for (y = 0; y < CROSSHAIR_RAW_SIZE / 2; y++) { /* assume it is mirrored vertically */ UINT32 *dest0 = BITMAP_ADDR32(crosshair_bitmap[player], y, 0); UINT32 *dest1 = BITMAP_ADDR32(crosshair_bitmap[player], CROSSHAIR_RAW_SIZE - 1 - y, 0); /* extract to two rows simultaneously */ for (x = 0; x < CROSSHAIR_RAW_SIZE; x++) if ((crosshair_raw_top[y * CROSSHAIR_RAW_ROWBYTES + x / 8] << (x % 8)) & 0x80) dest0[x] = dest1[x] = MAKE_ARGB(0xff,0x00,0x00,0x00) | color; } } /* create a texture to reference the bitmap */ crosshair_texture[player] = render_texture_alloc(crosshair_bitmap[player], NULL, 0, TEXFORMAT_ARGB32, render_texture_hq_scale, NULL); } }
static BackgroundStatus *b2D_GetStatus(Background2DStack *bck, RenderEffect2D *eff) { u32 i; BackgroundStatus *status; Chain *stack; stack = eff->back_stack; if (!stack) return NULL; for (i=0; i<ChainGetCount(bck->surfaces_links); i++) { status = ChainGetEntry(bck->surfaces_links, i); if (status->bind_stack == stack) return status; } status = malloc(sizeof(BackgroundStatus)); memset(status, 0, sizeof(BackgroundStatus)); mx2d_init(status->ctx.transform); status->ctx.surface = eff->surface; status->ctx.aspect.filled = 1; status->ctx.node = bck->node; status->ctx.h_texture = &bck->txh; status->ctx.is_background = 1; status->bind_stack = stack; status->ctx.aspect.fill_color = MAKE_ARGB(0, 0, 0, 0); ChainAddEntry(bck->surfaces_links, status); ChainAddEntry(stack, bck->owner); return status; }
/* VIDEO GOODS */ static SCREEN_UPDATE( lgp ) { lgp_state *state = screen->machine().driver_data<lgp_state>(); int charx, chary; /* make color 0 transparent */ palette_set_color(screen->machine(), 0, MAKE_ARGB(0,0,0,0)); /* clear */ bitmap_fill(bitmap, cliprect, 0); /* Draw tiles */ for (charx = 0; charx < 32; charx++) { for (chary = 0; chary < 32; chary++) { int current_screen_character = (chary*32) + charx; /* Somewhere there's a flag that offsets the tilemap by 0x100*x */ /* Palette is likely set somewhere as well (tile_control_ram?) */ drawgfx_transpen(bitmap, cliprect, screen->machine().gfx[0], state->m_tile_ram[current_screen_character], 0, 0, 0, charx*8, chary*8, 0); } } return 0; }
/// This must be called everyframe so that the texture coordinates can be /// updated. void Water::setupMesh() { /////// Fill the vertex buffer if (!m_vertexBuffer->lock()) return; float locX, locZ; float spacing = dimensions/ (numVertsPerSide - 1); float startX = - dimensions / 2.0f; float startZ = - dimensions / 2.0f; unsigned int color = MAKE_ARGB(alpha * 255, 255,255,255); for (int z = 0; z < numVertsPerSide;z++) for (int x = 0; x< numVertsPerSide; x++) { locX = startX + x * spacing; locZ = startZ + z * spacing; (*m_vertexBuffer)[x + z * numVertsPerSide].p = Vector3(locX, 0.0f, locZ); (*m_vertexBuffer)[x + z * numVertsPerSide].u = m_texturePos.x + x * textureScale; (*m_vertexBuffer)[x + z * numVertsPerSide].v = m_texturePos.y + z * textureScale; (*m_vertexBuffer)[x + z * numVertsPerSide].argb = color; } m_vertexBuffer->unlock(); }
/* VIDEO GOODS */ UINT32 lgp_state::screen_update_lgp(screen_device &screen, bitmap_rgb32 &bitmap, const rectangle &cliprect) { int charx, chary; /* make color 0 transparent */ palette_set_color(machine(), 0, MAKE_ARGB(0,0,0,0)); /* clear */ bitmap.fill(0, cliprect); /* Draw tiles */ for (charx = 0; charx < 32; charx++) { for (chary = 0; chary < 32; chary++) { int current_screen_character = (chary*32) + charx; /* Somewhere there's a flag that offsets the tilemap by 0x100*x */ /* Palette is likely set somewhere as well (tile_control_ram?) */ drawgfx_transpen(bitmap, cliprect, machine().gfx[0], m_tile_ram[current_screen_character], 0, 0, 0, charx*8, chary*8, 0); } } return 0; }
void ui_menu::init(running_machine &machine) { int x; /* initialize the menu stack */ ui_menu::stack_reset(machine); /* create a texture for hilighting items */ hilight_bitmap = auto_bitmap_rgb32_alloc(machine, 256, 1); for (x = 0; x < 256; x++) { int alpha = 0xff; if (x < 25) alpha = 0xff * x / 25; if (x > 256 - 25) alpha = 0xff * (255 - x) / 25; hilight_bitmap->pix32(0, x) = MAKE_ARGB(alpha,0xff,0xff,0xff); } hilight_texture = machine.render().texture_alloc(); hilight_texture->set_bitmap(*hilight_bitmap, hilight_bitmap->cliprect(), TEXFORMAT_ARGB32); /* create a texture for arrow icons */ arrow_texture = machine.render().texture_alloc(render_triangle); /* add an exit callback to free memory */ machine.add_notifier(MACHINE_NOTIFY_EXIT, machine_notify_delegate(FUNC(ui_menu::exit), &machine)); }
void RendererD3D::DrawPoint(Vector position, Vector color, unsigned int alpha, unsigned int size) { // Need to clear out previous textures so they don't get blended to our triangle //HRESULT result = m_pd3dDevice->SetTexture(0, NULL); //result = m_pd3dDevice->SetTexture(1, NULL); DWORD tmpColor = MAKE_ARGB(255,((unsigned int) color.x * 255),((unsigned int) color.y * 255),((unsigned int) color.z * 255)); VertV3FDWORDUV0UV1 point[1] = { { position.x, position.y, position.z,0.0f,0.0f,0.0f, tmpColor, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, }, //{ position.x, position.y, position.z, tmpColor, }, }; m_pd3dDevice->SetFVF( D3DFVF_MYVERTEX ); /*m_pEffect->SetTechnique("PrimitiveShader"); unsigned int numpasses; if(FAILED(m_pEffect->Begin(&numpasses, D3DXFX_DONOTSAVESTATE))){ MessageBox(NULL, "Failed to begin shader draw", "Error", MB_OK); assert("DEAD"); } for(unsigned int i = 0; i<numpasses; ++i){ if(FAILED(m_pEffect->BeginPass(i))){ MessageBox(NULL, "Failed to begin pass", "Error", MB_OK); assert("DEAD"); }*/ m_pd3dDevice->DrawPrimitiveUP(D3DPT_POINTLIST,1, &point, sizeof(VertV3FDWORDUV0UV1)); /*m_pEffect->EndPass(); } m_pEffect->End(); */ }
void ui_menu::render_triangle(bitmap_argb32 &dest, bitmap_argb32 &source, const rectangle &sbounds, void *param) { int halfwidth = dest.width() / 2; int height = dest.height(); int x, y; /* start with all-transparent */ dest.fill(MAKE_ARGB(0x00,0x00,0x00,0x00)); /* render from the tip to the bottom */ for (y = 0; y < height; y++) { int linewidth = (y * (halfwidth - 1) + (height / 2)) * 255 * 2 / height; UINT32 *target = &dest.pix32(y, halfwidth); /* don't antialias if height < 12 */ if (dest.height() < 12) { int pixels = (linewidth + 254) / 255; if (pixels % 2 == 0) pixels++; linewidth = pixels * 255; } /* loop while we still have data to generate */ for (x = 0; linewidth > 0; x++) { int dalpha; /* first column we only consume one pixel */ if (x == 0) { dalpha = MIN(0xff, linewidth); target[x] = MAKE_ARGB(dalpha,0xff,0xff,0xff); } /* remaining columns consume two pixels, one on each side */ else { dalpha = MIN(0x1fe, linewidth); target[x] = target[-x] = MAKE_ARGB(dalpha/2,0xff,0xff,0xff); } /* account for the weight we consumed */ linewidth -= dalpha; } } }
static DRIVER_INIT( astdelux ) { OVERLAY_START( astdelux_overlay ) OVERLAY_RECT( 0.0, 0.0, 1.0, 1.0, MAKE_ARGB(0x04,0x88,0xff,0xff) ) OVERLAY_END artwork_set_overlay(astdelux_overlay); }
INLINE rgb_t adjust_palette_entry(rgb_t entry, float brightness, float contrast, const UINT8 *gamma_map) { int r = rgb_clamp((float)gamma_map[RGB_RED(entry)] * contrast + brightness); int g = rgb_clamp((float)gamma_map[RGB_GREEN(entry)] * contrast + brightness); int b = rgb_clamp((float)gamma_map[RGB_BLUE(entry)] * contrast + brightness); int a = RGB_ALPHA(entry); return MAKE_ARGB(a,r,g,b); }
bool sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, bitmap_argb32 &bitmap, INT32 &width, INT32 &xoffs, INT32 &yoffs) { #if !(SDLMAME_SDL2) TTF_Font *ttffont; SDL_Surface *drawsurf; SDL_Color fcol = { 0xff, 0xff, 0xff }; UINT16 ustr[16]; ttffont = (TTF_Font *)font; memset(ustr,0,sizeof(ustr)); ustr[0] = (UINT16)chnum; drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol); // was nothing returned? if (drawsurf) { // allocate a MAME destination bitmap bitmap.allocate(drawsurf->w, drawsurf->h); // copy the rendered character image into it for (int y = 0; y < bitmap.height(); y++) { UINT32 *dstrow = &bitmap.pix32(y); UINT8 *srcrow = (UINT8 *)drawsurf->pixels; srcrow += (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) { dstrow[x] = srcrow[x] ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff); } } // what are these? xoffs = yoffs = 0; width = drawsurf->w; SDL_FreeSurface(drawsurf); } return bitmap.valid(); #else return false; #endif }
static DRIVER_INIT( redbaron ) { OVERLAY_START( redbaron_overlay ) OVERLAY_RECT( 0.0, 0.0, 1.0, 1.0, MAKE_ARGB(0x04,0x88,0xff,0xff) ) OVERLAY_END artwork_set_overlay(redbaron_overlay); }
INLINE void map_attr_to_fg_bg(unsigned char attr, rgb_t *fg, rgb_t *bg) { *bg = MAKE_ARGB(0xff,0xff,0xff,0xff); *fg = MAKE_ARGB(0xff,0x00,0x00,0x00); if(attr & DCA_ANCILLARY) *bg = MAKE_ARGB(0xff,0xe0,0xe0,0xe0); if(attr & DCA_SELECTED) { *bg = MAKE_ARGB(0xff,0xff,0x80,0x80); } if(attr & DCA_CURRENT) { *bg = MAKE_ARGB(0xff,0xff,0xff,0x00); } if(attr & DCA_CHANGED) { *fg = MAKE_ARGB(0xff,0xff,0x00,0x00); } if(attr & DCA_INVALID) { *fg = MAKE_ARGB(0xff,0x00,0x00,0xff); } if(attr & DCA_DISABLED) { *fg = MAKE_ARGB(RGB_ALPHA(*fg), (RGB_RED(*fg)+RGB_RED(*bg)) >> 1, (RGB_GREEN(*fg)+RGB_GREEN(*bg)) >> 1, (RGB_BLUE(*fg)+RGB_BLUE(*bg)) >> 1); }
VIDEO_START_MEMBER(alg_state,alg) { /* standard video start */ VIDEO_START_CALL_MEMBER(amiga); /* configure pen 4096 as transparent in the renderer and use it for the genlock color */ palette_set_color(machine(), 4096, MAKE_ARGB(0,0,0,0)); amiga_set_genlock_color(machine(), 4096); }
void hp48_state::palette_init() { int i; for ( i = 0; i < 255; i++ ) { float c = i/255.; palette_set_color( machine(), i, MAKE_ARGB( 0, mix2(0,c), mix2(1,c), mix2(2,c) ) ); } }
static void dview_draw_size(DView *dv) { rectangle r; dview_get_rect(dv, RECT_DVIEW_SIZE, &r); dview_draw_outlined_box(dv, RECT_DVIEW_SIZE, 0, 0, rect_get_width(&r),rect_get_height(&r), MAKE_ARGB(0xff, 0xff, 0xff, 0x00)); }
bitmap_t *sdl_osd_interface::font_get_bitmap(osd_font font, unicode_char chnum, INT32 &width, INT32 &xoffs, INT32 &yoffs) { TTF_Font *ttffont; bitmap_t *bitmap = (bitmap_t *)NULL; SDL_Surface *drawsurf; SDL_Color fcol = { 0xff, 0xff, 0xff }; UINT16 ustr[16]; ttffont = (TTF_Font *)font; memset(ustr,0,sizeof(ustr)); ustr[0] = (UINT16)chnum; drawsurf = TTF_RenderUNICODE_Solid(ttffont, ustr, fcol); // was nothing returned? if (drawsurf) { // allocate a MAME destination bitmap bitmap = auto_alloc(machine(), bitmap_t(drawsurf->w, drawsurf->h, BITMAP_FORMAT_ARGB32)); // copy the rendered character image into it for (int y = 0; y < bitmap->height; y++) { UINT32 *dstrow = BITMAP_ADDR32(bitmap, y, 0); UINT8 *srcrow = (UINT8 *)drawsurf->pixels; srcrow += (y * drawsurf->pitch); for (int x = 0; x < drawsurf->w; x++) { dstrow[x] = srcrow[x] ? MAKE_ARGB(0xff,0xff,0xff,0xff) : MAKE_ARGB(0x00,0xff,0xff,0xff); } } // what are these? xoffs = yoffs = 0; width = drawsurf->w; SDL_FreeSurface(drawsurf); } return bitmap; }
static DRIVER_INIT( redbaron ) { OVERLAY_START( redbaron_overlay ) OVERLAY_RECT( 0.0, 0.0, 1.0, 1.0, MAKE_ARGB(0x04,0x88,0xff,0xff) ) OVERLAY_END artwork_set_overlay(redbaron_overlay); state_save_register_global(analog_data); state_save_register_global(rb_input_select); }
static WRITE8_DEVICE_HANDLER( cliff_sound_overlay_w ) { int sound = data & 3; int overlay = (data & 0x10) ? 1 : 0; /* configure pen 0 and 1 as transparent in the renderer and use it as the compositing color */ if (overlay) { palette_set_color(device->machine(), 0, palette_get_color(device->machine(), 0) & MAKE_ARGB(0,255,255,255)); palette_set_color(device->machine(), 1, palette_get_color(device->machine(), 1) & MAKE_ARGB(0,255,255,255)); } else { palette_set_color(device->machine(), 0, palette_get_color(device->machine(), 0) | MAKE_ARGB(255,0,0,0)); palette_set_color(device->machine(), 1, palette_get_color(device->machine(), 1) | MAKE_ARGB(255,0,0,0)); } /* audio */ discrete_sound_w(device, CLIFF_ENABLE_SND_1, sound & 1); discrete_sound_w(device, CLIFF_ENABLE_SND_2, (sound >> 1) & 1); }
static VIDEO_UPDATE( cliff ) { /* update the TMS9928A video */ video_update_tms9928a( machine, screen, bitmap, cliprect ); if (discinfo != NULL) { mame_bitmap *vidbitmap; rectangle fixedvis = *TMS9928A_get_visarea(); fixedvis.max_x++; fixedvis.max_y++; laserdisc_get_video(discinfo, &vidbitmap); /* first lay down the video data */ if (video_texture == NULL) video_texture = render_texture_alloc(NULL, NULL); if (vidbitmap != last_video_bitmap) render_texture_set_bitmap(video_texture, vidbitmap, NULL, 0, TEXFORMAT_YUY16); last_video_bitmap = vidbitmap; /* then overlay the TMS9928A video */ if (overlay_texture == NULL) overlay_texture = render_texture_alloc(NULL, NULL); render_texture_set_bitmap(overlay_texture, bitmap, &fixedvis, 0, TEXFORMAT_PALETTEA16); /* add both quads to the screen */ render_container_empty(render_container_get_screen(screen)); render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), video_texture, PRIMFLAG_BLENDMODE(BLENDMODE_NONE) | PRIMFLAG_SCREENTEX(1)); render_screen_add_quad(screen, 0.0f, 0.0f, 1.0f, 1.0f, MAKE_ARGB(0xff,0xff,0xff,0xff), overlay_texture, PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA) | PRIMFLAG_SCREENTEX(1)); } /* display disc information */ if (discinfo != NULL) popmessage("%s", laserdisc_describe_state(discinfo)); return 0; }
static void dview_draw_hsb(DView *dv) { int vt; int ts; //int sz = SLIDER_SIZE; int sz; rectangle r; adjustment *sb = &dv->hsb; dview_get_rect(dv, RECT_DVIEW_HSB, &r); dview_draw_outlined_box(dv, RECT_DVIEW_HSB, 0, 0, VSB_WIDTH,HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); dview_draw_outlined_box(dv, RECT_DVIEW_HSB, rect_get_width(&r) - VSB_WIDTH, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); ts = (r.max_x - r.min_x + 1) - 2 * VSB_WIDTH; sz = (ts * (sb->page_size)) / (sb->upper - sb->lower); ts = ts - sz; vt = (ts * (sb->value - sb->lower)) / (sb->upper - sb->lower - sb->page_size) + sz / 2 + r.min_x + VSB_WIDTH; dview_draw_outlined_box(dv, RECT_DVIEW_HSB, vt - sz / 2, 0, sz, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); }
static void dview_draw_title(DView *dv) { int i; rgb_t col = MAKE_ARGB(0xff,0x00,0x00,0xff); rectangle r; dview_get_rect(dv, RECT_DVIEW_TITLE, &r); if (dv == focus_view) col = MAKE_ARGB(0xff,0x00,0x7f,0x00); dview_draw_outlined_box(dv, RECT_DVIEW_TITLE, 0, 0, rect_get_width(&dv->bounds), TITLE_HEIGHT, col); if (!dv->title) return; for (i=0; i<strlen(dv->title); i++) { dview_draw_char(dv, RECT_DVIEW_TITLE, i * debug_font_width + BORDER_XTHICKNESS, BORDER_YTHICKNESS, debug_font_height, //r.max_y - 2 * BORDER_YTHICKNESS, MAKE_ARGB(0xff,0xff,0xff,0xff), (UINT16) dv->title[i] ); } }
void crosshair_render(screen_device &screen) { int player; for (player = 0; player < MAX_PLAYERS; player++) /* draw if visible and the right screen */ if (global.visible[player] && ((global.screen[player] == &screen) || (global.screen[player] == CROSSHAIR_SCREEN_ALL))) { /* add a quad assuming a 4:3 screen (this is not perfect) */ screen.container().add_quad(global.x[player] - 0.03f, global.y[player] - 0.04f, global.x[player] + 0.03f, global.y[player] + 0.04f, MAKE_ARGB(0xc0, global.fade, global.fade, global.fade), global.texture[player], PRIMFLAG_BLENDMODE(BLENDMODE_ALPHA)); } }
static WRITE8_HANDLER( astron_COLOR_write ) { UINT8 r, g, b, a; UINT8 highBits, lowBits; const UINT8 palIndex = offset >> 1; /* Combine */ color_RAM[offset] = data; /* Easy access */ highBits = color_RAM[(palIndex<<1)+1] & 0x0f; lowBits = color_RAM[(palIndex<<1)]; /* 4-bit RGB */ r = (lowBits & 0x0f); g = (lowBits & 0xf0) >> 4; b = (highBits & 0x0f); a = (highBits & 0x80) ? 0 : 255; palette_set_color(space->machine, palIndex, MAKE_ARGB(a, r, g, b)); logerror("COLOR write : 0x%04x @ 0x%04x [0x%x]\n", data, offset, cpu_get_pc(space->cpu)); }
static void dview_draw_vsb(DView *dv) { int vt; int ts; //int sz = SLIDER_SIZE; int sz; rectangle r; adjustment *sb = &dv->vsb; dview_get_rect(dv, RECT_DVIEW_VSB, &r); dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, rect_get_height(&r) - HSB_HEIGHT, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, 0, VSB_WIDTH, HSB_HEIGHT, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); ts = (r.max_y - r.min_y + 1) - 2 * HSB_HEIGHT; sz = (ts * (sb->page_size)) / (sb->upper - sb->lower); ts = ts - sz; vt = (ts * (sb->value - sb->lower)) / (sb->upper - sb->lower - sb->page_size) + sz / 2 + HSB_HEIGHT; dview_draw_outlined_box(dv, RECT_DVIEW_VSB, 0, vt - sz / 2, VSB_WIDTH, sz, MAKE_ARGB(0xff, 0xff, 0x00, 0x00)); }