⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 draw.inc

📁 著名的游戏开发库Allegro4.2.0 for DELPHI
💻 INC
📖 第 1 页 / 共 2 页
字号:
{*         ______   ___    ___
 *        /\  _  \ /\_ \  /\_ \
 *        \ \ \L\ \\//\ \ \//\ \      __     __   _ __   ___
 *         \ \  __ \ \ \ \  \ \ \   /'__`\ /'_ `\/\`'__\/ __`\
 *          \ \ \/\ \ \_\ \_ \_\ \_/\  __//\ \L\ \ \ \//\ \L\ \
 *           \ \_\ \_\/\____\/\____\ \____\ \____ \ \_\\ \____/
 *            \/_/\/_/\/____/\/____/\/____/\/___L\ \/_/ \/___/
 *                                           /\____/
 *                                           \_/__/
 *
 *      Draw inline functions (generic C).
 *
 *      By Shawn Hargreaves.
 *
 *      See readme.txt for copyright information.
 *}

{$IFDEF ALLEGRO_INTERFACE}
function getpixel(bmp: P_BITMAP; x, y: sint32): sint32;
procedure putpixel(bmp: P_BITMAP; x, y, color: sint32);
procedure vline(bmp: P_BITMAP; x, y1, y2, color: sint32);
procedure hline(bmp: P_BITMAP; x1, y, x2, color: sint32);
{* The curses API also contains functions called vline and hline so we have
 * called our functions _allegro_vline and _allegro_hline.  User programs
 * should use the vline/hline aliases as they are the official names.
 *}
procedure line(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
procedure fastline(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
procedure rectfill(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
procedure triangle(bmp: P_BITMAP; x1, y1, x2, y2, x3, y3, color: sint32);
procedure polygon(bmp: P_BITMAP; vertices: sint32; const points: p_sint32s; color: sint32);
procedure rect(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
procedure circle(bmp: P_BITMAP; x, y, radius, color: sint32);
procedure circlefill(bmp: P_BITMAP; x, y, radius, color: sint32);
procedure ellipse(bmp: P_BITMAP; x, y, rx, ry, color: sint32);
procedure ellipsefill(bmp: P_BITMAP; x, y, rx, ry, color: sint32);
procedure arc(bmp: P_BITMAP; x, y: sint32; ang1, ang2: fixed; r, color: sint32);
procedure spline(bmp: P_BITMAP; const points: spline_points; color: sint32);
procedure floodfill(bmp: P_BITMAP; x, y, color: sint32);
procedure polygon3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS);
procedure polygon3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS_f);
procedure triangle3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D);
procedure triangle3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D_f);
procedure quad3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3, v4: P_V3D);
procedure quad3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3, v4: P_V3D_f);
procedure draw_sprite(bmp, sprite: P_BITMAP; x, y: sint32);
procedure draw_sprite_v_flip(bmp, sprite: P_BITMAP; x, y: sint32);
procedure draw_sprite_h_flip(bmp, sprite: P_BITMAP; x, y: sint32);
procedure draw_sprite_vh_flip(bmp, sprite: P_BITMAP; x, y: sint32);
procedure draw_trans_sprite(bmp, sprite: P_BITMAP; x, y: sint32);
procedure draw_lit_sprite(bmp, sprite: P_BITMAP; x, y, color: sint32);
procedure draw_gouraud_sprite(bmp, sprite: P_BITMAP; x, y, c1, c2, c3, c4: sint32);
procedure draw_character_ex(bmp, sprite: P_BITMAP; x, y, color, bg: sint32);
procedure rotate_sprite(bmp, sprite: P_BITMAP; x, y: sint32; angle: fixed);
procedure rotate_sprite_v_flip(bmp, sprite: P_BITMAP; x, y: sint32; angle: fixed);
procedure rotate_scaled_sprite(bmp, sprite: P_BITMAP; x, y: sint32; angle, scale: fixed);
procedure rotate_scaled_sprite_v_flip(bmp, sprite: P_BITMAP; x, y: sint32; angle, scale: fixed);
procedure pivot_sprite(bmp, sprite: P_BITMAP; x, y, cx, cy: sint32; angle: fixed);
procedure pivot_sprite_v_flip(bmp, sprite: P_BITMAP; x, y, cx, cy: sint32; angle: fixed);
procedure pivot_scaled_sprite(bmp, sprite: P_BITMAP; x, y, cx, cy: sint32; angle, scale: fixed);
procedure pivot_scaled_sprite_v_flip(bmp, sprite: P_BITMAP; x, y, cx, cy: sint32; angle, scale: fixed);
procedure _putpixel(bmp: P_BITMAP; x, y, color: sint32);
function _getpixel(bmp: P_BITMAP; x, y: sint32): sint32;
procedure _putpixel15(bmp: P_BITMAP; x, y, color: sint32);
function _getpixel15(bmp: P_BITMAP; x, y: sint32): sint32;
procedure _putpixel16(bmp: P_BITMAP; x, y, color: sint32);
function _getpixel16(bmp: P_BITMAP; x, y: sint32): sint32;
procedure _putpixel24(bmp: P_BITMAP; x, y, color: sint32);
function _getpixel24(bmp: P_BITMAP; x, y: sint32): sint32;
procedure _putpixel32(bmp: P_BITMAP; x, y, color: sint32);
function _getpixel32(bmp: P_BITMAP; x, y: sint32): sint32;
{$ENDIF ALLEGRO_INTERFACE}
{$IFDEF ALLEGRO_IMPLEMENTATION}
function getpixel(bmp: P_BITMAP; x, y: sint32): sint32;
begin
  assert(bmp <> nil);
  Result := bmp^.vtable^.getpixel(bmp, x, y);
