Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Updated default template packs

  • Loading branch information...
commit 0f389aace7833eb94da8bf41ea7b1256979ebf1f 1 parent 24579d5
@bmcdorman bmcdorman authored
Showing with 5 additions and 356 deletions.
  1. +2 −2 CMakeLists.txt
  2. BIN  rc/template_packs/C Templates.pack
  3. BIN  rc/template_packs/Cpp Templates.pack
  4. BIN  rc/template_packs/iRobot Create Examples.pack
  5. BIN  rc/templates/C Files/Blank.png
  6. 0  rc/templates/C Files/Blank.template
  7. BIN  rc/templates/C Files/C.png
  8. +0 −12 rc/templates/C Files/C.template
  9. BIN  rc/templates/C Files/Header.png
  10. +0 −9 rc/templates/C Files/Header.template
  11. BIN  rc/templates/C++ Files/Blank.png
  12. 0  rc/templates/C++ Files/Blank.template
  13. BIN  rc/templates/C++ Files/C++.png
  14. +0 −13 rc/templates/C++ Files/C++.template
  15. BIN  rc/templates/C++ Files/Header.png
  16. +0 −9 rc/templates/C++ Files/Header.template
  17. 0  rc/templates/Common Lisp Files/Blank.template
  18. BIN  rc/templates/Java Files/Blank.png
  19. 0  rc/templates/Java Files/Blank.template
  20. BIN  rc/templates/Java Files/Examples/Buttons.png
  21. +0 −36 rc/templates/Java Files/Examples/Buttons.template
  22. BIN  rc/templates/Java Files/Examples/Camera.png
  23. +0 −19 rc/templates/Java Files/Examples/Camera.template
  24. BIN  rc/templates/Java Files/Examples/Create Distance Sensor.png
  25. +0 −42 rc/templates/Java Files/Examples/Create Distance Sensor.template
  26. BIN  rc/templates/Java Files/Examples/ET Calibrator.png
  27. +0 −68 rc/templates/Java Files/Examples/ET Calibrator.template
  28. BIN  rc/templates/Java Files/Examples/Framebuffer.png
  29. +0 −55 rc/templates/Java Files/Examples/Framebuffer.template
  30. BIN  rc/templates/Java Files/Examples/Hello World.png
  31. +0 −5 rc/templates/Java Files/Examples/Hello World.template
  32. BIN  rc/templates/Java Files/Examples/Motor Drive Train.png
  33. +0 −24 rc/templates/Java Files/Examples/Motor Drive Train.template
  34. BIN  rc/templates/Java Files/Examples/Motored Camera.png
  35. +0 −30 rc/templates/Java Files/Examples/Motored Camera.template
  36. BIN  rc/templates/Java Files/Examples/Simple Motors.png
  37. +0 −18 rc/templates/Java Files/Examples/Simple Motors.template
  38. BIN  rc/templates/Java Files/Java.png
  39. +0 −5 rc/templates/Java Files/Java.template
  40. BIN  rc/templates/Python Files/Blank.png
  41. +0 −2  rc/templates/Python Files/Blank.template
  42. BIN  rc/templates/Python Files/Hello World.png
  43. +0 −5 rc/templates/Python Files/Hello World.template
  44. +3 −2 src/source_file.cpp
