Skip to content

Commit

Permalink
First Commit
Browse files Browse the repository at this point in the history
  • Loading branch information
ClickerMonkey committed Apr 9, 2017
0 parents commit ee39a0b
Show file tree
Hide file tree
Showing 318 changed files with 35,718 additions and 0 deletions.
10 changes: 10 additions & 0 deletions .classpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>
<classpathentry kind="lib" path="libs/azzet-1.0-src.jar"/>
<classpathentry kind="lib" path="libs/reflector-1.0-src.jar"/>
<classpathentry kind="con" path="org.eclipse.jdt.junit.JUNIT_CONTAINER/4"/>
<classpathentry kind="output" path="bin"/>
</classpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bin/
17 changes: 17 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>axengine</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.jdt.core.javabuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
</projectDescription>
11 changes: 11 additions & 0 deletions .settings/org.eclipse.jdt.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
eclipse.preferences.version=1
org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.8
org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
org.eclipse.jdt.core.compiler.compliance=1.8
org.eclipse.jdt.core.compiler.debug.lineNumber=generate
org.eclipse.jdt.core.compiler.debug.localVariable=generate
org.eclipse.jdt.core.compiler.debug.sourceFile=generate
org.eclipse.jdt.core.compiler.problem.assertIdentifier=error
org.eclipse.jdt.core.compiler.problem.enumIdentifier=error
org.eclipse.jdt.core.compiler.source=1.8
171 changes: 171 additions & 0 deletions DESIGN.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,171 @@
# Design 2.0

## Concepts

- Node = a container or entity
- Scenes = contains a root node to draw & update
- Camera = a perspective in a scene
- View = a rectangular section on a window to render a scene from a camera's perspective
- Window = a place where one or more views are drawn
- Renderer = handles drawing a node
- Game = one or more windows

## Generic Types

- V = Vector
- A = Attribute
- T = any generic type
- E = enum
- I = input
- L = listener
- C = camera
- S = scene

## Structure

- Game
- Scenes
- Windows
- Views
- Camera
- Scene

## Design

- Game
- loop (the logic which defines how often updates & renders are performed)
- state (time data since last update, updated by loop)
- listeners (start, draw start, draw end, update start, update end, stop)
- settings (ie. opengl settings)
- input (key, mouse, controllers)
- scenes
- windows
- `start()`
- `stop()`
- Scene
- root node
- `draw(state, camera, view)`
- `update(state, mouse, key)`
- Window
- listeners (resize, focus, blur, close request, draw start, draw end)
- state (active, hidden, request close)
- state methods (stop, hide, show, minimize, maximize, focus)
- title
- fullscreen
- position
- dimension (pixel vs framebuffer)
- resizable
- vsync
- frame rate
- resolution (framebuffer dimensions / pixel)

## Implementation

```
start_game() {
trigger game start events
initialize loop algorithm
initialize windows
while (playing) {
handle window events (request close, hiding)
if all windows are closed, no longer playing
if all windows hidden, pause X millis and continue
handle window events (blur, focus)
process input events
update input systems
run loop algorithm and determine how many updates are needed and if a draw is needed
for each update needed {
trigger game update start event
update scenes (state, input)
trigger game update end event
}
if updates needed {
clear input systems
}
if draw needed {
trigger game draw start event
for each window {
clear window buffer
trigger window draw start event
for each view {
draw scene on view with camera's perspective
}
trigger window draw end event
render window buffer
}
trigger game draw end event
}
}
trigger game stop event
destroy input
destroy windows
destroy game
}
```

## Example

```java
AxeLWJGL.init();

GameSettings gameSettings = new GameSettingsLWJGL(2, 1);
Game game = Axe.game.create( gameSettings );

Scene3 scene3 = new Scene3();
// populate scene3
game.addScene( scene3 );

Scene scene2 = new Scene2();
// populate scene2
game.addScene( scene2 );

WindowSettings windowSettings = new WindowSettings(640, 480);
Window window = game.newWindow( windowSettings );

Camera2 camera2 = new Camera2();
View view2 = window.newView(scene2, camera2);
view2.maximize();

Camera3 camera3 = new Camera3();
View view3 = window.newView(scene3, camera3);
view3.maximize();

```

