Vielleicht möchten Sie manchmal beim Paneldesign oder Betatest die exakten Mausskoordinaten auf dem Bildschirm sehen und dies ist genau, was der folgende Code leistet.

string temporary_str;
string coordinates_str;
text mcoordinates_txt // using the default font here
{
string = coordinates_str;
layer = 20;
flags = visible;
}
starter display_coords()
{
while (1)
{
str_for_num(temporary_str, mouse_pos.x); // convert
mouse_pos.x to a string
str_cpy(coordinates_str, "("); // add
the first paranthesis
str_cat(coordinates_str, temporary_str); // add
mouse_pos.x to the string
str_cat(coordinates_str, ","); // add
a comma to separate mouse_pos.x and mouse_pos.y
str_for_num(temporary_str, mouse_pos.y); // convert
mouse_pos.y to a string
str_cat(coordinates_str, temporary_str); // add
mouse_pos.y to the string
str_cat(coordinates_str, ")"); // add
the second paranthesis
mcoordinates_txt.pos_x = mouse_pos.x + 15; //
keep the text in the lower right corner
mcoordinates_txt.pos_y = mouse_pos.y + 15; //
in relation to the mouse position
wait (1);
}
}
Ich habe einen einfachen Text benutzt, weil die Koordinaten durch coordinates_str dargstellt werden. Die starter Funktion konvertiert mouse_pos.x (eine Zahl) in einen String und fügt dann eine Klammer ( zu einem String, gefolgt von mouse_pos.x. Dann kommt ein Komma, mouse_pos.y wird konvertiert und angefügt und am Schluss wird die zweite Klammer ) eingefügt. Am Ende stellen wir sicher, dass der Text 15 Pixel rechts unterhalb des Mauszeigers angezeigt wird. Das war’s schon!
Ermitteln Sie die Vertex und Pixel Shader Versionen

Ich muss zugeben, dass ich mich nicht sehr wohl damit fühle, dass es eine solche Fülle verschiedener Grafikkarten gibt. Für ein wirklich gut aussehendes Spiel müssen Sie sicherstellen, dass all Ihre Kunden Grafikkarten mit (zum Beispiel) VS = 2.0 und PS = 2.0 besitzen. Aber wird das so sein? Warten Sie eine Sekunde, ich habe gerade gemerkt, dass eine solche Karte bereits veraltet ist! ;)
Der Code aus diesem Artikel zeigt die Fähigkeiten Ihrer Grafikkarte an, bereiten Sie sich also auf ein gutes oder enttäuschendes Ergebnis vor.
string
tmp_shader = " ";
string temp_str;
string displayed_str;
text
shader_txt
{
pos_x = 300;
pos_y = 300;
string = displayed_str;
layer = 20;
}
Die gesuchten Werte für VS und PS werden durch d3d_shaderversion ermittelt, die ab A6.31 angezeigt werden können. Ich habe einige Strings und einen Text definiert, der diese Werte anzeigen soll.
function display_shader_versions()
{
str_for_num(tmp_shader, d3d_shaderversion); // convert d3d_shaderversion
to a string
str_cpy(temp_str, tmp_shader); // don't destroy tmp_shader; play
with temp_str
str_trunc(temp_str, 3); // cut the last 3 characters from temp_str
(get the first digit of vertex shader version)
str_cpy(displayed_str, "Vertex shader version: ");
str_cat(displayed_str, temp_str);
str_cat(displayed_str, "."); // add a dot
str_cpy(temp_str, tmp_shader); // restore the initial d3d_shaderversion
string
str_trunc(temp_str, 2); // cut the last 2 characters from temp_str
str_clip(temp_str, 1); // cut the first character from temp_str
(we've got the second digit of the vertex shader version here)
str_cat(displayed_str, temp_str);
str_cat(displayed_str, "\n"); // move on to the following
line of text
str_cpy(temp_str, tmp_shader); // restore the initial d3d_shaderversion
string one more time
str_clip(temp_str, 2); // remove the first 2 characters from the
string
str_trunc(temp_str, 1); // remove the last character from the string
str_cat(displayed_str, "Pixel shader version: ");
str_cat(displayed_str, temp_str);
str_cat(displayed_str, "."); // add the dot
str_cpy(temp_str, tmp_shader); // load the initial d3d_shaderversion
for the last time
str_clip(temp_str, 3); // cut the first 3 characters from the string
str_cat(displayed_str, temp_str); // all is ok now
shader_txt.visible = on; // display the text
sleep (5); // wait for 5 seconds
shader_txt.visible = off; // hide the pane;
}
on_s = display_shader_versions;
Die obige Funktion zeigt VS und PS für 5 Sekunden an, wenn der Spieler die “S”-Taste drückt. Die erste Codezeile konvertiert d3d_shaderversion, eine Zahl (1234 würde VS = 1.2 und PS = 3.4 heißen) in einen String. Die folgenden Zeilen kopieren tmp_shader in temp_str, ermitteln die erste Ziffer für VS, schreiben “Vertex shader version: “ in den String und fügen die erste Ziffer an, gefolgt von einem Punkt und der zweiten Ziffer. Der Prozess wird für PS wiederholt. Hier sind die Stufen, die zeigen wie display_str aufgebaut wird:
Vertex shader version:
Vertex shader version: 2
Vertex shader version: 2.
Vertex shader version: 2.0
Vertex
shader version: 2.0
Pixel shader version:
Vertex
shader version: 2.0
Pixel shader version: 2
Vertex
shader version: 2.0
Pixel shader version: 2.
Vertex
shader version: 2.0
Pixel shader version: 2.0