1 /** 2 Camera node for 2D scenes. 3 4 Copyright: 5 Copyright (c) 2007-2018 Juan Linietsky, Ariel Manzur. 6 Copyright (c) 2014-2018 Godot Engine contributors (cf. AUTHORS.md) 7 Copyright (c) 2017-2018 Godot-D contributors 8 9 License: $(LINK2 https://opensource.org/licenses/MIT, MIT License) 10 11 12 */ 13 module godot.camera2d; 14 import std.meta : AliasSeq, staticIndexOf; 15 import std.traits : Unqual; 16 import godot.d.traits; 17 import godot.core; 18 import godot.c; 19 import godot.d.bind; 20 import godot.d.reference; 21 import godot.globalenums; 22 import godot.object; 23 import godot.classdb; 24 import godot.node2d; 25 import godot.node; 26 /** 27 Camera node for 2D scenes. 28 29 It forces the screen (current layer) to scroll following this node. This makes it easier (and faster) to program scrollable scenes than manually changing the position of $(D CanvasItem)-based nodes. 30 This node is intended to be a simple helper to get things going quickly, but more functionality may be desired to change how the camera works. To make your own custom camera node, inherit it from $(D Node2D) and change the transform of the canvas by setting $(D Viewport.canvasTransform) in $(D Viewport) (you can obtain the current $(D Viewport) by using $(D Node.getViewport)). 31 Note that the $(D Camera2D) node's `position` doesn't represent the actual position of the screen, which may differ due to applied smoothing or limits. You can use $(D getCameraScreenCenter) to get the real position. 32 */ 33 @GodotBaseClass struct Camera2D 34 { 35 package(godot) enum string _GODOT_internal_name = "Camera2D"; 36 public: 37 @nogc nothrow: 38 union { /** */ godot_object _godot_object; /** */ Node2D _GODOT_base; } 39 alias _GODOT_base this; 40 alias BaseClasses = AliasSeq!(typeof(_GODOT_base), typeof(_GODOT_base).BaseClasses); 41 package(godot) __gshared bool _classBindingInitialized = false; 42 package(godot) static struct GDNativeClassBinding 43 { 44 __gshared: 45 @GodotName("_make_current") GodotMethod!(void, GodotObject) _makeCurrent; 46 @GodotName("_set_current") GodotMethod!(void, bool) _setCurrent; 47 @GodotName("_update_scroll") GodotMethod!(void) _updateScroll; 48 @GodotName("align") GodotMethod!(void) _align; 49 @GodotName("clear_current") GodotMethod!(void) clearCurrent; 50 @GodotName("force_update_scroll") GodotMethod!(void) forceUpdateScroll; 51 @GodotName("get_anchor_mode") GodotMethod!(Camera2D.AnchorMode) getAnchorMode; 52 @GodotName("get_camera_position") GodotMethod!(Vector2) getCameraPosition; 53 @GodotName("get_camera_screen_center") GodotMethod!(Vector2) getCameraScreenCenter; 54 @GodotName("get_custom_viewport") GodotMethod!(Node) getCustomViewport; 55 @GodotName("get_drag_margin") GodotMethod!(double, long) getDragMargin; 56 @GodotName("get_follow_smoothing") GodotMethod!(double) getFollowSmoothing; 57 @GodotName("get_h_offset") GodotMethod!(double) getHOffset; 58 @GodotName("get_limit") GodotMethod!(long, long) getLimit; 59 @GodotName("get_offset") GodotMethod!(Vector2) getOffset; 60 @GodotName("get_process_mode") GodotMethod!(Camera2D.Camera2DProcessMode) getProcessMode; 61 @GodotName("get_v_offset") GodotMethod!(double) getVOffset; 62 @GodotName("get_zoom") GodotMethod!(Vector2) getZoom; 63 @GodotName("is_current") GodotMethod!(bool) isCurrent; 64 @GodotName("is_follow_smoothing_enabled") GodotMethod!(bool) isFollowSmoothingEnabled; 65 @GodotName("is_h_drag_enabled") GodotMethod!(bool) isHDragEnabled; 66 @GodotName("is_limit_drawing_enabled") GodotMethod!(bool) isLimitDrawingEnabled; 67 @GodotName("is_limit_smoothing_enabled") GodotMethod!(bool) isLimitSmoothingEnabled; 68 @GodotName("is_margin_drawing_enabled") GodotMethod!(bool) isMarginDrawingEnabled; 69 @GodotName("is_rotating") GodotMethod!(bool) isRotating; 70 @GodotName("is_screen_drawing_enabled") GodotMethod!(bool) isScreenDrawingEnabled; 71 @GodotName("is_v_drag_enabled") GodotMethod!(bool) isVDragEnabled; 72 @GodotName("make_current") GodotMethod!(void) makeCurrent; 73 @GodotName("reset_smoothing") GodotMethod!(void) resetSmoothing; 74 @GodotName("set_anchor_mode") GodotMethod!(void, long) setAnchorMode; 75 @GodotName("set_custom_viewport") GodotMethod!(void, Node) setCustomViewport; 76 @GodotName("set_drag_margin") GodotMethod!(void, long, double) setDragMargin; 77 @GodotName("set_enable_follow_smoothing") GodotMethod!(void, bool) setEnableFollowSmoothing; 78 @GodotName("set_follow_smoothing") GodotMethod!(void, double) setFollowSmoothing; 79 @GodotName("set_h_drag_enabled") GodotMethod!(void, bool) setHDragEnabled; 80 @GodotName("set_h_offset") GodotMethod!(void, double) setHOffset; 81 @GodotName("set_limit") GodotMethod!(void, long, long) setLimit; 82 @GodotName("set_limit_drawing_enabled") GodotMethod!(void, bool) setLimitDrawingEnabled; 83 @GodotName("set_limit_smoothing_enabled") GodotMethod!(void, bool) setLimitSmoothingEnabled; 84 @GodotName("set_margin_drawing_enabled") GodotMethod!(void, bool) setMarginDrawingEnabled; 85 @GodotName("set_offset") GodotMethod!(void, Vector2) setOffset; 86 @GodotName("set_process_mode") GodotMethod!(void, long) setProcessMode; 87 @GodotName("set_rotating") GodotMethod!(void, bool) setRotating; 88 @GodotName("set_screen_drawing_enabled") GodotMethod!(void, bool) setScreenDrawingEnabled; 89 @GodotName("set_v_drag_enabled") GodotMethod!(void, bool) setVDragEnabled; 90 @GodotName("set_v_offset") GodotMethod!(void, double) setVOffset; 91 @GodotName("set_zoom") GodotMethod!(void, Vector2) setZoom; 92 } 93 /// 94 pragma(inline, true) bool opEquals(in Camera2D other) const 95 { return _godot_object.ptr is other._godot_object.ptr; } 96 /// 97 pragma(inline, true) typeof(null) opAssign(typeof(null) n) 98 { _godot_object.ptr = n; return null; } 99 /// 100 pragma(inline, true) bool opEquals(typeof(null) n) const 101 { return _godot_object.ptr is n; } 102 /// 103 size_t toHash() const @trusted { return cast(size_t)_godot_object.ptr; } 104 mixin baseCasts; 105 /// Construct a new instance of Camera2D. 106 /// Note: use `memnew!Camera2D` instead. 107 static Camera2D _new() 108 { 109 static godot_class_constructor constructor; 110 if(constructor is null) constructor = _godot_api.godot_get_class_constructor("Camera2D"); 111 if(constructor is null) return typeof(this).init; 112 return cast(Camera2D)(constructor()); 113 } 114 @disable new(size_t s); 115 /// 116 enum Camera2DProcessMode : int 117 { 118 /** 119 The camera updates with the `_physics_process` callback. 120 */ 121 camera2dProcessPhysics = 0, 122 /** 123 The camera updates with the `_process` callback. 124 */ 125 camera2dProcessIdle = 1, 126 } 127 /// 128 enum AnchorMode : int 129 { 130 /** 131 The camera's position is fixed so that the top-left corner is always at the origin. 132 */ 133 anchorModeFixedTopLeft = 0, 134 /** 135 The camera's position takes into account vertical/horizontal offsets and the screen size. 136 */ 137 anchorModeDragCenter = 1, 138 } 139 /// 140 enum Constants : int 141 { 142 camera2dProcessPhysics = 0, 143 anchorModeFixedTopLeft = 0, 144 anchorModeDragCenter = 1, 145 camera2dProcessIdle = 1, 146 } 147 /** 148 149 */ 150 void _makeCurrent(GodotObject arg0) 151 { 152 Array _GODOT_args = Array.make(); 153 _GODOT_args.append(arg0); 154 String _GODOT_method_name = String("_make_current"); 155 this.callv(_GODOT_method_name, _GODOT_args); 156 } 157 /** 158 159 */ 160 void _setCurrent(in bool current) 161 { 162 Array _GODOT_args = Array.make(); 163 _GODOT_args.append(current); 164 String _GODOT_method_name = String("_set_current"); 165 this.callv(_GODOT_method_name, _GODOT_args); 166 } 167 /** 168 169 */ 170 void _updateScroll() 171 { 172 Array _GODOT_args = Array.make(); 173 String _GODOT_method_name = String("_update_scroll"); 174 this.callv(_GODOT_method_name, _GODOT_args); 175 } 176 /** 177 Aligns the camera to the tracked node. 178 */ 179 void _align() 180 { 181 checkClassBinding!(typeof(this))(); 182 ptrcall!(void)(GDNativeClassBinding._align, _godot_object); 183 } 184 /** 185 Removes any $(D Camera2D) from the ancestor $(D Viewport)'s internal currently-assigned camera. 186 */ 187 void clearCurrent() 188 { 189 checkClassBinding!(typeof(this))(); 190 ptrcall!(void)(GDNativeClassBinding.clearCurrent, _godot_object); 191 } 192 /** 193 Forces the camera to update scroll immediately. 194 */ 195 void forceUpdateScroll() 196 { 197 checkClassBinding!(typeof(this))(); 198 ptrcall!(void)(GDNativeClassBinding.forceUpdateScroll, _godot_object); 199 } 200 /** 201 202 */ 203 Camera2D.AnchorMode getAnchorMode() const 204 { 205 checkClassBinding!(typeof(this))(); 206 return ptrcall!(Camera2D.AnchorMode)(GDNativeClassBinding.getAnchorMode, _godot_object); 207 } 208 /** 209 Returns the camera position. 210 */ 211 Vector2 getCameraPosition() const 212 { 213 checkClassBinding!(typeof(this))(); 214 return ptrcall!(Vector2)(GDNativeClassBinding.getCameraPosition, _godot_object); 215 } 216 /** 217 Returns the location of the $(D Camera2D)'s screen-center, relative to the origin. 218 */ 219 Vector2 getCameraScreenCenter() const 220 { 221 checkClassBinding!(typeof(this))(); 222 return ptrcall!(Vector2)(GDNativeClassBinding.getCameraScreenCenter, _godot_object); 223 } 224 /** 225 226 */ 227 Node getCustomViewport() const 228 { 229 checkClassBinding!(typeof(this))(); 230 return ptrcall!(Node)(GDNativeClassBinding.getCustomViewport, _godot_object); 231 } 232 /** 233 Returns the specified margin. See also $(D dragMarginBottom), $(D dragMarginTop), $(D dragMarginLeft), and $(D dragMarginRight). 234 */ 235 double getDragMargin(in long margin) const 236 { 237 checkClassBinding!(typeof(this))(); 238 return ptrcall!(double)(GDNativeClassBinding.getDragMargin, _godot_object, margin); 239 } 240 /** 241 242 */ 243 double getFollowSmoothing() const 244 { 245 checkClassBinding!(typeof(this))(); 246 return ptrcall!(double)(GDNativeClassBinding.getFollowSmoothing, _godot_object); 247 } 248 /** 249 250 */ 251 double getHOffset() const 252 { 253 checkClassBinding!(typeof(this))(); 254 return ptrcall!(double)(GDNativeClassBinding.getHOffset, _godot_object); 255 } 256 /** 257 Returns the specified camera limit. See also $(D limitBottom), $(D limitTop), $(D limitLeft), and $(D limitRight). 258 */ 259 long getLimit(in long margin) const 260 { 261 checkClassBinding!(typeof(this))(); 262 return ptrcall!(long)(GDNativeClassBinding.getLimit, _godot_object, margin); 263 } 264 /** 265 266 */ 267 Vector2 getOffset() const 268 { 269 checkClassBinding!(typeof(this))(); 270 return ptrcall!(Vector2)(GDNativeClassBinding.getOffset, _godot_object); 271 } 272 /** 273 274 */ 275 Camera2D.Camera2DProcessMode getProcessMode() const 276 { 277 checkClassBinding!(typeof(this))(); 278 return ptrcall!(Camera2D.Camera2DProcessMode)(GDNativeClassBinding.getProcessMode, _godot_object); 279 } 280 /** 281 282 */ 283 double getVOffset() const 284 { 285 checkClassBinding!(typeof(this))(); 286 return ptrcall!(double)(GDNativeClassBinding.getVOffset, _godot_object); 287 } 288 /** 289 290 */ 291 Vector2 getZoom() const 292 { 293 checkClassBinding!(typeof(this))(); 294 return ptrcall!(Vector2)(GDNativeClassBinding.getZoom, _godot_object); 295 } 296 /** 297 298 */ 299 bool isCurrent() const 300 { 301 checkClassBinding!(typeof(this))(); 302 return ptrcall!(bool)(GDNativeClassBinding.isCurrent, _godot_object); 303 } 304 /** 305 306 */ 307 bool isFollowSmoothingEnabled() const 308 { 309 checkClassBinding!(typeof(this))(); 310 return ptrcall!(bool)(GDNativeClassBinding.isFollowSmoothingEnabled, _godot_object); 311 } 312 /** 313 314 */ 315 bool isHDragEnabled() const 316 { 317 checkClassBinding!(typeof(this))(); 318 return ptrcall!(bool)(GDNativeClassBinding.isHDragEnabled, _godot_object); 319 } 320 /** 321 322 */ 323 bool isLimitDrawingEnabled() const 324 { 325 checkClassBinding!(typeof(this))(); 326 return ptrcall!(bool)(GDNativeClassBinding.isLimitDrawingEnabled, _godot_object); 327 } 328 /** 329 330 */ 331 bool isLimitSmoothingEnabled() const 332 { 333 checkClassBinding!(typeof(this))(); 334 return ptrcall!(bool)(GDNativeClassBinding.isLimitSmoothingEnabled, _godot_object); 335 } 336 /** 337 338 */ 339 bool isMarginDrawingEnabled() const 340 { 341 checkClassBinding!(typeof(this))(); 342 return ptrcall!(bool)(GDNativeClassBinding.isMarginDrawingEnabled, _godot_object); 343 } 344 /** 345 346 */ 347 bool isRotating() const 348 { 349 checkClassBinding!(typeof(this))(); 350 return ptrcall!(bool)(GDNativeClassBinding.isRotating, _godot_object); 351 } 352 /** 353 354 */ 355 bool isScreenDrawingEnabled() const 356 { 357 checkClassBinding!(typeof(this))(); 358 return ptrcall!(bool)(GDNativeClassBinding.isScreenDrawingEnabled, _godot_object); 359 } 360 /** 361 362 */ 363 bool isVDragEnabled() const 364 { 365 checkClassBinding!(typeof(this))(); 366 return ptrcall!(bool)(GDNativeClassBinding.isVDragEnabled, _godot_object); 367 } 368 /** 369 Make this the current 2D camera for the scene (viewport and layer), in case there are many cameras in the scene. 370 */ 371 void makeCurrent() 372 { 373 checkClassBinding!(typeof(this))(); 374 ptrcall!(void)(GDNativeClassBinding.makeCurrent, _godot_object); 375 } 376 /** 377 Sets the camera's position immediately to its current smoothing destination. 378 This has no effect if smoothing is disabled. 379 */ 380 void resetSmoothing() 381 { 382 checkClassBinding!(typeof(this))(); 383 ptrcall!(void)(GDNativeClassBinding.resetSmoothing, _godot_object); 384 } 385 /** 386 387 */ 388 void setAnchorMode(in long anchor_mode) 389 { 390 checkClassBinding!(typeof(this))(); 391 ptrcall!(void)(GDNativeClassBinding.setAnchorMode, _godot_object, anchor_mode); 392 } 393 /** 394 395 */ 396 void setCustomViewport(Node viewport) 397 { 398 checkClassBinding!(typeof(this))(); 399 ptrcall!(void)(GDNativeClassBinding.setCustomViewport, _godot_object, viewport); 400 } 401 /** 402 Sets the specified margin. See also $(D dragMarginBottom), $(D dragMarginTop), $(D dragMarginLeft), and $(D dragMarginRight). 403 */ 404 void setDragMargin(in long margin, in double drag_margin) 405 { 406 checkClassBinding!(typeof(this))(); 407 ptrcall!(void)(GDNativeClassBinding.setDragMargin, _godot_object, margin, drag_margin); 408 } 409 /** 410 411 */ 412 void setEnableFollowSmoothing(in bool follow_smoothing) 413 { 414 checkClassBinding!(typeof(this))(); 415 ptrcall!(void)(GDNativeClassBinding.setEnableFollowSmoothing, _godot_object, follow_smoothing); 416 } 417 /** 418 419 */ 420 void setFollowSmoothing(in double follow_smoothing) 421 { 422 checkClassBinding!(typeof(this))(); 423 ptrcall!(void)(GDNativeClassBinding.setFollowSmoothing, _godot_object, follow_smoothing); 424 } 425 /** 426 427 */ 428 void setHDragEnabled(in bool enabled) 429 { 430 checkClassBinding!(typeof(this))(); 431 ptrcall!(void)(GDNativeClassBinding.setHDragEnabled, _godot_object, enabled); 432 } 433 /** 434 435 */ 436 void setHOffset(in double ofs) 437 { 438 checkClassBinding!(typeof(this))(); 439 ptrcall!(void)(GDNativeClassBinding.setHOffset, _godot_object, ofs); 440 } 441 /** 442 Sets the specified camera limit. See also $(D limitBottom), $(D limitTop), $(D limitLeft), and $(D limitRight). 443 */ 444 void setLimit(in long margin, in long limit) 445 { 446 checkClassBinding!(typeof(this))(); 447 ptrcall!(void)(GDNativeClassBinding.setLimit, _godot_object, margin, limit); 448 } 449 /** 450 451 */ 452 void setLimitDrawingEnabled(in bool limit_drawing_enabled) 453 { 454 checkClassBinding!(typeof(this))(); 455 ptrcall!(void)(GDNativeClassBinding.setLimitDrawingEnabled, _godot_object, limit_drawing_enabled); 456 } 457 /** 458 459 */ 460 void setLimitSmoothingEnabled(in bool limit_smoothing_enabled) 461 { 462 checkClassBinding!(typeof(this))(); 463 ptrcall!(void)(GDNativeClassBinding.setLimitSmoothingEnabled, _godot_object, limit_smoothing_enabled); 464 } 465 /** 466 467 */ 468 void setMarginDrawingEnabled(in bool margin_drawing_enabled) 469 { 470 checkClassBinding!(typeof(this))(); 471 ptrcall!(void)(GDNativeClassBinding.setMarginDrawingEnabled, _godot_object, margin_drawing_enabled); 472 } 473 /** 474 475 */ 476 void setOffset(in Vector2 offset) 477 { 478 checkClassBinding!(typeof(this))(); 479 ptrcall!(void)(GDNativeClassBinding.setOffset, _godot_object, offset); 480 } 481 /** 482 483 */ 484 void setProcessMode(in long mode) 485 { 486 checkClassBinding!(typeof(this))(); 487 ptrcall!(void)(GDNativeClassBinding.setProcessMode, _godot_object, mode); 488 } 489 /** 490 491 */ 492 void setRotating(in bool rotating) 493 { 494 checkClassBinding!(typeof(this))(); 495 ptrcall!(void)(GDNativeClassBinding.setRotating, _godot_object, rotating); 496 } 497 /** 498 499 */ 500 void setScreenDrawingEnabled(in bool screen_drawing_enabled) 501 { 502 checkClassBinding!(typeof(this))(); 503 ptrcall!(void)(GDNativeClassBinding.setScreenDrawingEnabled, _godot_object, screen_drawing_enabled); 504 } 505 /** 506 507 */ 508 void setVDragEnabled(in bool enabled) 509 { 510 checkClassBinding!(typeof(this))(); 511 ptrcall!(void)(GDNativeClassBinding.setVDragEnabled, _godot_object, enabled); 512 } 513 /** 514 515 */ 516 void setVOffset(in double ofs) 517 { 518 checkClassBinding!(typeof(this))(); 519 ptrcall!(void)(GDNativeClassBinding.setVOffset, _godot_object, ofs); 520 } 521 /** 522 523 */ 524 void setZoom(in Vector2 zoom) 525 { 526 checkClassBinding!(typeof(this))(); 527 ptrcall!(void)(GDNativeClassBinding.setZoom, _godot_object, zoom); 528 } 529 /** 530 The Camera2D's anchor point. See $(D anchormode) constants. 531 */ 532 @property Camera2D.AnchorMode anchorMode() 533 { 534 return getAnchorMode(); 535 } 536 /// ditto 537 @property void anchorMode(long v) 538 { 539 setAnchorMode(v); 540 } 541 /** 542 If `true`, the camera is the active camera for the current scene. Only one camera can be current, so setting a different camera `current` will disable this one. 543 */ 544 @property bool current() 545 { 546 return isCurrent(); 547 } 548 /// ditto 549 @property void current(bool v) 550 { 551 _setCurrent(v); 552 } 553 /** 554 The custom $(D Viewport) node attached to the $(D Camera2D). If `null` or not a $(D Viewport), uses the default viewport instead. 555 */ 556 @property Node customViewport() 557 { 558 return getCustomViewport(); 559 } 560 /// ditto 561 @property void customViewport(Node v) 562 { 563 setCustomViewport(v); 564 } 565 /** 566 Bottom margin needed to drag the camera. A value of `1` makes the camera move only when reaching the edge of the screen. 567 */ 568 @property double dragMarginBottom() 569 { 570 return getDragMargin(3); 571 } 572 /// ditto 573 @property void dragMarginBottom(double v) 574 { 575 setDragMargin(3, v); 576 } 577 /** 578 If `true`, the camera only moves when reaching the horizontal drag margins. If `false`, the camera moves horizontally regardless of margins. 579 */ 580 @property bool dragMarginHEnabled() 581 { 582 return isHDragEnabled(); 583 } 584 /// ditto 585 @property void dragMarginHEnabled(bool v) 586 { 587 setHDragEnabled(v); 588 } 589 /** 590 Left margin needed to drag the camera. A value of `1` makes the camera move only when reaching the edge of the screen. 591 */ 592 @property double dragMarginLeft() 593 { 594 return getDragMargin(0); 595 } 596 /// ditto 597 @property void dragMarginLeft(double v) 598 { 599 setDragMargin(0, v); 600 } 601 /** 602 Right margin needed to drag the camera. A value of `1` makes the camera move only when reaching the edge of the screen. 603 */ 604 @property double dragMarginRight() 605 { 606 return getDragMargin(2); 607 } 608 /// ditto 609 @property void dragMarginRight(double v) 610 { 611 setDragMargin(2, v); 612 } 613 /** 614 Top margin needed to drag the camera. A value of `1` makes the camera move only when reaching the edge of the screen. 615 */ 616 @property double dragMarginTop() 617 { 618 return getDragMargin(1); 619 } 620 /// ditto 621 @property void dragMarginTop(double v) 622 { 623 setDragMargin(1, v); 624 } 625 /** 626 If `true`, the camera only moves when reaching the vertical drag margins. If `false`, the camera moves vertically regardless of margins. 627 */ 628 @property bool dragMarginVEnabled() 629 { 630 return isVDragEnabled(); 631 } 632 /// ditto 633 @property void dragMarginVEnabled(bool v) 634 { 635 setVDragEnabled(v); 636 } 637 /** 638 If `true`, draws the camera's drag margin rectangle in the editor. 639 */ 640 @property bool editorDrawDragMargin() 641 { 642 return isMarginDrawingEnabled(); 643 } 644 /// ditto 645 @property void editorDrawDragMargin(bool v) 646 { 647 setMarginDrawingEnabled(v); 648 } 649 /** 650 If `true`, draws the camera's limits rectangle in the editor. 651 */ 652 @property bool editorDrawLimits() 653 { 654 return isLimitDrawingEnabled(); 655 } 656 /// ditto 657 @property void editorDrawLimits(bool v) 658 { 659 setLimitDrawingEnabled(v); 660 } 661 /** 662 If `true`, draws the camera's screen rectangle in the editor. 663 */ 664 @property bool editorDrawScreen() 665 { 666 return isScreenDrawingEnabled(); 667 } 668 /// ditto 669 @property void editorDrawScreen(bool v) 670 { 671 setScreenDrawingEnabled(v); 672 } 673 /** 674 Bottom scroll limit in pixels. The camera stops moving when reaching this value. 675 */ 676 @property long limitBottom() 677 { 678 return getLimit(3); 679 } 680 /// ditto 681 @property void limitBottom(long v) 682 { 683 setLimit(3, v); 684 } 685 /** 686 Left scroll limit in pixels. The camera stops moving when reaching this value. 687 */ 688 @property long limitLeft() 689 { 690 return getLimit(0); 691 } 692 /// ditto 693 @property void limitLeft(long v) 694 { 695 setLimit(0, v); 696 } 697 /** 698 Right scroll limit in pixels. The camera stops moving when reaching this value. 699 */ 700 @property long limitRight() 701 { 702 return getLimit(2); 703 } 704 /// ditto 705 @property void limitRight(long v) 706 { 707 setLimit(2, v); 708 } 709 /** 710 If `true`, the camera smoothly stops when reaches its limits. 711 */ 712 @property bool limitSmoothed() 713 { 714 return isLimitSmoothingEnabled(); 715 } 716 /// ditto 717 @property void limitSmoothed(bool v) 718 { 719 setLimitSmoothingEnabled(v); 720 } 721 /** 722 Top scroll limit in pixels. The camera stops moving when reaching this value. 723 */ 724 @property long limitTop() 725 { 726 return getLimit(1); 727 } 728 /// ditto 729 @property void limitTop(long v) 730 { 731 setLimit(1, v); 732 } 733 /** 734 The camera's offset, useful for looking around or camera shake animations. 735 */ 736 @property Vector2 offset() 737 { 738 return getOffset(); 739 } 740 /// ditto 741 @property void offset(Vector2 v) 742 { 743 setOffset(v); 744 } 745 /** 746 The horizontal offset of the camera, relative to the drag margins. 747 $(B Note:) Offset H is used only to force offset relative to margins. It's not updated in any way if drag margins are enabled and can be used to set initial offset. 748 */ 749 @property double offsetH() 750 { 751 return getHOffset(); 752 } 753 /// ditto 754 @property void offsetH(double v) 755 { 756 setHOffset(v); 757 } 758 /** 759 The vertical offset of the camera, relative to the drag margins. 760 $(B Note:) Used the same as $(D offsetH). 761 */ 762 @property double offsetV() 763 { 764 return getVOffset(); 765 } 766 /// ditto 767 @property void offsetV(double v) 768 { 769 setVOffset(v); 770 } 771 /** 772 The camera's process callback. See $(D camera2dprocessmode). 773 */ 774 @property Camera2D.Camera2DProcessMode processMode() 775 { 776 return getProcessMode(); 777 } 778 /// ditto 779 @property void processMode(long v) 780 { 781 setProcessMode(v); 782 } 783 /** 784 If `true`, the camera rotates with the target. 785 */ 786 @property bool rotating() 787 { 788 return isRotating(); 789 } 790 /// ditto 791 @property void rotating(bool v) 792 { 793 setRotating(v); 794 } 795 /** 796 If `true`, the camera smoothly moves towards the target at $(D smoothingSpeed). 797 */ 798 @property bool smoothingEnabled() 799 { 800 return isFollowSmoothingEnabled(); 801 } 802 /// ditto 803 @property void smoothingEnabled(bool v) 804 { 805 setEnableFollowSmoothing(v); 806 } 807 /** 808 Speed in pixels per second of the camera's smoothing effect when $(D smoothingEnabled) is `true`. 809 */ 810 @property double smoothingSpeed() 811 { 812 return getFollowSmoothing(); 813 } 814 /// ditto 815 @property void smoothingSpeed(double v) 816 { 817 setFollowSmoothing(v); 818 } 819 /** 820 The camera's zoom relative to the viewport. Values larger than `Vector2(1, 1)` zoom out and smaller values zoom in. For an example, use `Vector2(0.5, 0.5)` for a 2× zoom-in, and `Vector2(4, 4)` for a 4× zoom-out. 821 */ 822 @property Vector2 zoom() 823 { 824 return getZoom(); 825 } 826 /// ditto 827 @property void zoom(Vector2 v) 828 { 829 setZoom(v); 830 } 831 }