• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

excaliburjs / Excalibur / 7295838285

22 Dec 2023 03:21AM UTC coverage: 91.839% (-0.02%) from 91.859%
7295838285

push

github

web-flow
fix: TileMap packing + TileMap debug draw configurable (#2851)

This PR makes TileMap debug draw configurable, and by default reduces the draw burden by toggling off the grid display by default.

This PR also fixes a tilemap packing bug where some situation would result in incorrect colliders


https://github.com/excaliburjs/Excalibur/assets/612071/104bfb9d-c8e3-431e-a454-e8bed89ad960

4625 of 5793 branches covered (0.0%)

51 of 55 new or added lines in 4 files covered. (92.73%)

7 existing lines in 2 files now uncovered.

10702 of 11653 relevant lines covered (91.84%)

27126.35 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/engine/Interfaces/LifecycleEvents.ts
1
import { Engine } from './../Engine';
2
import * as Events from './../Events';
3
import { Scene } from '../Scene';
4
import { ExcaliburGraphicsContext } from '../Graphics';
5

6
// eslint-disable-next-line @typescript-eslint/naming-convention
7
export interface _initialize {
8
  _initialize(engine: Engine): void;
9
}
10

11
/**
12
 * Type guard checking for internal initialize method
13
 * @internal
14
 * @param a
15
 */
16
export function has_initialize(a: any): a is _initialize {
17
  return !!a._initialize;
×
18
}
19

20
export interface OnInitialize {
21
  onInitialize(engine: Engine): void;
22
}
23

24
/**
25
 *
26
 */
27
export function hasOnInitialize(a: any): a is OnInitialize {
28
  return !!a.onInitialize;
×
29
}
30

31
// eslint-disable-next-line @typescript-eslint/naming-convention
32
export interface _preupdate {
33
  _preupdate(engine: Engine, delta: number): void;
34
}
35

36
/**
37
 *
38
 */
39
export function has_preupdate(a: any): a is _preupdate {
40
  return !!a._preupdate;
×
41
}
42

43
export interface OnPreUpdate {
44
  onPreUpdate(engine: Engine, delta: number): void;
45
}
46

47
/**
48
 *
49
 */
50
export function hasOnPreUpdate(a: any): a is OnPreUpdate {
51
  return !!a.onPreUpdate;
×
52
}
53

54
// eslint-disable-next-line @typescript-eslint/naming-convention
55
export interface _postupdate {
56
  _postupdate(engine: Engine, delta: number): void;
57
}
58

59
/**
60
 *
61
 */
62
export function has_postupdate(a: any): a is _postupdate {
63
  return !!a.onPostUpdate;
×
64
}
65

66
export interface OnPostUpdate {
67
  onPostUpdate(engine: Engine, delta: number): void;
68
}
69

70
/**
71
 *
72
 */
73
export function hasOnPostUpdate(a: any): a is OnPostUpdate {
74
  return !!a.onPostUpdate;
×
75
}
76

77
export interface CanInitialize {
78
  /**
79
   * Overridable implementation
80
   */
81
  onInitialize(_engine: Engine): void;
82

83
  /**
84
   * Event signatures
85
   */
86
  on(eventName: Events.initialize, handler: (event: Events.InitializeEvent<any>) => void): void;
87
  once(eventName: Events.initialize, handler: (event: Events.InitializeEvent<any>) => void): void;
88
  off(eventName: Events.initialize, handler?: (event: Events.InitializeEvent<any>) => void): void;
89
}
90

91
export interface SceneActivationContext<TData = undefined> {
92
  data?: TData;
93
  previousScene: Scene;
94
  nextScene: Scene;
95
  engine: Engine;
96
}
97

98
export interface CanActivate<TData = undefined> {
99
  /**
100
   * Overridable implementation
101
   */
102
  onActivate(context: SceneActivationContext<TData>): void;
103

104
  /**
105
   * Event signatures
106
   */
107
  on(eventName: Events.activate, handler: (event: Events.ActivateEvent) => void): void;
108
  once(eventName: Events.activate, handler: (event: Events.ActivateEvent) => void): void;
109
  off(eventName: Events.activate, handler?: (event: Events.ActivateEvent) => void): void;
110
}
111

112
export interface CanDeactivate {
113
  /**
114
   * Overridable implementation
115
   */
116
  onDeactivate(context: SceneActivationContext<never>): void;
117

118
  /**
119
   * Event signature
120
   */
121
  on(eventName: Events.deactivate, handler: (event: Events.DeactivateEvent) => void): void;
122
  once(eventName: Events.deactivate, handler: (event: Events.DeactivateEvent) => void): void;
123
  off(eventName: Events.deactivate, handler?: (event: Events.DeactivateEvent) => void): void;
124
}
125

126
export interface CanUpdate {
127
  /**
128
   * Overridable implementation
129
   */
130
  onPreUpdate(_engine: Engine, _delta: number): void;
131

132
  /**
133
   * Event signature
134
   */
135
  on(eventName: Events.preupdate, handler: (event: Events.PreUpdateEvent<any>) => void): void;
136
  once(eventName: Events.preupdate, handler: (event: Events.PreUpdateEvent<any>) => void): void;
137
  off(eventName: Events.preupdate, handler?: (event: Events.PreUpdateEvent<any>) => void): void;
138

139
  /**
140
   * Overridable implementation
141
   */
142
  onPostUpdate(_engine: Engine, _delta: number): void;
143

144
  /**
145
   * Event signatures
146
   */
147
  on(eventName: Events.postupdate, handler: (event: Events.PostUpdateEvent<any>) => void): void;
148
  once(eventName: Events.postupdate, handler: (event: Events.PostUpdateEvent<any>) => void): void;
149
  off(eventName: Events.postupdate, handler?: (event: Events.PostUpdateEvent<any>) => void): void;
150
}
151

152
export interface OnPreDraw {
153
  /**
154
   * Overridable implementation
155
   */
156
  onPreDraw(_ctx: ExcaliburGraphicsContext, _delta: number): void;
157

158
  /**
159
   * Event signatures
160
   */
161
  on(eventName: Events.predraw, handler: (event: Events.PreDrawEvent) => void): void;
162
  once(eventName: Events.predraw, handler: (event: Events.PreDrawEvent) => void): void;
163
  off(eventName: Events.predraw, handler?: (event: Events.PreDrawEvent) => void): void;
164
}
165

166
export interface OnPostDraw {
167
  /**
168
   * Overridable implementation
169
   */
170
  onPostDraw(_ctx: ExcaliburGraphicsContext, _delta: number): void;
171

172
  /**
173
   * Event signatures
174
   */
175
  on(eventName: Events.postdraw, handler: (event: Events.PostDrawEvent) => void): void;
176
  once(eventName: Events.postdraw, handler: (event: Events.PostDrawEvent) => void): void;
177
  off(eventName: Events.postdraw, handler?: (event: Events.PostDrawEvent) => void): void;
178
}
179

180
export interface CanDraw extends OnPreDraw, OnPostDraw {
181
  on(eventName: Events.predraw, handler: (event: Events.PreDrawEvent) => void): void;
182
  on(eventName: Events.postdraw, handler: (event: Events.PostDrawEvent) => void): void;
183

184
  once(eventName: Events.predraw, handler: (event: Events.PreDrawEvent) => void): void;
185
  once(eventName: Events.postdraw, handler: (event: Events.PostDrawEvent) => void): void;
186

187
  off(eventName: Events.predraw, handler?: (event: Events.PreDrawEvent) => void): void;
188
  off(eventName: Events.postdraw, handler?: (event: Events.PostDrawEvent) => void): void;
189
}
190

191
/**
192
 *
193
 */
194
export function hasPreDraw(a: any): a is OnPreDraw {
195
  return !!a.onPreDraw;
×
196
}
197

198
/**
199
 *
200
 */
201
export function hasPostDraw(a: any): a is OnPostDraw {
202
  return !!a.onPostDraw;
×
203
}
204

205
export interface CanBeKilled {
206
  /**
207
   * Overridable implementation
208
   */
209
  onPreKill(_scene: Scene): void;
210

211
  /**
212
   * Event signatures
213
   */
214
  on(eventName: Events.prekill, handler: (event: Events.PreKillEvent) => void): void;
215
  once(eventName: Events.prekill, handler: (event: Events.PreKillEvent) => void): void;
216
  off(eventName: Events.prekill, handler: (event: Events.PreKillEvent) => void): void;
217

218
  /**
219
   * Overridable implementation
220
   */
221
  onPostKill(_scene: Scene): void;
222

223
  /**
224
   * Event signatures
225
   */
226
  on(eventName: Events.postkill, handler: (event: Events.PostKillEvent) => void): void;
227
  once(eventName: Events.postkill, handler: (event: Events.PostKillEvent) => void): void;
228
  off(eventName: Events.postkill, handler: (event: Events.PostKillEvent) => void): void;
229
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc