tweaked framerate
This commit is contained in:
@@ -2,7 +2,7 @@ import standard;
|
||||
import node;
|
||||
|
||||
//constants
|
||||
var SPEED: int const = 2;
|
||||
var SPEED: int const = 4;
|
||||
|
||||
var SPRITE_WIDTH: int const = 64;
|
||||
var SPRITE_HEIGHT: int const = 64;
|
||||
@@ -98,7 +98,7 @@ fn onInit(node: opaque) {
|
||||
}
|
||||
|
||||
fn onStep(node: opaque) {
|
||||
if (++stepCount >= 10) {
|
||||
if (++stepCount >= 5) {
|
||||
node.incrementCurrentNodeFrame();
|
||||
stepCount = 0;
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ import standard;
|
||||
import node;
|
||||
|
||||
//constants
|
||||
var SPEED: int const = 2;
|
||||
var SPEED: int const = 4;
|
||||
|
||||
var SPRITE_WIDTH: int const = 64;
|
||||
var SPRITE_HEIGHT: int const = 64;
|
||||
@@ -27,7 +27,7 @@ var inputX: int = 0; //cache the keyboard input
|
||||
var inputY: int = 0;
|
||||
|
||||
var direction: int = null; //BUGFIX: animation not looping properly
|
||||
var enableMovementCounter: int = 60 * 4; //BUGFIX: freeze while drones reach their starting spot
|
||||
var enableMovementCounter: int = 30 * 3; //BUGFIX: freeze while drones reach their starting spot
|
||||
|
||||
|
||||
//polyfills - animating different cycles on one image
|
||||
@@ -155,7 +155,7 @@ fn onStep(node: opaque) {
|
||||
node.setCurrentNodeFrame(0);
|
||||
}
|
||||
|
||||
if (++stepCount >= 10) {
|
||||
if (++stepCount >= 5) {
|
||||
node.incrementCurrentNodeFrame();
|
||||
stepCount = 0;
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ fn onInit(node: opaque) {
|
||||
}
|
||||
|
||||
fn onStep(node: opaque) {
|
||||
if (++stepCounter >= 60) {
|
||||
print "FPS: " + string drawCounter + " / 60";
|
||||
if (++stepCounter >= 30) {
|
||||
print "FPS: " + string drawCounter + " / 30";
|
||||
stepCounter = 0;
|
||||
drawCounter = 0;
|
||||
}
|
||||
|
||||
@@ -27,8 +27,11 @@
|
||||
mapInputEventToKeyUp("character_right", "right"); //event, keysym
|
||||
|
||||
|
||||
//TODO: escape to kill the game
|
||||
|
||||
|
||||
//this function must always be called, or the engine won't run
|
||||
initWindow("Skyland", 1080, 720, false);
|
||||
initWindow("Skyland", 32*16, 32*16, false); //TODO: custom FPS setting
|
||||
|
||||
//kick off the logic of the scene graph
|
||||
loadRootNode("scripts:/gameplay/scene.toy");
|
||||
|
||||
@@ -412,7 +412,7 @@ void Box_execEngine() {
|
||||
//set up time
|
||||
engine.realTime = clock();
|
||||
engine.simTime = engine.realTime;
|
||||
clock_t delta = (double) CLOCKS_PER_SEC / 60.0;
|
||||
clock_t delta = (double) CLOCKS_PER_SEC / 30.0;
|
||||
|
||||
while (engine.running) {
|
||||
execLoadRootNode();
|
||||
@@ -432,8 +432,8 @@ void Box_execEngine() {
|
||||
}
|
||||
|
||||
//render the world
|
||||
SDL_SetRenderDrawColor(engine.renderer, 128, 128, 128, 255); //NOTE: This line can be disabled later
|
||||
SDL_RenderClear(engine.renderer); //NOTE: This line can be disabled later
|
||||
//SDL_SetRenderDrawColor(engine.renderer, 128, 128, 128, 255); //NOTE: This line can be disabled later
|
||||
//SDL_RenderClear(engine.renderer); //NOTE: This line can be disabled later
|
||||
|
||||
Box_callRecursiveEngineNode(engine.rootNode, &engine.interpreter, "onDraw", NULL);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user