View
4 CMakeLists.txt
@@ -100,9 +100,9 @@ IF(APPLE)
SET(OSX_INSTALL_NAMES_SCRIPT "${KISS_SOURCE_DIR}/scripts/osx_install_names.sh")
- install(DIRECTORY ${RC}/templates DESTINATION ${KISS_SOURCE_DIR}/deploy/KISS.app/Contents)
+ install(DIRECTORY ${RC}/template_packs DESTINATION ${KISS_SOURCE_DIR}/deploy/KISS.app/Contents)
ELSE(APPLE)
- install(DIRECTORY ${RC}/templates DESTINATION ${KISS_SOURCE_DIR}/deploy)
+ install(DIRECTORY ${RC}/template_packs DESTINATION ${KISS_SOURCE_DIR}/deploy)
ENDIF(APPLE)
IF(APPLE)
View
BIN  rc/template_packs/C Templates.pack
Binary file not shown
View
BIN  rc/template_packs/Cpp Templates.pack
Binary file not shown
View
BIN  rc/template_packs/iRobot Create Examples.pack
Binary file not shown
View
BIN  rc/templates/C Files/Blank.png
Deleted file not rendered
View
0  rc/templates/C Files/Blank.template
No changes.
View
BIN  rc/templates/C Files/C.png
Deleted file not rendered
View
12 rc/templates/C Files/C.template
@@ -1,12 +0,0 @@
-KISS_LEXER c
-END_KISS_META
-
-// Created on KISS_DATE
-
-#include <stdio.h>
-
-int main()
-{
- printf("Hello, World!\n");
- return 0;
-}
View
BIN  rc/templates/C Files/Header.png
Deleted file not rendered
View
9 rc/templates/C Files/Header.template
@@ -1,9 +0,0 @@
-KISS_LEXER h
-END_KISS_META
-
-#ifndef __KISS_FILE_H__
-#define __KISS_FILE_H__
-
-
-
-#endif
View
BIN  rc/templates/C++ Files/Blank.png
Deleted file not rendered
View
0  rc/templates/C++ Files/Blank.template
No changes.
View
BIN  rc/templates/C++ Files/C++.png
Deleted file not rendered
View
13 rc/templates/C++ Files/C++.template
@@ -1,13 +0,0 @@
-KISS_LEXER cpp
-END_KISS_META
-// Created on KISS_DATE
-
-#include <iostream>
-
-using namespace std;
-
-int main()
-{
- cout << "Hello, World!" << endl;
- return 0;
-}
View
BIN  rc/templates/C++ Files/Header.png
Deleted file not rendered
View
9 rc/templates/C++ Files/Header.template
@@ -1,9 +0,0 @@
-KISS_LEXER h
-END_KISS_META
-
-#ifndef __KISS_FILE_H__
-#define __KISS_FILE_H__
-
-
-
-#endif
View
0  rc/templates/Common Lisp Files/Blank.template
No changes.
View
BIN  rc/templates/Java Files/Blank.png
Deleted file not rendered
View
0  rc/templates/Java Files/Blank.template
No changes.
View
BIN  rc/templates/Java Files/Examples/Buttons.png
Deleted file not rendered
View
36 rc/templates/Java Files/Examples/Buttons.template
@@ -1,36 +0,0 @@
-//package cbccore.tests;
-
-import cbccore.Device;
-import cbccore.events.Event;
-import cbccore.events.EventManager;
-import cbccore.events.EventListenerAdapter;
-//import cbccore.motors.listeners.StopMotors;
-import cbccore.sensors.buttons.ButtonEmitter;
-
-class Main {
- public void run() {
- EventManager manager = EventManager.get();
- ButtonEmitter.get().start();
-
- EventListenerAdapter AButtonPressedHandler = new EventListenerAdapter() {
- @Override
- public void event(Event type) {
- System.out.println("The A Button Was Pressed!");
- }
- };
-
- EventListenerAdapter AButtonReleasedHandler = new EventListenerAdapter() {
- @Override
- public void event(Event type) {
- System.out.println("The A Button Was Released!");
- }
- };
-
- manager.connect(ButtonEmitter.AButtonPressed, AButtonPressedHandler);
- manager.connect(ButtonEmitter.AButtonReleased, AButtonReleasedHandler);
- }
-
- public static void main(String[] args) {
- new Main().run();
- }
-}
View
BIN  rc/templates/Java Files/Examples/Camera.png
Deleted file not rendered
View
19 rc/templates/Java Files/Examples/Camera.template
@@ -1,19 +0,0 @@
-import cbccore.movement.*;
-import cbccore.sensors.vision.*;
-
-class Main {
- public static void main(String [] args) {
- Camera c = new Camera();
-
- for(int i = 0; i < 4; ++i) {
- BlobList bList = new BlobList(c, i);
- System.out.println("--------------\nI see " + bList.size() + " blobs on channel " + i);
-
- //individual blobs
- for(Blob k : bList) {
- System.out.println("I see a blob with " + k.getConfindence() +
- "% confidence at position (" + k.getX() + ", " + k.getY() + ").\n\n");
- }
- }
- }
-}
View
BIN  rc/templates/Java Files/Examples/Create Distance Sensor.png
Deleted file not rendered
View
42 rc/templates/Java Files/Examples/Create Distance Sensor.template
@@ -1,42 +0,0 @@
-import cbccore.sensors.*;
-import cbccore.sensors.analog.*;
-import cbccore.sensors.buttons.*;
-import cbccore.movement.DriveTrain;
-import cbccore.movement.CreateDriveTrain;
-import cbccore.events.*;
-import java.util.Arrays;
-import java.util.ArrayList;
-
-class Main {
- public static void main(String [] args) {
- System.out.println("Please press the Black Hardware Button to start.");
-
- EventManager.get().connect(ButtonEmitter.BlackButtonReleased, new StartListener(0));
- ButtonEmitter.get().start();
- }
-
- //****************************
- //*** Begin actual program ***
- public static class StartListener implements IEventListener {
-
- ETSensor distSensor;
- DriveTrain dt;
-
- public StartListener(int port) {
- distSensor = new ETSensor(port);
- dt = new CreateDriveTrain(1., false);
- }
-
- public void event(Event e) {
- EventManager.get().disconnect(ButtonEmitter.BlackButtonReleased, this);
- ButtonEmitter.get().exit();
-
- double dist = distSensor.getCm(50, 10);
- System.out.println("Distance is: " + dist + "cm");
- System.out.println("Moving to 5cm away");
- dt.moveCm(-dist*.5+5., dt.getMaxCmps()*.5);
- dist = distSensor.getCm(50, 10);
- dt.moveCm(-dist+5., dt.getMaxCmps()*.5);
- }
- }
-}
View
BIN  rc/templates/Java Files/Examples/ET Calibrator.png
Deleted file not rendered
View
68 rc/templates/Java Files/Examples/ET Calibrator.template
@@ -1,68 +0,0 @@
-import cbccore.sensors.analog.Analog;
-import cbccore.sensors.buttons.BlackButton;
-
-class Main {
- public static void main(String[] args) {
- double[] distances = {10., 20., 30., 40., 50., 60., 70., 80., 90., 100.};
- double[] analogvals = new double[10];
-
- System.out.println("using analog port 0");
- Analog distSensor = new Analog(0);
- distSensor.setFloating(true);
-
- BlackButton button = new BlackButton();
-
- for(int i = 0; i < distances.length; ++i) {
- System.out.println("move block "+distances[i]+"cm away");
- System.out.println("then press black button");
-
- //really dirty code, do not follow my example
- while(!button.getValue()) { try { Thread.sleep(50); } catch(Exception e) {} }
- while(button.getValue()) { try { Thread.sleep(50); } catch(Exception e) {} }
-
- int sum = 0;
-
- for(int w = 0; w < 50; ++w) {
- sum += distSensor.getValueHigh();
- try { Thread.sleep(10); } catch(Exception e) {}
- }
- analogvals[i] = sum/50.;
- }
-
- double bestDeviation = Double.POSITIVE_INFINITY;
- double bestPow = -1.;
- double bestK = -1.;
- double bestB = -1.;
-
- for(double i = 0.01; i < 3; i += 0.01) {
- double k = 0.;
- for(int w = 0; w < analogvals.length; ++w) {
- k += distances[w]*Math.pow(analogvals[w], i);
- }
- k /= (double)analogvals.length;
-
- double b = 0.;
- for(int w = 0; w < analogvals.length; ++w) {
- b += distances[w]-k/Math.pow(analogvals[w], i);
- }
- b /= (double)analogvals.length;
-
- double deviation = 0.;
- for(int w = 0; w < analogvals.length; ++w) {
- deviation += Math.abs(distances[w]-k/Math.pow(analogvals[w], i)+b);
- }
-
- if(deviation < bestDeviation) {
- bestDeviation = deviation;
- bestPow = i;
- bestK = k;
- bestB = b;
- }
- }
-
- System.out.println("bestPow: "+ bestPow);
- System.out.println("bestK: "+ bestK);
- System.out.println("bestB: "+ bestB);
- System.out.println("with deviation: "+ bestDeviation/distances.length);
- }
-}
View
BIN  rc/templates/Java Files/Examples/Framebuffer.png
Deleted file not rendered
View
55 rc/templates/Java Files/Examples/Framebuffer.template
@@ -1,55 +0,0 @@
-import java.io.File;
-import java.io.IOException;
-
-import cbccore.display.*;
-import cbccore.sensors.buttons.AbstractButton;
-import cbccore.sensors.buttons.BlackButton;
-
-class Main {
- public static void main(String[] args) throws InterruptedException, IOException {
- Framebuffer fb0 = Display.getFramebuffer();
- Pixmap g = new Pixmap(5, 80, Pixel.greenPixel);
- Pixmap r = new Pixmap(5, 80, Pixel.redPixel);
- Pixmap b = new Pixmap(5, 80, Pixel.bluePixel);
- Pixmap filler = new Pixmap(2, 240, new Pixel(0, 0, 0));
- AbstractButton button = new BlackButton();
- int x = 160 - r.getWidth() / 2;
- int y = 120 - r.getHeight() / 2;
- int dir = 0;
- Drawer drawer = new Drawer(fb0);
- int rotatingLineSize = 240;
- Pixmap rotatingLineFiller = new Pixmap(rotatingLineSize, rotatingLineSize, new Pixel(0, 0, 0));
- float angle = 0.f;
-
- while(button.isNotPushed()) {
- if(dir == 0) {
- x+=2;
- if(x + 5 >= 315) {
- dir = 1;
- }
- } else {
- x-=2;
- if(x <= 2) {
- dir = 0;
- }
- }
-
- fb0.fastBlit(dir == 0 ? x - 2 : x + 5, 0, filler);
- fb0.fastBlit((320>>1)-(rotatingLineSize>>1), (240>>1)-(rotatingLineSize>>1),rotatingLineFiller);
- float sinOfAngle = (float)Math.sin(angle);
- float cosOfAngle = (float)Math.cos(angle);
- drawer.drawLine((int)(-cosOfAngle*(rotatingLineSize>>1)+(320>>1)),
- (int)(-sinOfAngle*(rotatingLineSize>>1)+(240>>1)),
- (int)(cosOfAngle*(rotatingLineSize>>1)+(320>>1)),
- (int)(sinOfAngle*(rotatingLineSize>>1)+(240>>1)),
- Pixel.whitePixel
- );
- angle += .1f;
- fb0.fastBlit(x, 0, r);
- fb0.fastBlit(x, 80, g);
- fb0.fastBlit(x, 160, b);
-
- fb0.sync();
- }
- }
-}
View
BIN  rc/templates/Java Files/Examples/Hello World.png
Deleted file not rendered
View
5 rc/templates/Java Files/Examples/Hello World.template
@@ -1,5 +0,0 @@
-class Main {
- public static void main(String[] args) {
- System.out.println("Welcome to CBCJVM");
- }
-}
View
BIN  rc/templates/Java Files/Examples/Motor Drive Train.png
Deleted file not rendered
View
24 rc/templates/Java Files/Examples/Motor Drive Train.template
@@ -1,24 +0,0 @@
-import cbccore.movement.*;
-import cbccore.easing.*;
-
-class Main {
- public static void main(String [] args) {
- MotorDriveTrain dt = new MotorDriveTrain(new Wheel(0, 15.5744, 1.), new Wheel(1, 15.5744, 1.), 11.);
-
- try {
- dt.moveCm(-300., dt.getMaxCmps(), 100,
- EasingEquation.EASE_IN_OUT, EasingEquation.EASE_IN_OUT,
- DriveTrain.PERCENT_DISTANCE, DriveTrain.DISABLED, 1./3.,
- QuadEasingEquation.getInstance()
- );
-
- dt.moveCm(100., dt.getMaxCmps());
-
- System.out.println("moved forward!");
-
- dt.rotateDegrees(180., dt.getMaxDegreesPerSec());
- } catch(Exception e) {
- e.printStackTrace(System.out);
- }
- }
-}
View
BIN  rc/templates/Java Files/Examples/Motored Camera.png
Deleted file not rendered
View
30 rc/templates/Java Files/Examples/Motored Camera.template
@@ -1,30 +0,0 @@
-import cbccore.movement.*;
-import cbccore.vision.*;
-
-class Main {
- public static void main(String [] args) {
- MotorDriveTrain dt = new MotorDriveTrain(new Wheel(0, 15.5744, 1.), new Wheel(1, 15.5744, 1.), 11.);
- Camera c = new Camera();
- Blob mostProbable = null;
- int bestConfidence = 0;
- BlobList bList = new BlobList(c, 0);
- System.out.println(bList.size() + ", " + c.getAvailableBlobLength(0));
- for(Object i : bList) {
- if(((Blob)i).getConfindence() > bestConfidence) {
- bestConfidence = ((Blob)i).getConfindence();
- mostProbable = ((Blob)i);
- }
- }
-
- int destination = 100;
-
- while(true) {
- while(!mostProbable.update()) { c.update(); }
- if(Math.sqrt(mostProbable.getSize()) > 100) {
- dt.moveAtCmps(-dt.maxCmps()*Math.abs((double)mostProbable.getSize()-destination)/320.);
- } else {
- dt.moveAtCmps(dt.maxCmps()*Math.abs((double)mostProbable.getSize()-destination)/320.);
- }
- }
- }
-}
View
BIN  rc/templates/Java Files/Examples/Simple Motors.png
Deleted file not rendered
View
18 rc/templates/Java Files/Examples/Simple Motors.template
@@ -1,18 +0,0 @@
-import cbccore.motors.Motor;
-
-class Main {
- public static void main(String [] args) {
- Motor m = new Motor(0);
- m.moveAtVelocity(100);
- m = new Motor(1);
- m.moveAtVelocity(200);
- m = new Motor(2);
- m.moveAtVelocity(300);
- m = new Motor(3);
- m.moveAtVelocity(400);
- try { Thread.sleep(2000l); } catch (Exception e) {}
- Motor.allOff();
- m.moveRelativePosition(500, 5000);
- m.waitForDone();
- }
-}
View
BIN  rc/templates/Java Files/Java.png
Deleted file not rendered
View
5 rc/templates/Java Files/Java.template
@@ -1,5 +0,0 @@
-class Main {
- public static void main(String[] args) {
- System.out.println("Welcome to CBCJVM");
- }
-}
View
BIN  rc/templates/Python Files/Blank.png
Deleted file not rendered
View
2  rc/templates/Python Files/Blank.template
@@ -1,2 +0,0 @@
-KISS_LEXER py
-END_KISS_META
View
BIN  rc/templates/Python Files/Hello World.png
Deleted file not rendered
View
5 rc/templates/Python Files/Hello World.template
@@ -1,5 +0,0 @@
-KISS_LEXER py
-END_KISS_META
-# Created on KISS_DATE
-
-print "Hello, World!"
View
5 src/source_file.cpp
@@ -435,7 +435,8 @@ void SourceFile::updateMargins()
font.setPointSize(font.pointSize() + getZoom());
charWidth = QFontMetrics(font).width("0");
}
- size = charWidth + charWidth / 2 + charWidth * (int)ceil(log10(std::max(ui_editor->lines(), 10) + 1));
+ size = charWidth + charWidth / 2
+ + charWidth * (int)ceil(log10(std::max(ui_editor->lines(), 10) + 1));
}
ui_editor->setMarginWidth(0, size);
ui_editor->setMarginWidth(1, 16);
@@ -451,7 +452,7 @@ void SourceFile::moveTo(const int& line, const int& pos)
if(line > 0 && pos >= 0) ui_editor->setCursorPosition(line - 1, pos);
}
-QsciScintilla* SourceFile::editor()
+QsciScintilla *SourceFile::editor()
{
return ui_editor;
}
Please sign in to comment.
Something went wrong with that request. Please try again.