Skip to content

Commit 78a9fdf

Browse files
committed
extend user-manual
1 parent 95243fc commit 78a9fdf

10 files changed

Lines changed: 1879 additions & 27 deletions

README.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ image:https://github.com/fifengine/fifengine-docs/actions/workflows/build-docs.y
1515
| C++ API Documentation | HTML | https://fifengine.github.io/fifengine/api/
1616
| Python API Documentation | HTML | https://fifengine.github.io/fifengine/api/python
1717
| Wiki | HTML | https://github.com/fifengine/fifengine/wiki
18-
| Github Pages (fifengine) | HTML | https://fifengine.github.io/fifengine = https://wwww.fifengine.net/
18+
| Github Pages (fifengine) | HTML | https://fifengine.github.io/fifengine = https://fifengine.net/
1919
| Github Pages (fifengine-docs) | HTML | https://fifengine.github.io/fifengine-docs/ = https://docs.fifengine.net/
2020
| Docs Repository | ASCIIDOC | https://github.com/fifengine/fifengine-docs
2121
|====================

user-manual/en/chapter03_core-concepts.adoc

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -166,6 +166,182 @@ dt = time_manager.getTimeDelta() # Time since last frame in seconds
166166

167167
Use `dt` to scale movement and animation speeds for consistent behavior regardless of frame rate.
168168

169+
=== Engine Change Listener
170+
171+
Monitor engine-level changes such as screen mode switches:
172+
173+
[source,python]
174+
----
175+
class MyEngineChangeListener(fife.IEngineChangeListener):
176+
def onScreenModeChanged(self, newmode):
177+
print("Screen mode changed")
178+
179+
listener = MyEngineChangeListener()
180+
engine.addChangeListener(listener)
181+
182+
# Later, remove it
183+
engine.removeChangeListener(listener)
184+
----
185+
186+
=== Changing Screen Mode at Runtime
187+
188+
Change the display mode without re-initializing the engine:
189+
190+
[source,python]
191+
----
192+
# Get available screen modes from device capabilities
193+
device_caps = engine.getDeviceCaps()
194+
modes = device_caps.getNearestScreenMode(width, height, bpp, fullscreen)
195+
196+
# Apply the new mode
197+
engine.changeScreenMode(modes)
198+
----
199+
200+
The `changeScreenMode()` method handles re-creation of internal objects that depend on the display.
201+
202+
=== Device Capabilities
203+
204+
Query supported display configurations:
205+
206+
[source,python]
207+
----
208+
device_caps = engine.getDeviceCaps()
209+
210+
# Get available screen modes
211+
modes = device_caps.getAvailableScreenModes()
212+
213+
# Get available render drivers
214+
drivers = device_caps.getAvailableRenderDrivers()
215+
----
216+
217+
=== Additional Engine Accessors
218+
219+
The Engine provides access to additional subsystems:
220+
221+
[source,python]
222+
----
223+
# Logging subsystem
224+
log_manager = engine.getLogManager()
225+
226+
# Special renderers (owned by engine, do not delete)
227+
off_renderer = engine.getOffRenderer()
228+
target_renderer = engine.getTargetRenderer()
229+
230+
# Cursor control
231+
cursor = engine.getCursor()
232+
----
233+
234+
=== Engine Settings Reference
235+
236+
==== Display Index
237+
238+
For multi-monitor setups, select which display to use:
239+
240+
[source,python]
241+
----
242+
settings.setDisplay(0) # Primary display (default)
243+
settings.setDisplay(1) # Secondary display
244+
----
245+
246+
==== SDL Render Driver
247+
248+
Select a specific SDL render driver:
249+
250+
[source,python]
251+
----
252+
settings.setSDLDriver("software") # Platform-dependent values
253+
----
254+
255+
==== Video Driver
256+
257+
Set the video driver (platform-dependent):
258+
259+
[source,python]
260+
----
261+
settings.setVideoDriver("x11") # Linux X11
262+
----
263+
264+
==== Color Key Transparency
265+
266+
Enable global colorkey-based transparency:
267+
268+
[source,python]
269+
----
270+
settings.setColorKeyEnabled(True)
271+
settings.setColorKey(255, 0, 255) # Magenta as transparent color
272+
----
273+
274+
==== Monochrome Rendering
275+
276+
Render in grayscale (OpenGL only):
277+
278+
[source,python]
279+
----
280+
settings.setGLUseMonochrome(True)
281+
----
282+
283+
==== Alpha Test Value
284+
285+
Set the alpha threshold for depth buffer discarding (OpenGL only):
286+
287+
[source,python]
288+
----
289+
settings.setGLUseDepthBuffer(True)
290+
settings.setGLAlphaTestValue(0.1) # Discard fragments with alpha < 0.1
291+
----
292+
293+
==== SDL Fake Alpha Removal
294+
295+
Remove fake alpha in SDL backend:
296+
297+
[source,python]
298+
----
299+
settings.setSDLRemoveFakeAlpha(True)
300+
----
301+
302+
==== Joystick Support
303+
304+
Enable or disable joystick and gamepad input:
305+
306+
[source,python]
307+
----
308+
settings.setJoystickSupport(True) # Enable gamepad support
309+
----
310+
311+
==== Frame Limit
312+
313+
Limit the frame rate at the settings level. Also documented in xref:chapter06[Rendering].
314+
315+
[source,python]
316+
----
317+
settings.setFrameLimitEnabled(True)
318+
settings.setFrameLimit(60) # 60 FPS max
319+
if settings.isFrameLimitEnabled():
320+
print("Frame limit:", settings.getFrameLimit())
321+
----
322+
323+
==== Mouse Sensitivity
324+
325+
Configure mouse input sensitivity and acceleration via settings
326+
(also configurable at runtime through xref:chapter08[EventManager]):
327+
328+
[source,python]
329+
----
330+
settings.setMouseSensitivity(1.5) # Speed factor (1.0 = default)
331+
settings.setMouseAccelerationEnabled(True) # Enable mouse acceleration
332+
----
333+
334+
==== Native Image Cursor
335+
336+
Use a native OS cursor backed by an image file:
337+
338+
[source,python]
339+
----
340+
settings.setNativeImageCursorEnabled(True)
341+
if settings.isNativeImageCursorEnabled():
342+
print("Using native cursor")
343+
----
344+
169345
=== Log Modules
170346

