Automatically convert spaces to tabs in codeblocks

• Adds codeblock css rule for tab-size
• Only applies to GDScript/C++
• Fix some inconsistent cpp codeblock filters
This commit is contained in:
Thaddeus Crews
2023-10-09 01:31:40 +02:00
committed by Max Hilbrunner
parent 023122177b
commit c4bb6dfdfa
4 changed files with 28 additions and 14 deletions
@@ -158,7 +158,7 @@ Your folder structure should now look like this:
In the ``src`` folder, we'll start with creating our header file for the
GDExtension node we'll be creating. We will name it ``gdexample.h``:
.. code-block:: C++
.. code-block:: cpp
#ifndef GDEXAMPLE_H
#define GDEXAMPLE_H
@@ -211,7 +211,7 @@ as the ``_process`` function you're used to in GDScript.
Let's implement our functions by creating our ``gdexample.cpp`` file:
.. code-block:: C++
.. code-block:: cpp
#include "gdexample.h"
#include <godot_cpp/core/class_db.hpp>
@@ -250,7 +250,7 @@ and source file like we've implemented ``GDExample`` up above. What we need now
is a small bit of code that tells Godot about all the classes in our
GDExtension plugin.
.. code-block:: C++
.. code-block:: cpp
#include "register_types.h"
@@ -304,7 +304,7 @@ Furthermore, it sets the level of initialization (core, servers, scene, editor,
At last, we need the header file for the ``register_types.cpp`` named
``register_types.h``.
.. code-block:: C++
.. code-block:: cpp
#ifndef GDEXAMPLE_REGISTER_TYPES_H
#define GDEXAMPLE_REGISTER_TYPES_H
@@ -463,7 +463,7 @@ Lets add a property that allows us to control the amplitude of our wave.
In our ``gdexample.h`` file we need to add a member variable and getter and setter
functions:
.. code-block:: C++
.. code-block:: cpp
...
private:
@@ -478,7 +478,7 @@ functions:
In our ``gdexample.cpp`` file we need to make a number of changes, we will only
show the methods we end up changing, don't remove the lines we're omitting:
.. code-block:: C++
.. code-block:: cpp
void GDExample::_bind_methods() {
ClassDB::bind_method(D_METHOD("get_amplitude"), &GDExample::get_amplitude);
@@ -520,7 +520,7 @@ Let's do the same but for the speed of our animation and use a setter and getter
function. Our ``gdexample.h`` header file again only needs a few more lines of
code:
.. code-block:: C++
.. code-block:: cpp
...
double amplitude;
@@ -534,7 +534,7 @@ code:
This requires a few more changes to our ``gdexample.cpp`` file, again we're only
showing the methods that have changed so don't remove anything we're omitting:
.. code-block:: C++
.. code-block:: cpp
void GDExample::_bind_methods() {
...
@@ -591,7 +591,7 @@ would need to showcase a far more complete example.
This is the required syntax:
.. code-block:: C++
.. code-block:: cpp
some_other_node->connect("the_signal", this, "my_method");
@@ -604,7 +604,7 @@ emit a signal every time a second has passed and pass the new location along.
In our ``gdexample.h`` header file, we need to define a new member ``time_emit``:
.. code-block:: C++
.. code-block:: cpp
...
double time_passed;
@@ -619,7 +619,7 @@ constructor. We'll look at the other 2 needed changes one by one.
In our ``_bind_methods`` method, we need to declare our signal. This is done
as follows:
.. code-block:: C++
.. code-block:: cpp
void GDExample::_bind_methods() {
...
@@ -640,7 +640,7 @@ of type ``Vector2``, respectively named "node" and "new_pos".
Next, we'll need to change our ``_process`` method:
.. code-block:: C++
.. code-block:: cpp
void GDExample::_process(double delta) {
time_passed += speed * delta;