Changeset 53 in tmcsimulator-scriptbuilder for trunk/src/scriptbuilder/gui/drawers
- Timestamp:
- 08/09/2017 10:03:37 AM (9 years ago)
- Location:
- trunk/src/scriptbuilder/gui/drawers
- Files:
-
- 2 edited
-
IncidentTimelineDrawer.java (modified) (1 diff)
-
TimeSliceDrawer.java (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/scriptbuilder/gui/drawers/IncidentTimelineDrawer.java
r1 r53 41 41 } 42 42 } 43 44 /** 45 * Draw the incident line. Then, utilize TimeSliceDrawer to draw the 46 * timeslices. 47 * 48 * @param g2d the graphics component 49 * @param incident the incident to be drawn 50 */ 51 public static void DrawScriptBuilderTimeline(Graphics2D g2d, 52 ScriptIncident incident) 53 { 54 // Draw the timeline 55 g2d.setColor(incident.color); 56 g2d.fillRect(incident.offset / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 57 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK, 58 ScriptBuilderGuiConstants.TIMELINE_TOP_MARGIN, 59 incident.length / ScriptBuilderGuiConstants.HORIZONTAL_TICK_RESOLUTION 60 * ScriptBuilderGuiConstants.PIXEL_WIDTH_PER_HORIZONTAL_TICK, 61 ScriptBuilderGuiConstants.TIMELINE_HEIGHT); 62 63 // Draw each time slice 64 for (TimeSlice slice : incident.getSlices()) 65 { 66 TimeSliceDrawer.DrawScriptBuilderTimeSlice(g2d, slice); 67 } 68 } 43 69 } -
trunk/src/scriptbuilder/gui/drawers/TimeSliceDrawer.java
r7 r53 96 96 } 97 97 } 98 99 /** 100 * Draw the events in this timeslice. If any exist, draw the slice event 101 * image. If the incident isn't collapsed, draw the event icons as well. 102 * 103 * @param g2d the graphics component 104 * @param slice the timeSlice to draw 105 * @param collapsed if true, don't draw the event icons 106 */ 107 public static void DrawScriptBuilderTimeSlice(Graphics2D g2d, TimeSlice slice) 108 { 109 // If this is an empty slice, return 110 if (slice.events.size() == 0) 111 { 112 return; 113 } 114 115 // Draw the slice event icon to show that there are events here 116 g2d.drawImage(getSliceEventImage(), slice.getX() 117 - ScriptBuilderGuiConstants.EVENT_ICON_WIDTH, 118 ScriptBuilderGuiConstants.TIMELINE_EVENT_ICON_MARGIN, null); 119 } 98 120 }
Note: See TracChangeset
for help on using the changeset viewer.