171347
FIFE uses a hierarchical logging system. Each subsystem is a log module:

user-manual/en/chapter04_coordinate-systems.adoc

Lines changed: 120 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,29 @@ map_coords = location.getMapCoordinates()
115115
print(f"Map: ({map_coords.x}, {map_coords.y}, {map_coords.z})")
116116
----
117117

118+
==== Coordinate Mapping Between Layers
119+
120+
Convert coordinates to a different layer:
121+
122+
[source,python]
123+
----
124+
# Get exact coordinates mapped to a specific layer
125+
other_exact = location.getExactLayerCoordinates(target_layer)
126+
127+
# Get cell coordinates mapped to a specific layer
128+
other_cell = location.getLayerCoordinates(target_layer)
129+
----
130+
131+
==== Cell Offset Distance
132+
133+
Get the offset from the nearest cell center:
134+
135+
[source,python]
136+
----
137+
offset = location.getCellOffsetDistance()
138+
# Returns distance between exact position and cell center
139+
----
140+
118141
==== Checking Location Validity
119142

120143
A location is valid if:
@@ -281,3 +304,100 @@ camera.setZToY(32) # 1 z-unit = 32 y-pixels
281304
----
282305

283306
Understanding these coordinate systems is key to working with FIFE's rendering and input systems effectively.
307+
308+
=== Point Utilities
309+
310+
The `Point` and `Point3D` classes provide vector math utilities.
311+
312+
==== Point2D Operations
313+
314+
[source,python]
315+
----
316+
p = fife.Point(3, 4)
317+
318+
# Vector operations
319+
p2 = p + fife.Point(1, 2) # (4, 6)
320+
p3 = p - fife.Point(1, 1) # (2, 3)
321+
p4 = p * 2 # (6, 8)
322+
p5 = p / 2 # (1, 2)
323+
324+
# Length (magnitude)
325+
length = p.length() # 5.0
326+
327+
# Normalize to unit vector
328+
p.normalize()
329+
330+
# Rotate around origin (degrees)
331+
p.rotate(90)
332+
333+
# Rotate around a specific point
334+
origin = fife.Point(0, 0)
335+
p.rotate(origin, 45)
336+
337+
# Set coordinates
338+
p.set(10, 20)
339+
----
340+
341+
==== Point3D Operations
342+
343+
[source,python]
344+
----
345+
p = fife.Point3D(1, 2, 3)
346+
347+
# Same operations as Point2D, plus z-component
348+
length = p.length()
349+
p.normalize()
350+
p.set(10, 20, 30)
351+
----
352+
353+
==== Type Conversions
354+
355+
Convert between integer and double point types:
356+
357+
[source,python]
358+
----
359+
# Double to int (rounds)
360+
int_point = fife.doublePt2intPt(double_point)
361+
362+
# Int to double
363+
double_point = fife.intPt2doublePt(int_point)
364+
----
365+
366+
==== Typedefs
367+
368+
[horizontal]
369+
*Point*:: `PointType2D<int32_t>` - 2D integer point
370+
*DoublePoint*:: `PointType2D<double>` - 2D double point
371+
*Point3D*:: `PointType3D<int32_t>` - 3D integer point
372+
*DoublePoint3D*:: `PointType3D<double>` - 3D double point
373+
374+
=== Rect Utilities
375+
376+
The `Rect` class provides rectangle operations for screen areas:
377+
378+
[source,python]
379+
----
380+
rect = fife.Rect(x, y, width, height)
381+
382+
# Edge coordinates
383+
right = rect.right() # x + width
384+
bottom = rect.bottom() # y + height
385+
386+
# Point containment
387+
if rect.contains(fife.Point(px, py)):
388+
print("Point is inside rect")
389+
390+
# Rectangle intersection
391+
if rect.intersects(other_rect):
392+
print("Rectangles overlap")
393+
394+
# In-place intersection (modifies rect)
395+
rect.intersectInplace(other_rect)
396+
----
397+
398+
==== Typed Rectangles
399+
400+
[horizontal]
401+
*Rect*:: `RectType<int32_t>` - Integer rectangle
402+
*FloatRect*:: `RectType<float>` - Float rectangle
403+
*DoubleRect*:: `RectType<double>` - Double rectangle

0 commit comments

Comments
 (0)