hasa1002 / codetranslator Goto Github PK
View Code? Open in Web Editor NEWTranslates GDScript code to C#
Home Page: https://byhasa.de/codetranslator/
License: The Unlicense
Translates GDScript code to C#
Home Page: https://byhasa.de/codetranslator/
License: The Unlicense
Version: 0.7-dev (Last Build 2021-01-28 01:30)
Description of the problem:
Negative operations such as -42
are not correctly handled.
Steps to reproduce:
See code.
Code:
func _ready():
var f = File.new()
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
[codeblocks]
[gdscript]
func _ready():
var f = File.new()
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
[/gdscript]
[csharp]
public override void _Ready()
{
var f = new File();
f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
}
[/csharp]
[/codeblocks]
public override void _Ready()
{
var f = new File();
f.Store16(-42); // This wraps around and stores 65494 (2^16 - 42).
}
[1] No return value provided. Assuming void. Use -> RETVAL to specify
[3] If constant is enum refer to documentation for correct syntax.
Version: 0.7-dev (Last Build 2020-09-13 01:30)
Description of the problem:
event
needs to be @event
when used as parameter
Steps to reproduce:
Code:
# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
var forward = true
return forward
[codeblocks]
[gdscript]
# Prevents the InputEvent to reach other Editor classes
func forward_spatial_gui_input(camera, event):
var forward = true
return forward
[/gdscript]
[csharp]
// Prevents the InputEvent to reach other Editor classes
public void ForwardSpatialGuiInput(?TYPE? camera, ?TYPE? event)
{
?VAR? forward = true;
return forward;
}
[/csharp]
[/codeblocks]
// Prevents the InputEvent to reach other Editor classes
public void ForwardSpatialGuiInput(?TYPE? camera, ?TYPE? @event)
{
?VAR? forward = true;
return forward;
}
[2] No return value provided. Assuming void. Use -> RETVAL to specify
[2] No type provided. Consider type hinting with NAME:TYPE
[2] No type provided. Consider type hinting with NAME:TYPE
[3] Type of declaration is unknown
Version: 0.1 (Build 2020-08-02 1:38)
Windows 10
Firefox 79.0
Description of the problem:
Can't paste code using the online tool
Steps to reproduce:
Try copy paste some gdscript code and paste it
It'll not paste the code
Code:
N/A
while true:
print("hi")
should be
while (true)
{
GD.Print(true);
}
GDScript Dictionaries can be created using
var dict = {"a": 10, "some": Vector2(10, 11)}
In C# we can use a similar syntax
var dict = new Godot.Collections.Dictionary {
{"a", 10},
{"some", Vector2(10, 11)}
};
Version: 0.7-dev (Last Build 2020-09-13 01:30)
Description of the problem:
Bitwise operators like <<, >>
are not recognized
Steps to reproduce:
Code:
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16
func unsigned16_to_signed(unsigned):
return (unsigned MAX_15B) % MAX_16B - MAX_15B
func _ready():
var f = File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
var read1 = f.get_16() # 65494
var read2 = f.get_16() # 121
var converted1 = unsigned16_to_signed(read1) # -42
var converted2 = unsigned16_to_signed(read2) # 121
[codeblocks]
[gdscript]
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16
func unsigned16_to_signed(unsigned):
return (unsigned MAX_15B) % MAX_16B - MAX_15B
func _ready():
var f = File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
var read1 = f.get_16() # 65494
var read2 = f.get_16() # 121
var converted1 = unsigned16_to_signed(read1) # -42
var converted2 = unsigned16_to_signed(read2) # 121
[/gdscript]
[csharp]
Const Max15b = 1 < < 15;
Const Max16b = 1 < < 16;
public void Unsigned16ToSigned(?TYPE? unsigned)
{
return (unsigned MAX_15B)% MAX_16B - MAX_15B;
}
public override void _Ready()
{
var f = new File();
f.Open(user://file.dat, File.WRITE_READ);
f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
f.Store16(121); // In bounds, will store 121.
f.Seek(0); // Go back to start to read the stored value.
?VAR? read1 = f.Get16(); // 65494
?VAR? read2 = f.Get16(); // 121
?VAR? converted1 = Unsigned16ToSigned(read1); // -42
?VAR? converted2 = Unsigned16ToSigned(read2); // 121
}
[/csharp]
[/codeblocks]
[4] No return value provided. Assuming void. Use -> RETVAL to specify
[4] No type provided. Consider type hinting with NAME:TYPE
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[7] No return value provided. Assuming void. Use -> RETVAL to specify
[9] If constant is enum refer to documentation for correct syntax.
[10] If constant is enum refer to documentation for correct syntax.
[13] Type of declaration is unknown
[14] Type of declaration is unknown
[15] Type of declaration is unknown
[16] Type of declaration is unknown
Version: 0.7-dev (Last Build 2020-09-13 01:30)
Description of the problem:
Commas are leading to parsing bugs. Likely caused by the rewrite of the brace and comma detection.
Steps to reproduce:
Code:
var img = Image.new()
img.create(img_width, img_height, false, Image.FORMAT_RGBA8)
img.set_pixelv(Vector2(x, y), color)
[codeblocks]
[gdscript]
var img = Image.new()
img.create(img_width, img_height, false, Image.FORMAT_RGBA8)
img.set_pixelv(Vector2(x, y), color)
[/gdscript]
[csharp]
var img = new Image();
img.Create(ImgWidth, ImgHeight, false, Image.FORMAT_RGBA8);
img.SetPixelv(new Vector2(X), new Vector2(X, Y)., Color);
[/csharp]
[/codeblocks]
var img = new Image();
img.Create(ImgWidth, ImgHeight, false, Image.FORMAT_RGBA8);
img.SetPixelv(new Vector2(X, Y), Color);
[2] If constant is enum refer to documentation for correct syntax.
Version: 0.7-dev (Last Build 2020-09-13 01:30)
Description of the problem:
const
is not recognised as keyword
Steps to reproduce:
See below
Code:
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16
func unsigned16_to_signed(unsigned):
return (unsigned MAX_15B) % MAX_16B - MAX_15B
func _ready():
var f = File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
var read1 = f.get_16() # 65494
var read2 = f.get_16() # 121
var converted1 = unsigned16_to_signed(read1) # -42
var converted2 = unsigned16_to_signed(read2) # 121
[codeblocks]
[gdscript]
const MAX_15B = 1 << 15
const MAX_16B = 1 << 16
func unsigned16_to_signed(unsigned):
return (unsigned MAX_15B) % MAX_16B - MAX_15B
func _ready():
var f = File.new()
f.open(user://file.dat, File.WRITE_READ)
f.store_16(-42) # This wraps around and stores 65494 (2^16 - 42).
f.store_16(121) # In bounds, will store 121.
f.seek(0) # Go back to start to read the stored value.
var read1 = f.get_16() # 65494
var read2 = f.get_16() # 121
var converted1 = unsigned16_to_signed(read1) # -42
var converted2 = unsigned16_to_signed(read2) # 121
[/gdscript]
[csharp]
Const Max15b = 1 < < 15;
Const Max16b = 1 < < 16;
public void Unsigned16ToSigned(?TYPE? unsigned)
{
return (unsigned MAX_15B)% MAX_16B - MAX_15B;
}
public override void _Ready()
{
var f = new File();
f.Open(user://file.dat, File.WRITE_READ);
f.Store16() - 42); // This wraps around and stores 65494 (2^16 - 42).
f.Store16(121); // In bounds, will store 121.
f.Seek(0); // Go back to start to read the stored value.
?VAR? read1 = f.Get16(); // 65494
?VAR? read2 = f.Get16(); // 121
?VAR? converted1 = Unsigned16ToSigned(read1); // -42
?VAR? converted2 = Unsigned16ToSigned(read2); // 121
}
[/csharp]
[/codeblocks]
[4] No return value provided. Assuming void. Use -> RETVAL to specify
[4] No type provided. Consider type hinting with NAME:TYPE
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[5] If constant is enum refer to documentation for correct syntax.
[7] No return value provided. Assuming void. Use -> RETVAL to specify
[9] If constant is enum refer to documentation for correct syntax.
[10] If constant is enum refer to documentation for correct syntax.
[13] Type of declaration is unknown
[14] Type of declaration is unknown
[15] Type of declaration is unknown
[16] Type of declaration is unknown
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.