Compare commits
4 Commits
fe444fc0ec
...
master
| Author | SHA1 | Date | |
|---|---|---|---|
| c833527d60 | |||
| 2b93e224bb | |||
| e1518cf76f | |||
| 19df09dddc |
2
.gitignore
vendored
2
.gitignore
vendored
@@ -1,12 +1,14 @@
|
||||
syntax: glob
|
||||
|
||||
pepe
|
||||
pepe_debug
|
||||
recursos/*
|
||||
bin/*
|
||||
obj/*
|
||||
Debug/*
|
||||
Release/*
|
||||
data/*
|
||||
build/*
|
||||
*.suo
|
||||
*.sdf
|
||||
*.opensdf
|
||||
|
||||
2
Makefile
Normal file
2
Makefile
Normal file
@@ -0,0 +1,2 @@
|
||||
build:
|
||||
g++ -g *.cpp -lSDL2 -lSDL2_mixer -o pepe_debug
|
||||
@@ -434,6 +434,9 @@ static unsigned char* process_gif_stream(unsigned char *buffer, unsigned short*
|
||||
// sizeof( screen_descriptor_t ) = 8!
|
||||
READ(&screen_descriptor, 7);
|
||||
|
||||
if (w) *w = screen_descriptor.width;
|
||||
if (h) *h = screen_descriptor.height;
|
||||
|
||||
color_resolution_bits = ( ( screen_descriptor.fields & 0x70 ) >> 4 ) + 1;
|
||||
|
||||
if ( screen_descriptor.fields & 0x80 )
|
||||
36
jdraw8.cpp
36
jdraw8.cpp
@@ -1,7 +1,7 @@
|
||||
#include "jdraw8.h"
|
||||
#include "jfile.h"
|
||||
#include <fstream>
|
||||
#include "gif.c"
|
||||
#include "gif.h"
|
||||
|
||||
#ifdef GCWZERO
|
||||
#define SCREEN_WIDTH 320
|
||||
@@ -27,15 +27,15 @@ SDL_Renderer* sdlRenderer = NULL;
|
||||
SDL_Texture* sdlTexture = NULL;
|
||||
|
||||
void JD8_Init(const char *title) {
|
||||
screen = (JD8_Surface)calloc( 1, 64000 );
|
||||
main_palette = (JD8_Palette)calloc( 1, 768 );
|
||||
screen = (JD8_Surface)calloc( 1, 320 * 200 );
|
||||
main_palette = (JD8_Palette)calloc( 1, 256 * sizeof(uint32_t) );
|
||||
pixel_data = (Uint32*)calloc(1, 320 * 200 * 4); // 1048576 );
|
||||
|
||||
sdlWindow = SDL_CreateWindow( title, SDL_WINDOWPOS_UNDEFINED, SDL_WINDOWPOS_UNDEFINED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
||||
sdlWindow = SDL_CreateWindow( title, SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED, SCREEN_WIDTH, SCREEN_HEIGHT, SDL_WINDOW_SHOWN );
|
||||
sdlRenderer = SDL_CreateRenderer(sdlWindow, -1, 0);
|
||||
SDL_SetHint(SDL_HINT_RENDER_SCALE_QUALITY, "nearest");
|
||||
|
||||
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ABGR8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||
sdlTexture = SDL_CreateTexture(sdlRenderer, SDL_PIXELFORMAT_ARGB8888, SDL_TEXTUREACCESS_STREAMING, 320, 200);
|
||||
}
|
||||
|
||||
void JD8_Quit() {
|
||||
@@ -50,9 +50,9 @@ void JD8_ClearScreen(Uint8 color) {
|
||||
memset( screen, color, 64000 );
|
||||
}
|
||||
|
||||
JD8_Surface JD8_NewSurface() {
|
||||
JD8_Surface surface = (JD8_Surface)malloc( 64000 );
|
||||
memset( surface, 0, 64000 );
|
||||
JD8_Surface JD8_NewSurface(const int w, const int h) {
|
||||
JD8_Surface surface = (JD8_Surface)malloc( w * h );
|
||||
memset( surface, 0, w*h );
|
||||
return surface;
|
||||
}
|
||||
|
||||
@@ -70,8 +70,8 @@ JD8_Surface JD8_LoadSurface(const char *file) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
JD8_Surface image = JD8_NewSurface();
|
||||
memcpy(image, pixels, 64000);
|
||||
JD8_Surface image = JD8_NewSurface(w, h);
|
||||
memcpy(image, pixels, w * h);
|
||||
|
||||
free(pixels);
|
||||
return image;
|
||||
@@ -82,8 +82,15 @@ JD8_Palette JD8_LoadPalette(const char *file) {
|
||||
char *buffer = NULL;
|
||||
buffer = JF_GetBufferFromResource(file, filesize);
|
||||
|
||||
JD8_Palette palette = (JD8_Palette)LoadPalette((unsigned char*)buffer);
|
||||
uint8_t *pal = LoadPalette((unsigned char*)buffer);
|
||||
|
||||
JD8_Palette palette = (JD8_Palette)malloc(256 * sizeof(uint32_t));
|
||||
for (int i=0; i<256; ++i) {
|
||||
palette[i].r = pal[i*3];
|
||||
palette[i].g = pal[1 + i*3];
|
||||
palette[i].b = pal[2 + i*3];
|
||||
//palette[i].hex = 0xff0000;
|
||||
}
|
||||
return palette;
|
||||
}
|
||||
|
||||
@@ -173,12 +180,7 @@ void JD8_BlitCKToSurface(int x, int y, JD8_Surface surface, int sx, int sy, int
|
||||
SDL_Rect rect{0, 0, SCREEN_WIDTH, SCREEN_HEIGHT};
|
||||
|
||||
void JD8_Flip() {
|
||||
for( int x = 0; x < 320; x++ ) {
|
||||
for( int y = 0; y < 200; y++ ) {
|
||||
Uint32 color = 0xFF000000 + main_palette[screen[x + ( y * 320 )]].r + ( main_palette[screen[x + ( y * 320 )]].g << 8 ) + ( main_palette[screen[x + ( y * 320 )]].b << 16 );
|
||||
pixel_data[x + ( y * 320 )] = color;
|
||||
}
|
||||
}
|
||||
for (int i=0; i<64000; ++i) pixel_data[i] = main_palette[screen[i]].hex;
|
||||
SDL_UpdateTexture(sdlTexture, NULL, pixel_data, 320 * sizeof(Uint32));
|
||||
SDL_RenderCopy(sdlRenderer, sdlTexture, NULL, &rect);
|
||||
SDL_RenderPresent(sdlRenderer);
|
||||
|
||||
11
jdraw8.h
11
jdraw8.h
@@ -1,10 +1,11 @@
|
||||
#pragma once
|
||||
#include <SDL2/SDL.h>
|
||||
|
||||
struct Color {
|
||||
Uint8 r;
|
||||
Uint8 g;
|
||||
Uint8 b;
|
||||
union Color {
|
||||
struct {
|
||||
uint8_t b, g, r, a;
|
||||
};
|
||||
uint32_t hex;
|
||||
};
|
||||
|
||||
typedef Uint8* JD8_Surface;
|
||||
@@ -16,7 +17,7 @@ void JD8_Quit();
|
||||
|
||||
void JD8_ClearScreen(Uint8 color);
|
||||
|
||||
JD8_Surface JD8_NewSurface();
|
||||
JD8_Surface JD8_NewSurface(const int w, const int h);
|
||||
|
||||
JD8_Surface JD8_LoadSurface(const char *file);
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
#include "jsound.h"
|
||||
#include "jfile.h"
|
||||
#include <string>
|
||||
|
||||
Mix_Music *music = NULL;
|
||||
char currentMusic[12];
|
||||
|
||||
5
lagueirtofile
Normal file
5
lagueirtofile
Normal file
@@ -0,0 +1,5 @@
|
||||
libs = -lSDL2 -lSDL2_mixer
|
||||
cppflags = -D DEBUG -g
|
||||
executable = pepe_debug
|
||||
sourcepath = .
|
||||
buildpath = build
|
||||
1
main.cpp
1
main.cpp
@@ -5,7 +5,6 @@
|
||||
#include "info.h"
|
||||
#include "modules.h"
|
||||
#include "time.h"
|
||||
#include <string>
|
||||
|
||||
#ifndef WIN32
|
||||
#include <libgen.h>
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
#include "jinput.h"
|
||||
#include "jsound.h"
|
||||
#include <stdlib.h>
|
||||
#include <string>
|
||||
#include "info.h"
|
||||
|
||||
namespace module
|
||||
@@ -57,7 +56,7 @@ namespace module
|
||||
{
|
||||
bool eixir = false;
|
||||
|
||||
fondo_temp = JD8_NewSurface();
|
||||
fondo_temp = JD8_NewSurface(320, 200);
|
||||
JD8_BlitToSurface(0, 0, fondo, 0, 0, 320, 200, fondo_temp);
|
||||
JD8_Blit(fondo_temp);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user