Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdlib.h>
- #include <stdio.h>
- #include "cab202_graphics.h"
- #include "cab202_sprites.h"
- #define SPRITE_X 200
- #define SPRITE_Y 200
- sprite_id get_sprite() {
- int char_count = SPRITE_X * SPRITE_Y;
- char* buffer = malloc(char_count * sizeof(char));
- if (buffer == NULL) {
- printf("%s", "No memory!");
- abort();
- }
- for (int a = 0; a < char_count; a++) {
- buffer[a] = ((a % 2) == 0) ? '-' : '|';
- }
- return create_sprite(0, 0, SPRITE_X, SPRITE_Y, buffer);
- }
- int main() {
- sprite_id sprite = NULL;
- setup_screen();
- clear_screen();
- for (int i = 0; i < 100000; i++) {
- sprite = get_sprite();
- destroy_sprite(sprite);
- }
- draw_string(0, 0, "Press any key to exit...");
- show_screen();
- wait_char();
- cleanup_screen();
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement