Initial commit
This commit is contained in:
166
application/source/examples/example.operator.overload.c
Normal file
166
application/source/examples/example.operator.overload.c
Normal file
@@ -0,0 +1,166 @@
|
||||
|
||||
|
||||
|
||||
|
||||
#include "../text.h"
|
||||
|
||||
#include "../vector2.h"
|
||||
|
||||
#include "../vector3.h"
|
||||
|
||||
#include "../console.h"
|
||||
|
||||
|
||||
|
||||
void main() {
|
||||
|
||||
text * textB = new text("ook mooi");
|
||||
|
||||
char * other = malloc(5000);
|
||||
|
||||
vector3 * newVector3 = new vector3();
|
||||
|
||||
newVector3->x = 2;
|
||||
|
||||
newVector3->y = 2;
|
||||
|
||||
newVector3->z = 3;
|
||||
|
||||
|
||||
for (int i = 0; i < 1000; ++i)
|
||||
{
|
||||
|
||||
vector3 * vector3B = new vector3();
|
||||
|
||||
|
||||
vector3B->x = 2;
|
||||
|
||||
vector3B->y = 3;
|
||||
|
||||
vector3B->z = 4;
|
||||
|
||||
|
||||
vector3 * vector3C = new vector3();
|
||||
|
||||
|
||||
vector3C->x = 2;
|
||||
|
||||
vector3C->y = 3;
|
||||
|
||||
vector3C->z = 4;
|
||||
|
||||
newVector3 = vector3C + ( vector3C + newVector3 + ( ( ( ( vector3B + vector3C ) ) + vector3C ) + vector3B ) );
|
||||
|
||||
newVector3 = newVector3 + ( ( vector3B + vector3C ) + vector3C );
|
||||
|
||||
}
|
||||
|
||||
console->log( newVector3 );
|
||||
|
||||
text * textA = new text("mooi");
|
||||
|
||||
if( textA == textB ) {
|
||||
|
||||
printf("mooi zo");
|
||||
|
||||
}
|
||||
|
||||
text * textC = new text("mooi");
|
||||
|
||||
text * textD = new text("mooi");
|
||||
|
||||
|
||||
if( ( ( textA == textC ) && ( textA == textD ) ) && textA == textD ) {
|
||||
|
||||
printf("Good, This works.\n\n");
|
||||
|
||||
}
|
||||
|
||||
char * realChar = "something";
|
||||
|
||||
if( "something" == realChar ) {
|
||||
|
||||
printf("Wauw.\n\n");
|
||||
|
||||
}
|
||||
|
||||
if( realChar == "something" ) {
|
||||
|
||||
printf("Wauw.\n\n");
|
||||
|
||||
}
|
||||
|
||||
if( realChar == realChar ) {
|
||||
|
||||
printf("Wauw.\n\n");
|
||||
|
||||
}
|
||||
|
||||
if( "something" == "something" && realChar == "something" ) {
|
||||
|
||||
printf("Wauw.\n\n");
|
||||
|
||||
}
|
||||
|
||||
char * fancy = "aaa ";
|
||||
|
||||
char * aaaa = " bbb ";
|
||||
|
||||
char * bbbb = " ccc ";
|
||||
|
||||
char * dddd = " dddd ";
|
||||
|
||||
other += ( fancy + ( bbbb + aaaa ) + dddd ) + " eee" + " het is een wonder ";
|
||||
|
||||
other += ("boven wonder" + returnText("this is a normal function") + " and this " + ( "works just good..." + dddd ));
|
||||
|
||||
other += "something" + ( returnText("this is a normal function") + textB->toNative() + textB->value );
|
||||
|
||||
other += ("and here some text") + (textB->toNative()) ;
|
||||
|
||||
other += ( textB->value + ( ( textB->value ) + returnText("this is a normal function") ) + (textB->toNative() + "here some text" + textB->value ) );
|
||||
|
||||
other += textB->value + textB->value + ( textB->value + textB->value ) + ( textB->value + textB->value ) + textB->value + textB->value;
|
||||
|
||||
console.log( "Mooi zo ", other );
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
vector2 testVector = new vector2( 1, 450 );
|
||||
|
||||
|
||||
//int count = 0;
|
||||
|
||||
for (int i = 0; i < 2000000; ++i)
|
||||
{
|
||||
vector2 testVector1 = new vector2( 2, 450 );
|
||||
|
||||
vector2 * testVector2 = new vector2( 10, 450 );
|
||||
|
||||
testVector += testVector1 + testVector2;
|
||||
|
||||
//count++;
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
char * returnText( char * text ) {
|
||||
|
||||
return text;
|
||||
|
||||
}
|
||||
|
||||
void abort() {
|
||||
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user