Envision, Create, Share

Welcome to HBGames, a leading amateur game development forum and Discord server. All are welcome, and amongst our ranks you will find experts in their field from all aspects of video game design and development.

PHP C++ Code syntax highlighter

Only test this on Chrome, but I'm writing it for my website articles, here's the first one (unfinished) with the WIP highlighter;
http://www.felixjones.co.uk/neo%20websi ... _Renderer/

If you're on firefox/ie please tell me how it looks. You can click on a line and do ctrl c to automatically copy the text on that line (tested only on windows).

What do you guys think? I based the look (And colours) on this board's code highlighter but the colours of the syntax is based on xcode, I have custom stuff that detects anything starting with xi as a class and ending with _t as a custom type.

Here's an image for those who are too lazy to open a webpage and scroll down
W7ovmC1.png


Here's HBGames' code highlighter (Set to C++) for comparison if you like that kind of thing;
C++:
// Load the screen-space warp material

xiReadFile * const vrFile = fileSystem->CreateAndOpenFile( <span style="color: #666666;">"oculus.wad" );

if ( vrFile ) {

    // This file attaches a vertex, geometry and fragment shader for the warping

    // Also sets some constant uniforms for the shader

    materials.vrMaterial = xiMaterial::CreateFromFile( vrFile );

    // Bind the texture to the texture unit 0 slot for this material

    materials.vrMaterial->BindTexture( textures.vrTexture, xiMaterial::SLOT_0 );

 

    vrFile->Release(); // Release the vrFile memory

}
 
Cool; if it helps I think ours is either geshi or scite, I forget which. Rpg maker uses scite but with a custom palette. But of course being able to use custom tags like yours makes it infinitely more useful. A lot tend to break on strings which escape characters, I know rpg maker and even Linux nano does.
 
I tried looking for existing solutions but adding your own rule is hard for them.

The only thing I'm having trouble with right now are floating point numbers not colouring with certain patterns!
 

Thank you for viewing

HBGames is a leading amateur video game development forum and Discord server open to all ability levels. Feel free to have a nosey around!

Discord

Join our growing and active Discord server to discuss all aspects of game making in a relaxed environment. Join Us

Content

  • Our Games
  • Games in Development
  • Emoji by Twemoji.
    Top