2
0

PolycodeImageEditor.cpp 697 B

12345678910111213141516171819202122232425262728293031323334
  1. #include "PolycodeImageEditor.h"
  2. PolycodeImageEditor::PolycodeImageEditor() : PolycodeEditor(true){
  3. }
  4. PolycodeImageEditor::~PolycodeImageEditor() {
  5. }
  6. bool PolycodeImageEditor::openFile(String filePath) {
  7. grid = new ScreenImage("editorGrid.png");
  8. addChild(grid);
  9. grid->snapToPixels = true;
  10. grid->getTexture()->clamp = false;
  11. grid->getTexture()->recreateFromImageData();
  12. editorImage = new ScreenImage(filePath);
  13. addChild(editorImage);
  14. PolycodeEditor::openFile(filePath);
  15. return true;
  16. }
  17. void PolycodeImageEditor::Resize(int x, int y) {
  18. editorImage->setPosition((x-editorImage->getWidth()) /2, (y-editorImage->getHeight()) /2);
  19. grid->setImageCoordinates(0,0,x,y);
  20. }