Skip to content

castle-engine/cge-www

Repository files navigation

Code and data of Castle Game Engine website

Editing

We use a few ways to edit the content:

AsciiDoctor for static pages

Example of page written this way: https://castle-engine.io/gltf , content in htdocs/doc/gltf.adoc .

To edit: Fork this repository (cge-www) and edit the *.adoc pages in htdocs/doc/ subdirectory. Then create a pull request.

See https://asciidoctor.org/ for an overview of the AsciiDoctor language. To preview your edits:

  • look at GitHub preview of your file
  • or run asciidoctor xxx.adoc
  • or (more complicated but presents complete preview) follow the "Testing Locally" instructions below to set up your own local copy of CGE website.

We support additional macros within AsciiDoctor:

  • cgeref: Place link to API reference of some Pascal identifier, with optional customized title. The Pascal identifier is automatically found in global identifiers in latest CGE API docs (using https://pasdoc.github.io/PhpOutput underneath). Use like this:

    cgeref:TCastleScene[]
    cgeref:TCastleScene[link text for TCastleScene]
    

    If you want to write [ or ] inside the link title, write {{{ or }}} instead. They will be replaced with [ or ] . Like

    cgeref:TMessaging.Send[Messaging.Send({{{'message-1','some-parameter'}}})]
    
  • cgeimg: Place images, using CGE style. Images can be floating (on the right) or be a block within page content flow.

    cgeimg::block[aaa.png|Description of AAA,bbb.png|Description of BBB]
    cgeimg::float[aaa.png|Description of AAA,bbb.png|Description of BBB]
    
    // This example has image filenames that actually exist, so go ahead and try pasting it some .adoc
    cgeimg::block[dragon_0_wire.png|Dragon,gamma_nogamma_helmet.png|Gamma Correction]
    cgeimg::float[dragon_0_wire.png|Dragon,gamma_nogamma_helmet.png|Gamma Correction]
    
    // Additional whitespace and newlines are allowed for cgeimg, so you can write it like this too
    cgeimg::block[
      dragon_0_wire.png|Dragon,
      gamma_nogamma_helmet.png|Gamma Correction
    ]
    

    Note: you can use backslash to write an ordinary comma within the image description.

    cgeimg::block[aaa.png|A very\, very\, very long description]
    
    cgeimg::block[aaa.png|Can be used to escape bar too\| <- like this]
    
    cgeimg::block[aaa.png|Double your backslashes to be safe, \\ <- this outputs a backslash]
    

    We expect to find referenced images (aaa.png,bbb.png in examples below) in htdocs/images/original_size/. You can regenerate all thumbnails using cd htdocs/images/ && make, though at development they will also be regenerated as-needed by PHP. To allow the PHP to do this,

    • install ImageMagick (convert must be on $PATH),

    • install Ffmpeg (ffmpeg must be on $PATH) to process some GIFs,

    • GNU make,

    • and make sure PHP has permissions to write within proper images/ subdirectories: chmod -R a+rwX htdocs/images/*_size/.

    • Once, right after cloning this repo from GIT, it is useful to execute make do-not-regenerate-existing-images to avoid regenerating all thumbnails because their timestamps are older than the source images.

    The idea is that (at development) you

  • Note: AsciiDoctor macros above are not really implemented as AsciiDoctor macros in Ruby, following

    Instead they are implemented using PHP, as replacements on top of the AsciiDoctor processing. Why? Because we needed to implement them in PHP too, as our pages need these functions in PHP too, and for Wordpress shortcodes too.

PHP for static pages

Example of page written this way: https://castle-engine.io/compiling_from_source.php , content in htdocs/compiling_from_source.php .

To edit: Fork this repository, edit php file in htdocs/, and create a pull request.

To test your modifications, you can follow the "Testing Locally" instructions below. If these instructions look too complicated, just ignore them for simple modifications --- the PHP files are mostly using trivial HTML with small PHP additions (like PHP castle_header, cgeRef functions) so if you understand basic HTML, you can probably figure out what is going on.

Most important PHP functions are:

  • castle_header, castle_footer to start every CGE webpage

  • cgeRef, cgeImg -- consistent with above-described AsciiDoctor macros. Example usage:

    <?php
    echo cgeImg('float', array(
      array('filename' => 'view_events_screen.png', 'titlealt' => 'Plane flying on the mountain background - game'),
      array('filename' => 'view_events_biplane_4_resized.png', 'titlealt' => 'Plane flying on the mountain background - design'),
    ));
    ?>
    
    Something descends from <?php echo cgeRef('TCastleView'); ?> and manages something.
    

Wordpress for news

Example page: https://castle-engine.io/wp/ .

To edit: contact Michalis Kamburelis ([email protected]) to get a Wordpress account. Page contents are in Wordpress database.

Most important Wordpress shortcodes are:

  • [gallery...] - modified Wordpress gallery to use castle_thumbs (quite like cgeImg) to display Wordpress images

  • [cgeref...], [cgeimg....] -- consistent with above-described AsciiDoctor macros. Example usage:

    [cgeimg block images="dragon_0_wire.png|Dragon,gamma_nogamma_helmet.png|Gamma Correction"]
    
    [cgeref id=TCastleScene]
    [cgeref id=TCastleScene title="link text for TCastleScene"]
    
  • We write most Wordpress posts using Markdown (easier than writing HTML, and good enough for our purposes), processed by Jetpack, see Markdown in Jetpack classic editor and Quick Reference.

  • We use Urvanov Syntax Highlighter to highlight code blocks in the posts. Mark the Pascal code blocks in Markdown using 3 backticks with language pascal (TODO: though the language selection is lost during Jetpack processing now, but still write it for the future; for now, we just configured the plugin to use Pascal by default).

Layout of files

Testing Locally

About

Webpage and maintenance scripts of Castle Game Engine

Topics

Resources

License

Security policy

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors