类 ConsoleRenderer
java.lang.Object
com.example.graphics.render.ConsoleRenderer
- 所有已实现的接口:
Renderer
Console text-based implementation of the Renderer interface.
Part of the Bridge pattern.
-
字段概要
字段 -
构造器概要
构造器构造器说明ConsoleRenderer
(int width, int height) Constructor initializes the console renderer with specified dimensions -
方法概要
修饰符和类型方法说明void
clear()
Clear the rendering surfacevoid
display()
Display the rendered contentprivate void
drawLine
(int x1, int y1, int x2, int y2) Draw a line between two pointsprivate void
drawPixel
(int x, int y) Draw a pixel at the specified coordinatesvoid
renderCircle
(Circle circle) Render a circlevoid
renderLine
(Line line) Render a linevoid
renderRectangle
(Rectangle rectangle) Render a rectanglevoid
renderTriangle
(Triangle triangle) Render a triangle
-
字段详细资料
-
width
private final int width -
height
private final int height -
canvas
private char[][] canvas
-
-
构造器详细资料
-
ConsoleRenderer
public ConsoleRenderer(int width, int height) Constructor initializes the console renderer with specified dimensions- 参数:
width
- the width of the canvasheight
- the height of the canvas
-
-
方法详细资料
-
renderCircle
从接口复制的说明:Renderer
Render a circle- 指定者:
renderCircle
在接口中Renderer
- 参数:
circle
- the circle to render
-
renderRectangle
从接口复制的说明:Renderer
Render a rectangle- 指定者:
renderRectangle
在接口中Renderer
- 参数:
rectangle
- the rectangle to render
-
renderLine
从接口复制的说明:Renderer
Render a line- 指定者:
renderLine
在接口中Renderer
- 参数:
line
- the line to render
-
renderTriangle
从接口复制的说明:Renderer
Render a triangle- 指定者:
renderTriangle
在接口中Renderer
- 参数:
triangle
- the triangle to render
-
clear
public void clear()从接口复制的说明:Renderer
Clear the rendering surface -
display
public void display()从接口复制的说明:Renderer
Display the rendered content -
drawPixel
private void drawPixel(int x, int y) Draw a pixel at the specified coordinates- 参数:
x
- the x coordinatey
- the y coordinate
-
drawLine
private void drawLine(int x1, int y1, int x2, int y2) Draw a line between two points- 参数:
x1
- the x coordinate of the first pointy1
- the y coordinate of the first pointx2
- the x coordinate of the second pointy2
- the y coordinate of the second point
-