Skip to content

Commit

Permalink
CWT Paintbrush - Jslix Testbed
Browse files Browse the repository at this point in the history
- Created the Testing platforms [J/JS]
- Tested out PlaceImg [J/JS]
- Restructured codebase [JS]
- Updated Image README to reflect changes
  • Loading branch information
ctomni231 committed Dec 27, 2020
1 parent 30cc15f commit 182a5f6
Show file tree
Hide file tree
Showing 6 changed files with 70 additions and 7 deletions.
6 changes: 5 additions & 1 deletion starter.js → cwtactics.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ import * as inputscr from "./engine/js/input.js"

// These represent the screens
import * as battle from "./cwbattle.js"
import * as testbed from "./testbed.js"

// This is starter.js for CWTactics

export function boot() {

Expand All @@ -18,7 +21,8 @@ export function boot() {
screenlib.addTrait(debugscr)

// Let's test some screens
screenlib.addTrait(battle)
//screenlib.addTrait(battle)
screenlib.addTrait(testbed)

screenlib.run()

Expand Down
2 changes: 1 addition & 1 deletion index.html
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
<script type="module" src="./engine/js/input.test.js"></script>

<script type="module">
import { boot } from "./starter.js"
import { boot } from "./cwtactics.js"
boot()
</script>

Expand Down
4 changes: 3 additions & 1 deletion src/com/cwt/CWTactics.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.cwt;

import com.cwt.screen.BattleScreen;
import com.cwt.screen.TestBed;
import com.jslix.JSlix;

public class CWTactics extends JSlix {
Expand Down Expand Up @@ -30,7 +31,8 @@ public static void main(String[] argv) {
*/
public CWTactics(int width, int height) {
super(width, height);
addScreen(new BattleScreen());
//addScreen(new BattleScreen());
addScreen(new TestBed());
}

}
40 changes: 40 additions & 0 deletions src/com/cwt/screen/TestBed.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
package com.cwt.screen;

import java.awt.Component;
import java.awt.Graphics2D;

import com.jslix.Screen;
import com.jslix.image.ImgLibrary;

/**
* A playground for testing the different features of the program
*
* @author Carr, Crecen
* @version 12.27.20
*/

public class TestBed extends Screen {

private ImgLibrary imgLib;

public TestBed() {
imgLib = new ImgLibrary();
}

@Override
public void init() {
imgLib.addImage("cwtargetapp.png");
}

@Override
public void update(int timePassed) {

}

@Override
public void render(Graphics2D g, Component dthis) {
g.drawImage(imgLib.getImage(0), 10, 10, dthis);
imgLib.placeImg(g, 0, 20, 20, dthis);
}

}
8 changes: 4 additions & 4 deletions src/com/jslix/image/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,19 +40,19 @@ Java2D gives a lot of weird options, like allowing you to determine the backgrou

## Testing Grounds

- [ ] Make a Testing file [Java]
- [ ] Make a Testing file [JavaScript]
- [x] Make a Testing file [Java]
- [x] Make a Testing file [JavaScript]

### Draw functions

- [ ] Verify the placeImg functionality is working [Java]
- [x] Verify the placeImg functionality is working [Java]
- [ ] Verify the drawImg functionality is working [Java]
- [ ] Verify the placeCropImg functionality is working [Java]
- [ ] Verify the drawCropImg functionality is working [Java]
- [ ] Verify the placeCutImg functionality is working [Java]
- [ ] Verify the drawCutImg functionality is working [Java]

- [ ] Verify the placeImg functionality is working [JavaScript]
- [x] Verify the placeImg functionality is working [JavaScript]
- [ ] Verify the drawImg functionality is working [JavaScript]
- [ ] Verify the placeCropImg functionality is working [JavaScript]
- [ ] Verify the drawCropImg functionality is working [JavaScript]
Expand Down
17 changes: 17 additions & 0 deletions testbed.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
import { input, state, loop, view } from "./engine/screenstate.js"
import * as jslix from "./engine/js/jslix.js"

// Playground for testing out the features in the code

export function init(){
jslix.addImage("./cwtargetapp.png")
}

export function update(){

}

export function render(canvas, ctx){
ctx.drawImage(jslix.getImg(0), 10, 10);
jslix.placeImg(ctx, 0, 20, 20);
}

0 comments on commit 182a5f6

Please sign in to comment.