### Ideas

- You can have objects which draw more frequently then they update - send interpolation data to draw method
- Handling Input
- Every frame - accumulate input into input state.
- Input is applied at a frequency (every update, or at X FPS)
- Apply the input to the state then clear the input state
- InputState modifies next EntityState which affects DrawState


### Todo

- Fix mouse projection
- Finish calculator
- Modify Attribute by adding getCalculator and all default methods
X Implement default methods in Texture
X Implement TextureLWJGL
- Copy over Audio classes (implement AudioLWJGL)
- Copy over Font classes (implement FontLWJGL)
X Create Shader interface
X Create VertexBuffer interface
X Create ShaderLWJGL
X Create VertexBufferLWJGL Axe.graphics.newVertexBuffer(format, size)
- formats will have an ID so vertex buffers can be reused
- Add Version class
- Files
- Net (http)
- Application (os, version, preferences, clipboard,


- 2d hash scales = 1, 46340
- 3d hash scales = 1, 1290, 1664100
- 4d hash scales = 1, 215, 46225, 9938375
- 5d hash scales = 1, 73, 5404, 397336, 29210829
- 6d hash scales = 1, 36, 1296, 46656, 1679616, 60466176
- 8d hash scales = 1, 14, 196, 2744, 38416, 537824, 7529536, 105413504
- 9d hash scales = 1, 10, 100, 1000, 10000, 100000, 1000000, 10000000, 100000000
Binary file added libs/azzet-1.0-src.jar
Binary file not shown.
Binary file added libs/reflector-1.0-src.jar
Binary file not shown.
23 changes: 23 additions & 0 deletions src/com/axe/AbstractCamera.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package com.axe;

import com.axe.core.HasData;
import com.axe.math.Vec;

public abstract class AbstractCamera<V extends Vec<V>> implements Camera<V>, HasData
{

public Object data;

@Override
public <T> T getData()
{
return (T) data;
}

@Override
public void setData(Object data)
{
this.data = data;
}

}
57 changes: 57 additions & 0 deletions src/com/axe/AbstractScene.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
package com.axe;

import com.axe.collect.ListItem;
import com.axe.math.Vec;
import com.axe.node.Node;

public class AbstractScene<V extends Vec<V>> implements Scene<V>
{

public ListItem listItem;
public Object data;
public Node<V> root;
public View<V> view;

@Override
public void setListItem(ListItem listItem)
{
this.listItem = listItem;
}

@Override
public <T> T getData()
{
return (T) data;
}

@Override
public void setData(Object data)
{
this.data = data;
}

@Override
public Node<V> getRoot()
{
return root;
}

@Override
public void setRoot(Node<V> root)
{
this.root = root;
}

@Override
public View<V> getView()
{
return view;
}

@Override
public void setView(View<V> view)
{
this.view = view;
}

}
52 changes: 52 additions & 0 deletions src/com/axe/AbstractView.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
package com.axe;

import com.axe.collect.ListItem;
import com.axe.math.Vec;
import com.axe.ui.Placement;
import com.axe.window.Window;

public abstract class AbstractView<V extends Vec<V>> implements View<V>
{

public ListItem listItem;
public Window window;
public Placement placement;
public Object data;

public AbstractView(Window window)
{
this.window = window;
this.placement = Placement.maximized();
}

@Override
public void setListItem(ListItem listItem)
{
this.listItem = listItem;
}

@Override
public Placement getPlacement()
{
return placement;
}

@Override
public Window getWindow()
{
return window;
}

@Override
public <T> T getData()
{
return (T) data;
}

@Override
public void setData(Object data)
{
this.data = data;
}

}
Loading

0 comments on commit ee39a0b

Please sign in to comment.