This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ view_3d_model_basic.dpr from CGE modified to test Scene.MoveToViewpoint. } | |
program view_3d_model_basic; | |
{$ifdef MSWINDOWS} {$apptype GUI} {$endif} | |
uses SysUtils, Classes, | |
CastleWindow, CastleSceneCore, CastleScene, CastleViewport, CastleCameras, CastleVectors, | |
CastleUIControls, CastleKeysMouse, CastleLog, CastleStringUtils; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
uses SysUtils, Types, Windows; | |
function WndProc(hWnd: HWND; uMsg: UINT; wParm: WPARAM; lParm: LPARAM) :LRESULT; stdcall; | |
begin | |
// It is critical to use here DefWindowProcW, not DefWindowProc, | |
// otherwise CreateWindowExW expects caption using 8-bit (ANSI) encoding. | |
Result := DefWindowProcW(hWnd, uMsg, wParm, lParm); | |
end; | |
var |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Sample that shows how to detect double-click in CGE. | |
Copy this code e.g. over CGE example | |
examples/user_interface/state_events/code/gamestatemain.pas | |
to test. } | |
{ Main state, where most of the application logic takes place. } | |
unit GameStateMain; | |
interface |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Sample unit to implement randomization of sounds, | |
after the feature was removed from CGE sounds XML file. | |
See https://github.com/castle-engine/castle-engine/wiki/Upgrading-to-Castle-Game-Engine-7.0 | |
for documentation. | |
Copyright 2021 Michalis Kamburelis. | |
License: modified BSD (3-clause), so basically reuse it freely (see | |
https://github.com/castle-engine/castle-engine/blob/master/doc/licenses/COPYING.BSD-3-clause.txt ). | |
Usage: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- compile-command: "castle-engine simple-compile position_on_viewport_early.lpr && ./position_on_viewport_early" -*- | |
{ Reproduction for https://github.com/castle-engine/castle-engine/issues/295 . } | |
uses SysUtils, | |
CastleWindow, CastleViewport, CastleVectors, CastleFilesUtils, CastleTransform, | |
CastleLog, CastleKeysMouse, CastleScene; | |
var | |
Viewport: TCastleViewport; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- compile-command: "castle-engine simple-compile update_texture_coords.lpr && ./update_texture_coords" -*- | |
{ Reproduction for https://github.com/castle-engine/castle-engine/issues/303 . | |
Based on https://castle-engine.io/x3d_implementation_geometry3d.php example. } | |
uses SysUtils, | |
CastleWindow, CastleScene, CastleViewport, CastleKeysMouse, | |
CastleColors, CastleVectors, CastleFilesUtils, X3DNodes, CastleTransform; | |
var | |
TextureCoordinate: TTextureCoordinateNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- compile-command: "castle-engine simple-compile reload_texture.lpr && ./reload_texture" -*- | |
{ See https://github.com/castle-engine/castle-engine/issues/304 | |
Pressing S or W multiple times in a row should not reload the texture. | |
First press of S or W should still switch the texture. | |
} | |
uses SysUtils, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// -*- compile-command: "castle-engine simple-compile transform_save.lpr" -*- | |
{ TransformSave example. } | |
uses SysUtils, | |
CastleVectors, CastleTransform, CastleScene, CastleComponentSerialize; | |
var | |
S: TCastleScene; | |
T: TCastleTransform; | |
begin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ Build an IndexedFaceSet node (mesh) with Color node (colors per-vertex). } | |
uses SysUtils, | |
CastleWindow, CastleScene, CastleViewport, | |
CastleColors, CastleVectors, X3DNodes, CastleTransform; | |
function BuildRootNode: TX3DRootNode; | |
var | |
Shape: TShapeNode; | |
Geometry: TIndexedFaceSetNode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{$mode objfpc}{$H+} | |
unit Game; | |
interface | |
uses CastleWindowTouch; | |
var | |
Window: TCastleWindowTouch; |