Save as dialog, and confirm save dialog.
[cantaveria.git] / inner.c
blob31def99848794ab016191bb295232611829af09b
1 #include <stdio.h>
2 #include <stdlib.h>
5 //#include <root.h>
7 #include <list.h>
8 #include <util.h>
10 #include <input.h>
11 //#include <entity.h>
12 #include <transfer.h>
13 #include <gameover.h>
15 #include <console.h>
17 #include <stage.h>
18 #include <camera.h>
19 #include <hud.h>
21 static void update(){
22 /*
23 update camera
24 update every entity in the update list
25 dispatch collision events
26 execute spawn and delete events
30 static void draw(){
31 int cx = camera_x();
32 int cy = camera_y();
33 //stage_draw_bg(cx, cy);
34 //entity_draw_visible(cx, cy);
35 //stage_draw_fg(cx, cy);
36 hud_draw(cx, cy);
39 static void press(input in){
40 if(in.button == ESCAPE_KEY){
41 game_is_over();
42 return;
44 printf("press: %s\n", input_str(in));
47 send input events
51 static void release(input in){
52 printf("release: %s\n", input_str(in));
55 send input events
59 void setup_inner(){
60 /* create entities */
61 console_clear();
62 set_handler(update, draw, press, release);
65 unload_zone();
66 int x = load_zone("3ztest");
67 if(x < 0){
68 error_msg("inner: cannot load zone\n");
69 exit(-1);
71 else{
72 //print_zone(x);
73 stage_debug();
74 unload_zone();
87 stage - the stage, collision with stage, stage events
88 entity - moving, colliding, active/inactive stuff
89 inner - update draw press release
93 this is the inner file
94 the starting point to the internal game workings
95 independent of i/o, game loops, or graphics details
97 draw - draw the current state of the game
98 use current camera pos to...
99 draw the stage, efficiently draws the tiles and background
100 draw visible entities
101 draw effects
102 draw foreground decorations
103 draw gui elements
105 update -
106 move entities / execute collision
107 update camera
108 deactivate certain entities
110 press -
111 do global actions like pause, open menu
112 do player specific actions
114 setup -