add base snes_color for clib
This commit is contained in:
@@ -1,25 +1,16 @@
|
|||||||
#ifndef YAZE_APP_GFX_SNES_COLOR_H_
|
#ifndef YAZE_APP_GFX_SNES_COLOR_H_
|
||||||
#define YAZE_APP_GFX_SNES_COLOR_H_
|
#define YAZE_APP_GFX_SNES_COLOR_H_
|
||||||
|
|
||||||
#include "imgui/imgui.h"
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "base/snes_color.h"
|
||||||
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
namespace gfx {
|
namespace gfx {
|
||||||
|
|
||||||
/**
|
|
||||||
* @brief Primitive of 16-bit RGB SNES color.
|
|
||||||
*/
|
|
||||||
struct snes_color {
|
|
||||||
uint16_t red; /**< Red component of the color. */
|
|
||||||
uint16_t blue; /**< Blue component of the color. */
|
|
||||||
uint16_t green; /**< Green component of the color. */
|
|
||||||
};
|
|
||||||
typedef struct snes_color snes_color;
|
|
||||||
|
|
||||||
snes_color ConvertSNEStoRGB(uint16_t snes_color);
|
snes_color ConvertSNEStoRGB(uint16_t snes_color);
|
||||||
uint16_t ConvertRGBtoSNES(const snes_color& color);
|
uint16_t ConvertRGBtoSNES(const snes_color& color);
|
||||||
uint16_t ConvertRGBtoSNES(const ImVec4& color);
|
uint16_t ConvertRGBtoSNES(const ImVec4& color);
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
#include "snes_palette.h"
|
#include "snes_palette.h"
|
||||||
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#include "imgui/imgui.h"
|
|
||||||
|
|
||||||
#include <cstdint>
|
#include <cstdint>
|
||||||
#include <cstdlib>
|
#include <cstdlib>
|
||||||
@@ -15,6 +14,7 @@
|
|||||||
#include "absl/status/statusor.h"
|
#include "absl/status/statusor.h"
|
||||||
#include "app/core/constants.h"
|
#include "app/core/constants.h"
|
||||||
#include "app/gfx/snes_color.h"
|
#include "app/gfx/snes_color.h"
|
||||||
|
#include "imgui/imgui.h"
|
||||||
|
|
||||||
namespace yaze {
|
namespace yaze {
|
||||||
namespace app {
|
namespace app {
|
||||||
@@ -307,7 +307,7 @@ SnesPalette ReadPaletteFromRom(int offset, int num_colors, const uchar* rom) {
|
|||||||
|
|
||||||
while (color_offset < num_colors) {
|
while (color_offset < num_colors) {
|
||||||
short color = (ushort)((rom[offset + 1]) << 8) | rom[offset];
|
short color = (ushort)((rom[offset + 1]) << 8) | rom[offset];
|
||||||
gfx::snes_color new_color;
|
snes_color new_color;
|
||||||
new_color.red = (color & 0x1F) * 8;
|
new_color.red = (color & 0x1F) * 8;
|
||||||
new_color.green = ((color >> 5) & 0x1F) * 8;
|
new_color.green = ((color >> 5) & 0x1F) * 8;
|
||||||
new_color.blue = ((color >> 10) & 0x1F) * 8;
|
new_color.blue = ((color >> 10) & 0x1F) * 8;
|
||||||
|
|||||||
24
src/base/snes_color.h
Normal file
24
src/base/snes_color.h
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
#ifndef YAZE_BASE_SNES_COLOR_H_
|
||||||
|
#define YAZE_BASE_SNES_COLOR_H_
|
||||||
|
|
||||||
|
#include <cstdint>
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Primitive of 16-bit RGB SNES color.
|
||||||
|
*/
|
||||||
|
struct snes_color {
|
||||||
|
uint16_t red; /**< Red component of the color. */
|
||||||
|
uint16_t blue; /**< Blue component of the color. */
|
||||||
|
uint16_t green; /**< Green component of the color. */
|
||||||
|
};
|
||||||
|
typedef struct snes_color snes_color;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // YAZE_BASE_SNES_COLOR_H_
|
||||||
Reference in New Issue
Block a user