end;

procedure putpixel(bmp: P_BITMAP; x, y, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.putpixel(bmp, x, y, color);
end;


procedure vline(bmp: P_BITMAP; x, y1, y2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.vline(bmp, x, y1, y2, color);
end;

procedure hline(bmp: P_BITMAP; x1, y, x2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.hline(bmp, x1, y, x2, color);
end;

procedure line(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.line(bmp, x1, y1, x2, y2, color);
end;


procedure fastline(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.fastline(bmp, x1, y1, x2, y2, color);
end;

procedure rectfill(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.rectfill(bmp, x1, y1, x2, y2, color);
end;                 

procedure triangle(bmp: P_BITMAP; x1, y1, x2, y2, x3, y3, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.triangle(bmp, x1, y1, x2, y2, x3, y3, color);
end;

procedure polygon(bmp: P_BITMAP; vertices: sint32; const points: p_sint32s; color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.polygon(bmp, vertices, points, color);
end;

procedure rect(bmp: P_BITMAP; x1, y1, x2, y2, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.rect(bmp, x1, y1, x2, y2, color);
end;

procedure circle(bmp: P_BITMAP; x, y, radius, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.circle(bmp, x, y, radius, color);
end;

procedure circlefill(bmp: P_BITMAP; x, y, radius, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.circlefill(bmp, x, y, radius, color);
end;

procedure ellipse(bmp: P_BITMAP; x, y, rx, ry, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.ellipse(bmp, x, y, rx, ry, color);
end;

procedure ellipsefill(bmp: P_BITMAP; x, y, rx, ry, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.ellipsefill(bmp, x, y, rx, ry, color);
end;

procedure arc(bmp: P_BITMAP; x, y: sint32; ang1, ang2: fixed; r, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.arc(bmp, x, y, ang1, ang2, r, color);
end;

procedure spline(bmp: P_BITMAP; const points: spline_points; color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.spline(bmp, points, color);
end;

procedure floodfill(bmp: P_BITMAP; x, y, color: sint32);
begin
  assert(bmp <> nil);
  bmp^.vtable^.floodfill(bmp, x, y, color);
end;

procedure polygon3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS);
begin
  assert(bmp <> nil);
  bmp^.vtable^.polygon3d(bmp, types, texture, vc, vtx);
end;

procedure polygon3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; vc: sint32; vtx: P_V3DS_f);
begin
  assert(bmp <> nil);
  bmp^.vtable^.polygon3d_f(bmp, types, texture, vc, vtx);
end;

procedure triangle3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D);
begin
  assert(bmp <> nil);
  bmp^.vtable^.triangle3d(bmp, types, texture, v1, v2, v3);
end;

procedure triangle3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3: P_V3D_f);
begin
  assert(bmp <> nil);
  bmp^.vtable^.triangle3d_f(bmp, types, texture, v1, v2, v3);
end;

procedure quad3d(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3, v4: P_V3D);
begin
  assert(bmp <> nil);
  bmp^.vtable^.quad3d(bmp, types, texture, v1, v2, v3, v4);
end;

procedure quad3d_f(bmp: P_BITMAP; types: sint32; texture: P_BITMAP; v1, v2, v3, v4: P_V3D_f);
begin
  assert(bmp <> nil);
  bmp^.vtable^.quad3d_f(bmp, types, texture, v1, v2, v3, v4);
end;

procedure draw_sprite(bmp, sprite: P_BITMAP; x, y: sint32);
begin
  assert(bmp <> nil);
  assert(sprite <> nil);

  if (sprite^.vtable^.color_depth = 8) then
  begin
    bmp^.vtable^.draw_256_sprite(bmp, sprite, x, y)
  end else
  begin
    assert(bmp^.vtable^.color_depth = sprite^.vtable^.color_depth);
    bmp^.vtable^.draw_sprite(bmp, sprite, x, y);
  end;
end;

procedure draw_sprite_v_flip(bmp, sprite: P_BITMAP; x, y: sint32);
begin
  assert(bmp <> nil);
  assert(sprite <> nil);
  assert(bmp^.vtable^.color_depth = sprite^.vtable^.color_depth);

  bmp^.vtable^.draw_sprite_v_flip(bmp, sprite, x, y);
end;

procedure draw_sprite_h_flip(bmp, sprite: P_BITMAP; x, y: sint32);

⌨️ 快捷键说明

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