Fixed warning about console.h in inner.c
[cantaveria.git] / inner.c
blob17e3416060bf441dbdd1dfb7d91c68693fd6e800
1 #include <stdio.h>
4 #include <root.h>
5 #include <video.h>
7 #include <list.h>
9 #include <input.h>
10 //#include <entity.h>
11 #include <transfer.h>
13 #include <console.h>
15 //int run(Y* y, int dt){
17 motion move = get(y->pc);
18 int passed = move(y->m, dt);
19 if(passed < dt){
20 advance(y);
21 return passed;
23 //return dt;
24 //}
26 void move(Y* y){
27 int t = QUANTUM;
28 while(t > 0){
29 int dt = QUANTUM;
30 dt = run(y, dt);
31 t -= dt;
32 //collision here
37 void show(Y* y){
38 y->draw(y);
41 static void update(){
42 /* list* ents = get_active_entities();
43 foreach(ents, move);*/
46 static void draw(){
47 //int x = camera_x();
48 //int y = camera_y();
49 //int w = screen_w();
50 //int h = screen_h();
51 /* list* ents = find_entities_in(x,y,w,h);
52 foreach(ents, show);*/
55 static void press(input in){
56 printf("press: %s\n", input_str(in));
58 check global keys
60 do player specific side effects
64 static void release(input in){
65 printf("release: %s\n", input_str(in));
68 void setup_inner(){
69 // create entities
70 console_clear();
71 set_handler(update, draw, press, release);
81 stage - the stage, collision with stage, stage events
82 entity - moving, colliding, active/inactive stuff
83 inner - update draw press release
87 this is the inner file
88 the starting point to the internal game workings
89 independent of i/o, game loops, or graphics details
91 draw - draw the current state of the game
92 use current camera pos to...
93 draw the stage, efficiently draws the tiles and background
94 draw visible entities
95 draw effects
96 draw foreground decorations
97 draw gui elements
99 update -
100 move entities / execute collision
101 update camera
102 deactivate certain entities
104 press -
105 do global actions like pause, open menu
106 do player specific actions
108 setup -