-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
0c41285
commit a185cc1
Showing
16 changed files
with
1,723 additions
and
1,222 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,108 @@ | ||
#ifndef DRAW_H | ||
#define DRAW_H | ||
#include <3ds.h> | ||
#include <sf2d.h> | ||
#include "settings.h" | ||
#include "main_data.h" | ||
#include "level.h" | ||
#include "lemming_data.h" | ||
|
||
// data structure for RGB image. | ||
// (almost) all game graphics are drawn to this data structure before a sf2dtexture will be created from it. | ||
struct RGB_Image { | ||
s16 width; | ||
s16 height; | ||
u32 data[0]; | ||
}; | ||
typedef enum | ||
{ | ||
TOP_SCREEN = 0, | ||
BOTTOM_SCREEN = 1, | ||
TOP_SCREEN_BACK = 2, | ||
BOTTOM_SCREEN_BACK = 3 | ||
} ScreenBuffer; | ||
|
||
// scale with linear interpolation (sf2d seems o scale without interpolation) | ||
void scale(struct RGB_Image* dest, float factor, struct RGB_Image* source); | ||
void init_drawing(); | ||
|
||
void begin_frame(); | ||
void end_frame(); | ||
|
||
// apply fading to palette (not its alpha value, since gfx seems to ignore alpha value) | ||
void fade_palette(u32 palette[16], float fading); | ||
|
||
// scale with linear interpolation | ||
int draw_scaled( | ||
ScreenBuffer screen, | ||
s16 x, | ||
s16 y, | ||
const u8* img, | ||
u16 w, | ||
u16 h, | ||
u32 palette[16], | ||
float scaling); | ||
|
||
int clear(ScreenBuffer screen); | ||
int clear_rectangle(ScreenBuffer screen, u16 x, u16 y, u16 w, u16 h); | ||
void copy_from_backbuffer(ScreenBuffer screen); | ||
|
||
// draw palette image into RGB image at specific position | ||
int draw(struct RGB_Image* image, u32 palette[16], const u8* img, s16 x, s16 y, u16 w, u16 h); | ||
int draw(ScreenBuffer screen, s16 x, s16 y, const u8* img, u16 w, u16 h, u32 palette[16]); | ||
|
||
// draw menu background into im_bottom (tiled) | ||
void tile_menu_background(ScreenBuffer screen, struct MainMenuData* menu_data); | ||
|
||
// draw level view at top of RGB image while (without info text, toolbar, and lemmings) | ||
int draw_level(struct RGB_Image* image, struct Level* level); | ||
int draw_level( | ||
ScreenBuffer screen, | ||
s16 x, | ||
s16 y, | ||
u16 w, | ||
u16 h, | ||
struct Level* level, | ||
struct Lemming lemmings[MAX_NUM_OF_LEMMINGS], | ||
struct MainInGameData* main_data, | ||
u32* palette); | ||
|
||
|
||
// draw a string using highperf-font into an RGB image | ||
void draw_highperf_text(struct RGB_Image* image, struct MainInGameData* data, | ||
s16 y_offset, const char* text); | ||
void draw_highperf_text( | ||
ScreenBuffer screen, | ||
s16 x, | ||
s16 y, | ||
struct MainInGameData* data, | ||
const char* text, | ||
u32* highperf_palette); | ||
|
||
// draw a string using menu-font into an RGB image | ||
void draw_menu_text(struct RGB_Image* image, struct MainMenuData* data, | ||
s16 x_offset, s16 y_offset, const char* text); | ||
void draw_menu_text( | ||
ScreenBuffer screen, | ||
struct MainMenuData* data, | ||
s16 x_offset, | ||
s16 y_offset, | ||
const char* text, | ||
u32* palette); | ||
|
||
// draw a string using scaled (interpolated) menu-font into an RGB image | ||
void draw_menu_text_small(struct RGB_Image* image, struct MainMenuData* data, | ||
s16 x_offset, s16 y_offset, const char* text); | ||
void draw_menu_text_small( | ||
ScreenBuffer screen, | ||
struct MainMenuData* data, | ||
s16 x_offset, | ||
s16 y_offset, | ||
const char* text, | ||
u32* palette); | ||
|
||
// draw toolbar at bottom of RGB image | ||
int draw_toolbar(struct RGB_Image* image, struct MainInGameData* data, | ||
struct Level* level, struct LevelState* state, | ||
struct Lemming[MAX_NUM_OF_LEMMINGS], const char* text); | ||
int draw_toolbar( | ||
struct MainInGameData* data, | ||
struct Level* level, | ||
struct LevelState* state, | ||
struct Lemming[MAX_NUM_OF_LEMMINGS], | ||
const char* text, | ||
u32* highperf_palette); | ||
|
||
// return number of lemmings drawn | ||
u8 draw_lemmings(struct Lemming[MAX_NUM_OF_LEMMINGS], struct Image* lemmings_anim[337], struct Image* masks[23], u32 palette[16], struct RGB_Image* image, u16 x_offset); | ||
|
||
// draw menu background into im_bottom (tiled) | ||
void tile_menu_background(struct RGB_Image* im_bottom, struct MainMenuData* menu_data); | ||
u8 draw_lemmings( | ||
ScreenBuffer screen, | ||
s16 x, | ||
s16 y, | ||
struct Lemming[MAX_NUM_OF_LEMMINGS], | ||
struct Image* lemmings_anim[337], | ||
struct Image* masks[23], | ||
u32 palette[16], | ||
s16 x_offset, | ||
s16 y_offset); | ||
|
||
int draw_topscreen(struct MainMenuData* menu, struct RGB_Image* im_top, sf2d_texture** texture_top_screen, struct RGB_Image* logo_scaled, sf2d_texture** texture_logo); | ||
int update_topscreen(struct MainMenuData* menu); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
#ifndef MAIN_H | ||
#define MAIN_H | ||
int was_suspended(); | ||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.