-
Notifications
You must be signed in to change notification settings - Fork 28
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add rudimentary support for images at compiletime
- Loading branch information
Frotty
committed
Jun 22, 2019
1 parent
dde4f98
commit 438757f
Showing
3 changed files
with
141 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
96 changes: 96 additions & 0 deletions
96
de.peeeq.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/mocks/ImageMock.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,96 @@ | ||
package de.peeeq.wurstio.jassinterpreter.mocks; | ||
|
||
import de.peeeq.wurstscript.intermediatelang.ILconstBool; | ||
import de.peeeq.wurstscript.intermediatelang.ILconstInt; | ||
import de.peeeq.wurstscript.intermediatelang.ILconstReal; | ||
import de.peeeq.wurstscript.intermediatelang.ILconstString; | ||
|
||
public class ImageMock { | ||
private final ILconstString file; | ||
private final ILconstReal sizeX; | ||
private final ILconstReal sizeY; | ||
private final ILconstReal sizeZ; | ||
private ILconstReal posX; | ||
private ILconstReal posY; | ||
private ILconstReal posZ; | ||
private final ILconstReal originX; | ||
private final ILconstReal originY; | ||
private final ILconstReal originZ; | ||
private final ILconstInt imageType; | ||
|
||
private ILconstBool shown = ILconstBool.FALSE; | ||
|
||
public ImageMock(ILconstString file, ILconstReal sizeX, ILconstReal sizeY, ILconstReal sizeZ, ILconstReal posX, ILconstReal posY, ILconstReal posZ, | ||
ILconstReal originX, ILconstReal originY, ILconstReal originZ, ILconstInt imageType) { | ||
|
||
this.file = file; | ||
this.sizeX = sizeX; | ||
this.sizeY = sizeY; | ||
this.sizeZ = sizeZ; | ||
this.posX = posX; | ||
this.posY = posY; | ||
this.posZ = posZ; | ||
this.originX = originX; | ||
this.originY = originY; | ||
this.originZ = originZ; | ||
this.imageType = imageType; | ||
} | ||
|
||
public ILconstString getFile() { | ||
return file; | ||
} | ||
|
||
public ILconstReal getSizeX() { | ||
return sizeX; | ||
} | ||
|
||
public ILconstReal getSizeY() { | ||
return sizeY; | ||
} | ||
|
||
public ILconstReal getSizeZ() { | ||
return sizeZ; | ||
} | ||
|
||
public ILconstReal getPosX() { | ||
return posX; | ||
} | ||
|
||
public ILconstReal getPosY() { | ||
return posY; | ||
} | ||
|
||
public ILconstReal getPosZ() { | ||
return posZ; | ||
} | ||
|
||
public ILconstReal getOriginX() { | ||
return originX; | ||
} | ||
|
||
public ILconstReal getOriginY() { | ||
return originY; | ||
} | ||
|
||
public ILconstReal getOriginZ() { | ||
return originZ; | ||
} | ||
|
||
public ILconstInt getImageType() { | ||
return imageType; | ||
} | ||
|
||
public ILconstBool isShown() { | ||
return shown; | ||
} | ||
|
||
public void setShown(ILconstBool shown) { | ||
this.shown = shown; | ||
} | ||
|
||
public void setPosition(ILconstReal x, ILconstReal y, ILconstReal z) { | ||
this.posX = x; | ||
this.posY = y; | ||
this.posZ = z; | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
...q.wurstscript/src/main/java/de/peeeq/wurstio/jassinterpreter/providers/ImageProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package de.peeeq.wurstio.jassinterpreter.providers; | ||
|
||
import de.peeeq.wurstio.jassinterpreter.mocks.ImageMock; | ||
import de.peeeq.wurstscript.intermediatelang.*; | ||
import de.peeeq.wurstscript.intermediatelang.interpreter.AbstractInterpreter; | ||
|
||
public class ImageProvider extends Provider { | ||
|
||
public ImageProvider(AbstractInterpreter interpreter) { | ||
super(interpreter); | ||
} | ||
|
||
public IlConstHandle CreateImage(ILconstString file, ILconstReal sizeX, ILconstReal sizeY, ILconstReal sizeZ, ILconstReal posX, ILconstReal posY, | ||
ILconstReal posZ, ILconstReal originX, ILconstReal originY, ILconstReal originZ, ILconstInt imageType) { | ||
return new IlConstHandle(NameProvider.getRandomName("image"), new ImageMock(file, sizeX, sizeY, sizeZ, posX, posY, posZ, | ||
originX, originY, originZ, imageType)); | ||
} | ||
|
||
public void DestroyImage(IlConstHandle image) { | ||
} | ||
|
||
public void ShowImage(IlConstHandle image, ILconstBool flag) { | ||
ImageMock imageMock = (ImageMock) image.getObj(); | ||
imageMock.setShown(flag); | ||
} | ||
|
||
public void SetImagePosition(IlConstHandle image, ILconstReal x, ILconstReal y, ILconstReal z) { | ||
ImageMock imageMock = (ImageMock) image.getObj(); | ||
imageMock.setPosition(x, y, z); | ||
} | ||
|
||
public void SetImageRender(IlConstHandle image, ILconstBool flag) { | ||
} | ||
|
||
public void SetImageRenderAlways(IlConstHandle image, ILconstBool flag) { | ||
} | ||
|
||
public void SetImageAboveWater(IlConstHandle image, ILconstBool flag, ILconstBool useWaterAlpha) { | ||
} | ||
|
||
public void SetImageType(IlConstHandle image, ILconstInt type) { | ||
} | ||
|
||
} |