mirror of
https://github.com/encounter/cpp3ds.git
synced 2026-03-30 11:04:22 -07:00
Compare commits
30 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6ae6326595 | |||
| 13fb9ddc4d | |||
| 54dc1583aa | |||
| 44c33d2f07 | |||
| 47d3421fc0 | |||
| 8109485489 | |||
| 891e2dce18 | |||
| 49b368e352 | |||
| c897cd81a6 | |||
| 20345e31bc | |||
| 244fba8495 | |||
| b92cc01559 | |||
| 93210eb447 | |||
| 8be4e6664c | |||
| bfb17bec47 | |||
| 845369632d | |||
| aa18647d91 | |||
| a73da4c19e | |||
| b36b425915 | |||
| ecaf2b50d9 | |||
| 53eec38cc8 | |||
| 2ef849024f | |||
| 5c0cb16b60 | |||
| 2167fa7917 | |||
| f44db4f01c | |||
| dbb9b597c8 | |||
| 5383cac7a8 | |||
| e46d31acc7 | |||
| e87d589154 | |||
| 0c01a02baf |
@@ -1,6 +1,7 @@
|
|||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
set -ex
|
set -ex
|
||||||
|
|
||||||
|
# Copy all files needed in cpp3ds archive
|
||||||
mkdir -p $CPP3DS/bin/
|
mkdir -p $CPP3DS/bin/
|
||||||
cp $DEVKITARM/bin/makerom $CPP3DS/bin/
|
cp $DEVKITARM/bin/makerom $CPP3DS/bin/
|
||||||
cp $DEVKITARM/bin/3dsxtool $CPP3DS/bin/
|
cp $DEVKITARM/bin/3dsxtool $CPP3DS/bin/
|
||||||
@@ -8,4 +9,5 @@ cp $DEVKITARM/bin/bannertool $CPP3DS/bin/
|
|||||||
cp $DEVKITARM/bin/nihstro-assemble $CPP3DS/bin/
|
cp $DEVKITARM/bin/nihstro-assemble $CPP3DS/bin/
|
||||||
cp -r $PORTLIBS/lib/ $CPP3DS
|
cp -r $PORTLIBS/lib/ $CPP3DS
|
||||||
cp -r $PORTLIBS/include/ $CPP3DS
|
cp -r $PORTLIBS/include/ $CPP3DS
|
||||||
|
|
||||||
tar -cJvf $1 cpp3ds
|
tar -cJvf $1 cpp3ds
|
||||||
|
|||||||
+5
-1
@@ -12,9 +12,13 @@ script:
|
|||||||
|
|
||||||
before_deploy:
|
before_deploy:
|
||||||
- export RELEASE_FILENAME=cpp3ds-$TRAVIS_OS_NAME-$TRAVIS_TAG.tar.xz
|
- export RELEASE_FILENAME=cpp3ds-$TRAVIS_OS_NAME-$TRAVIS_TAG.tar.xz
|
||||||
- docker run --rm -v "$PWD":/usr/build -w /opt cpp3ds sh /usr/build/.build.sh /usr/build/$RELEASE_FILENAME
|
- docker run --rm -v "$PWD":/usr/build -w /usr/src cpp3ds sh /usr/build/.build.sh /usr/build/$RELEASE_FILENAME
|
||||||
- sudo chmod 777 $RELEASE_FILENAME
|
- sudo chmod 777 $RELEASE_FILENAME
|
||||||
|
|
||||||
|
after_success:
|
||||||
|
- docker run --rm -v "$PWD":/usr/build -w /usr/src/cpp3ds cpp3ds cp -r . /usr/build
|
||||||
|
- bash <(curl -s https://codecov.io/bash)
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
provider: releases
|
provider: releases
|
||||||
api_key:
|
api_key:
|
||||||
|
|||||||
+7
-3
@@ -9,6 +9,7 @@ include(cpp3ds)
|
|||||||
option(BUILD_EMULATOR "Build cpp3ds emulator (Qt5 required)" ON)
|
option(BUILD_EMULATOR "Build cpp3ds emulator (Qt5 required)" ON)
|
||||||
option(BUILD_EXAMPLES "Build all cpp3ds example projects" ON)
|
option(BUILD_EXAMPLES "Build all cpp3ds example projects" ON)
|
||||||
option(BUILD_DOCS "Build doxygen documentation" OFF)
|
option(BUILD_DOCS "Build doxygen documentation" OFF)
|
||||||
|
option(BUILD_TESTS "Build unit tests" OFF)
|
||||||
option(ENABLE_OGG "Include OGG encoder/decoder classes" ON)
|
option(ENABLE_OGG "Include OGG encoder/decoder classes" ON)
|
||||||
option(ENABLE_FLAC "Include FLAC encoder/decoder classes" OFF)
|
option(ENABLE_FLAC "Include FLAC encoder/decoder classes" OFF)
|
||||||
option(ENABLE_MP3 "Include MP3 decoder class" OFF)
|
option(ENABLE_MP3 "Include MP3 decoder class" OFF)
|
||||||
@@ -72,14 +73,17 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/bin")
|
|||||||
# compile flags
|
# compile flags
|
||||||
set(ARCH "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft")
|
set(ARCH "-march=armv6k -mtune=mpcore -mfloat-abi=hard -mtp=soft")
|
||||||
set(CPP3DS_ARM_FLAGS "-g -O2 ${ARCH} -ffunction-sections -fdata-sections")
|
set(CPP3DS_ARM_FLAGS "-g -O2 ${ARCH} -ffunction-sections -fdata-sections")
|
||||||
set(CPP3DS_TEST_FLAGS "-g -O2")
|
set(CPP3DS_TEST_FLAGS "-g -O2 -coverage")
|
||||||
set(CPP3DS_EMU_FLAGS "-g -O2")
|
set(CPP3DS_EMU_FLAGS "-g -O2")
|
||||||
|
|
||||||
|
add_subdirectory(src)
|
||||||
|
|
||||||
if(BUILD_EXAMPLES)
|
if(BUILD_EXAMPLES)
|
||||||
add_subdirectory(examples)
|
add_subdirectory(examples)
|
||||||
endif()
|
endif()
|
||||||
if(BUILD_DOCS)
|
if(BUILD_DOCS)
|
||||||
add_subdirectory(doc)
|
add_subdirectory(doc)
|
||||||
endif()
|
endif()
|
||||||
|
if(BUILD_TESTS)
|
||||||
add_subdirectory(src)
|
add_subdirectory(test)
|
||||||
|
endif()
|
||||||
|
|||||||
+12
-10
@@ -1,12 +1,13 @@
|
|||||||
FROM thecruel/devkitarm-3ds:latest
|
FROM thecruel/devkitarm-3ds:latest
|
||||||
MAINTAINER Thomas Edvalson "machin3@gmail.com"
|
MAINTAINER Thomas Edvalson "machin3@gmail.com"
|
||||||
|
|
||||||
ENV CPP3DS /opt/cpp3ds
|
ENV CPP3DS /usr/src/cpp3ds
|
||||||
|
|
||||||
COPY . /usr/src/cpp3ds
|
COPY . /usr/src/cpp3ds
|
||||||
WORKDIR /usr/src
|
WORKDIR /usr/src
|
||||||
|
|
||||||
RUN apt-get update && apt-get -y install \
|
RUN apt-get update && apt-get -y install \
|
||||||
|
libgtest-dev \
|
||||||
libsfml-dev \
|
libsfml-dev \
|
||||||
libglew-dev \
|
libglew-dev \
|
||||||
qt5-default \
|
qt5-default \
|
||||||
@@ -24,21 +25,22 @@ RUN wget -q https://github.com/cpp3ds/3ds_portlibs/releases/download/r3/portlibs
|
|||||||
ln -s $(pwd)/portlibs $DEVKITPRO/portlibs && \
|
ln -s $(pwd)/portlibs $DEVKITPRO/portlibs && \
|
||||||
ln -s $DEVKITPRO/portlibs/3ds $DEVKITPRO/portlibs/armv6k
|
ln -s $DEVKITPRO/portlibs/3ds $DEVKITPRO/portlibs/armv6k
|
||||||
|
|
||||||
RUN wget -q https://github.com/cpp3ds/3ds-tools/releases/download/r4/3ds-tools-linux-r4.tar.gz -O tools.tar.gz && \
|
RUN wget -q https://github.com/cpp3ds/3ds-tools/releases/download/r5/3ds-tools-linux-r5.tar.gz -O tools.tar.gz && \
|
||||||
tar -xaf tools.tar.gz && \
|
tar -xaf tools.tar.gz && \
|
||||||
cp 3ds-tools/* $DEVKITARM/bin && \
|
cp 3ds-tools/* $DEVKITARM/bin && \
|
||||||
rm tools.tar.gz
|
rm tools.tar.gz
|
||||||
|
|
||||||
|
WORKDIR /usr/src/gtest
|
||||||
|
RUN cmake . && \
|
||||||
|
make -j4 && \
|
||||||
|
cp *.a /usr/lib && \
|
||||||
|
make clean
|
||||||
|
|
||||||
WORKDIR /usr/src/cpp3ds
|
WORKDIR /usr/src/cpp3ds
|
||||||
RUN mkdir build && \
|
RUN mkdir build && \
|
||||||
cd build && \
|
cd build && \
|
||||||
cmake -DBUILD_EMULATOR=ON -DENABLE_OGG=ON -DBUILD_EXAMPLES=OFF .. && \
|
cmake -DBUILD_EMULATOR=ON -DENABLE_OGG=ON -DBUILD_EXAMPLES=OFF -DBUILD_TESTS=ON .. && \
|
||||||
make -j4 && \
|
make -j4 && \
|
||||||
|
mv lib .. && \
|
||||||
cd .. && \
|
cd .. && \
|
||||||
mkdir $CPP3DS && \
|
./bin/tests
|
||||||
cp -r build/lib $CPP3DS && \
|
|
||||||
cp -r include $CPP3DS && \
|
|
||||||
cp -r cmake $CPP3DS && \
|
|
||||||
cp -r scripts $CPP3DS && \
|
|
||||||
cd .. && \
|
|
||||||
rm -r cpp3ds
|
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
cpp3ds [](https://travis-ci.org/cpp3ds/cpp3ds)
|
cpp3ds
|
||||||
======
|
======
|
||||||
|
|
||||||
|
[](https://travis-ci.org/cpp3ds/cpp3ds) [](https://codecov.io/gh/cpp3ds/cpp3ds) [](https://hub.docker.com/r/thecruel/cpp3ds/) [](https://aur.archlinux.org/packages/cpp3ds-git/)
|
||||||
|
|
||||||
Basic C++ gaming framework and library for Nintendo 3DS.
|
Basic C++ gaming framework and library for Nintendo 3DS.
|
||||||
|
|
||||||
cpp3ds is essentially a barebones port of SFML with a parallel native 3ds emulator built on top of it. The goal is to completely abstract the developer from the hardware SDK and provide a nice object-oriented C++ framework for clean and easy coding. And the emulator is designed to provide a means of surface-level realtime debugging (with GDB or whatever you prefer).
|
cpp3ds is essentially a barebones port of SFML with a parallel native 3ds emulator built on top of it. The goal is to completely abstract the developer from the hardware SDK and provide a nice object-oriented C++ framework for clean and easy coding. And the emulator is designed to provide a means of surface-level realtime debugging (with GDB or whatever you prefer).
|
||||||
@@ -20,12 +22,14 @@ Requirements
|
|||||||
|
|
||||||
- DevkitARM
|
- DevkitARM
|
||||||
- ctrulib
|
- ctrulib
|
||||||
- [gl3ds](https://github.com/cpp3ds/gl3ds)
|
- citro3d
|
||||||
|
|
||||||
For emulator:
|
For emulator:
|
||||||
|
|
||||||
- [SFML 2.1](http://www.sfml-dev.org/index.php)
|
- [SFML 2.3](http://www.sfml-dev.org/index.php)
|
||||||
- [Qt 5](https://qt-project.org/)
|
- [Qt 5](https://qt-project.org/)
|
||||||
|
- OpenAL
|
||||||
|
- libvorbis
|
||||||
|
|
||||||
For unit tests:
|
For unit tests:
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,7 @@ SET(CMAKE_OBJCOPY ${DEVKITARM}/bin/arm-none-eabi-objcopy)
|
|||||||
SET(CMAKE_AR ${DEVKITARM}/bin/arm-none-eabi-ar)
|
SET(CMAKE_AR ${DEVKITARM}/bin/arm-none-eabi-ar)
|
||||||
SET(CMAKE_RANLIB ${DEVKITARM}/bin/arm-none-eabi-ranlib)
|
SET(CMAKE_RANLIB ${DEVKITARM}/bin/arm-none-eabi-ranlib)
|
||||||
|
|
||||||
set(CMAKE_FIND_ROOT_PATH ${DEVKITARM} ${DEVKITPRO} ${DEVKITPRO}/portlibs/3ds ${DEVKITPRO}/portlibs/armv6k)
|
set(CMAKE_FIND_ROOT_PATH $ENV{PORTLIBS}/3ds $ENV{PORTLIBS}/armv6k ${DEVKITARM} ${DEVKITPRO} ${DEVKITPRO}/portlibs/3ds ${DEVKITPRO}/portlibs/armv6k)
|
||||||
# adjust the default behaviour of the FIND_XXX() commands:
|
# adjust the default behaviour of the FIND_XXX() commands:
|
||||||
# search headers and libraries in the target environment, search
|
# search headers and libraries in the target environment, search
|
||||||
# programs in the host environment
|
# programs in the host environment
|
||||||
|
|||||||
+11
-12
@@ -302,16 +302,8 @@ function(__add_ncch_banner target IMAGE SOUND)
|
|||||||
endfunction()
|
endfunction()
|
||||||
|
|
||||||
|
|
||||||
function(add_cia_target target RSF IMAGE SOUND )
|
function(add_cia_target target RSF IMAGE SOUND)
|
||||||
get_filename_component(target_we ${target} NAME_WE)
|
get_filename_component(target_we ${target} NAME_WE)
|
||||||
if(${ARGC} GREATER 6)
|
|
||||||
set(APP_TITLE ${ARGV4})
|
|
||||||
set(APP_DESCRIPTION ${ARGV5})
|
|
||||||
set(APP_AUTHOR ${ARGV6})
|
|
||||||
endif()
|
|
||||||
if(${ARGC} EQUAL 8)
|
|
||||||
set(APP_ICON ${ARGV7})
|
|
||||||
endif()
|
|
||||||
if(NOT APP_TITLE)
|
if(NOT APP_TITLE)
|
||||||
set(APP_TITLE ${target})
|
set(APP_TITLE ${target})
|
||||||
endif()
|
endif()
|
||||||
@@ -321,6 +313,9 @@ function(add_cia_target target RSF IMAGE SOUND )
|
|||||||
if(NOT APP_AUTHOR)
|
if(NOT APP_AUTHOR)
|
||||||
set(APP_AUTHOR "Unspecified Author")
|
set(APP_AUTHOR "Unspecified Author")
|
||||||
endif()
|
endif()
|
||||||
|
if(NOT APP_VERSION)
|
||||||
|
set(APP_VERSION 0)
|
||||||
|
endif()
|
||||||
if(NOT APP_ICON)
|
if(NOT APP_ICON)
|
||||||
if(EXISTS ${target}.png)
|
if(EXISTS ${target}.png)
|
||||||
set(APP_ICON ${target}.png)
|
set(APP_ICON ${target}.png)
|
||||||
@@ -335,7 +330,10 @@ function(add_cia_target target RSF IMAGE SOUND )
|
|||||||
if( NOT ${target_we}.smdh)
|
if( NOT ${target_we}.smdh)
|
||||||
__add_smdh(${target_we}.smdh ${APP_TITLE} ${APP_DESCRIPTION} ${APP_AUTHOR} ${APP_ICON})
|
__add_smdh(${target_we}.smdh ${APP_TITLE} ${APP_DESCRIPTION} ${APP_AUTHOR} ${APP_ICON})
|
||||||
endif()
|
endif()
|
||||||
__add_ncch_banner(${target_we}.bnr ${IMAGE} ${SOUND})
|
if(NOT BANNER)
|
||||||
|
set(BANNER ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr)
|
||||||
|
__add_ncch_banner(${target_we}.bnr ${IMAGE} ${SOUND})
|
||||||
|
endif()
|
||||||
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
|
add_custom_command(OUTPUT ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
|
||||||
COMMAND ${MAKEROM} -f cia
|
COMMAND ${MAKEROM} -f cia
|
||||||
-target t
|
-target t
|
||||||
@@ -343,12 +341,13 @@ function(add_cia_target target RSF IMAGE SOUND )
|
|||||||
-o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
|
-o ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.cia
|
||||||
-elf $<TARGET_FILE:${target}>
|
-elf $<TARGET_FILE:${target}>
|
||||||
-rsf ${RSF}
|
-rsf ${RSF}
|
||||||
-banner ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr
|
-ver ${APP_VERSION}
|
||||||
|
-banner ${BANNER}
|
||||||
-icon ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
|
-icon ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
|
||||||
-DAPP_TITLE=${APP_TITLE}
|
-DAPP_TITLE=${APP_TITLE}
|
||||||
-DAPP_PRODUCT_CODE=${APP_PRODUCT_CODE}
|
-DAPP_PRODUCT_CODE=${APP_PRODUCT_CODE}
|
||||||
-DAPP_UNIQUE_ID=${APP_UNIQUE_ID}
|
-DAPP_UNIQUE_ID=${APP_UNIQUE_ID}
|
||||||
DEPENDS ${target} ${RSF} ${ROMFS_FILES} ${SHADER_OUTPUT} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.bnr ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
|
DEPENDS ${target} ${RSF} ${ROMFS_FILES} ${SHADER_OUTPUT} ${BANNER} ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/${target_we}.smdh
|
||||||
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
|
||||||
VERBATIM
|
VERBATIM
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ file(GLOB_RECURSE ROMFS_FILES ${PROJECT_SOURCE_DIR}/res/romfs/*)
|
|||||||
add_executable(${PROJECT_NAME}.elf ${SOURCE_FILES} ${ARM_SOURCE_FILES})
|
add_executable(${PROJECT_NAME}.elf ${SOURCE_FILES} ${ARM_SOURCE_FILES})
|
||||||
|
|
||||||
target_link_libraries(${PROJECT_NAME}.elf ${CPP3DS_ARM_LIBS})
|
target_link_libraries(${PROJECT_NAME}.elf ${CPP3DS_ARM_LIBS})
|
||||||
|
set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_DEFINITIONS "_3DS")
|
||||||
set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_FLAGS "${CPP3DS_ARM_FLAGS}")
|
set_target_properties(${PROJECT_NAME}.elf PROPERTIES COMPILE_FLAGS "${CPP3DS_ARM_FLAGS}")
|
||||||
set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_FLAGS "-specs=3dsx.specs -march=armv6k -mtune=mpcore -mfloat-abi=hard -gc-sections")
|
set_target_properties(${PROJECT_NAME}.elf PROPERTIES LINK_FLAGS "-specs=3dsx.specs -march=armv6k -mtune=mpcore -mfloat-abi=hard -gc-sections")
|
||||||
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
SET(CMAKE_SHARED_LIBRARY_LINK_CXX_FLAGS "")
|
||||||
|
|||||||
@@ -1,9 +1,16 @@
|
|||||||
#ifndef CPP3DS_EMULATOR_HPP
|
#ifndef CPP3DS_EMULATOR_HPP
|
||||||
#define CPP3DS_EMULATOR_HPP
|
#define CPP3DS_EMULATOR_HPP
|
||||||
|
|
||||||
#include <cpp3ds/Config.hpp>
|
#ifdef TEST
|
||||||
|
|
||||||
#include <cpp3ds/Emulator/Emulator.hpp>
|
#include <SFML/Graphics.hpp>
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
#include <cpp3ds/Config.hpp>
|
||||||
|
#include <cpp3ds/Emulator/Emulator.hpp>
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|||||||
@@ -187,13 +187,14 @@ bool operator !=(const Rect<T>& left, const Rect<T>& right);
|
|||||||
#include <cpp3ds/Graphics/Rect.inl>
|
#include <cpp3ds/Graphics/Rect.inl>
|
||||||
|
|
||||||
// Create typedefs for the most common types
|
// Create typedefs for the most common types
|
||||||
typedef Rect<int> IntRect;
|
typedef Rect<int> IntRect;
|
||||||
typedef Rect<float> FloatRect;
|
typedef Rect<size_t> UintRect;
|
||||||
|
typedef Rect<float> FloatRect;
|
||||||
|
|
||||||
} // namespace sf
|
} // namespace cpp3ds
|
||||||
|
|
||||||
|
|
||||||
#endif // SFML_RECT_HPP
|
#endif // CPP3DS_RECT_HPP
|
||||||
|
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -91,6 +91,14 @@ public :
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
RenderStates(const Shader* theShader);
|
RenderStates(const Shader* theShader);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Construct a default set of render states with a custom scissor
|
||||||
|
///
|
||||||
|
/// \param theScissor Scissor rect to use
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
RenderStates(const UintRect& theScissor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Construct a set of render states with all its attributes
|
/// \brief Construct a set of render states with all its attributes
|
||||||
///
|
///
|
||||||
@@ -101,7 +109,7 @@ public :
|
|||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
RenderStates(const BlendMode& theBlendMode, const Transform& theTransform,
|
RenderStates(const BlendMode& theBlendMode, const Transform& theTransform,
|
||||||
const Texture* theTexture, const Shader* theShader);
|
const Texture* theTexture, const Shader* theShader, const IntRect& theScissor);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Static member data
|
// Static member data
|
||||||
@@ -115,6 +123,7 @@ public :
|
|||||||
Transform transform; ///< Transform
|
Transform transform; ///< Transform
|
||||||
const Texture* texture; ///< Texture
|
const Texture* texture; ///< Texture
|
||||||
const Shader* shader; ///< Shader
|
const Shader* shader; ///< Shader
|
||||||
|
UintRect scissor; ///< Scissor
|
||||||
};
|
};
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -49,6 +49,8 @@ class Drawable;
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
class RenderTarget : NonCopyable
|
class RenderTarget : NonCopyable
|
||||||
{
|
{
|
||||||
|
friend class Text;
|
||||||
|
|
||||||
public :
|
public :
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -359,6 +361,14 @@ private:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void applyBlendMode(const BlendMode& mode);
|
void applyBlendMode(const BlendMode& mode);
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
/// \brief Apply a new scissor rect
|
||||||
|
///
|
||||||
|
/// \param rect Scissor rect to use (Empty IntRect() to disable)
|
||||||
|
///
|
||||||
|
////////////////////////////////////////////////////////////
|
||||||
|
void applyScissor(const UintRect& rect);
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Apply a new transform
|
/// \brief Apply a new transform
|
||||||
///
|
///
|
||||||
@@ -411,6 +421,7 @@ private:
|
|||||||
Uint64 lastTextureId; ///< Cached texture
|
Uint64 lastTextureId; ///< Cached texture
|
||||||
bool useVertexCache; ///< Did we previously use the vertex cache?
|
bool useVertexCache; ///< Did we previously use the vertex cache?
|
||||||
Vertex* vertexCache; ///< Pre-transformed vertices cache
|
Vertex* vertexCache; ///< Pre-transformed vertices cache
|
||||||
|
UintRect lastScissor;
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -40,6 +40,7 @@
|
|||||||
|
|
||||||
namespace cpp3ds
|
namespace cpp3ds
|
||||||
{
|
{
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Graphical text that can be drawn to a render target
|
/// \brief Graphical text that can be drawn to a render target
|
||||||
///
|
///
|
||||||
@@ -124,6 +125,8 @@ namespace cpp3ds
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void setFont(const Font& font);
|
void setFont(const Font& font);
|
||||||
|
|
||||||
|
void useSystemFont();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Set the character size
|
/// \brief Set the character size
|
||||||
///
|
///
|
||||||
@@ -337,6 +340,8 @@ namespace cpp3ds
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
virtual void draw(RenderTarget& target, RenderStates states) const;
|
virtual void draw(RenderTarget& target, RenderStates states) const;
|
||||||
|
|
||||||
|
void drawSystemFont(RenderTarget& target, RenderStates states) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Make sure the text's geometry is updated
|
/// \brief Make sure the text's geometry is updated
|
||||||
///
|
///
|
||||||
@@ -346,6 +351,9 @@ namespace cpp3ds
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
void ensureGeometryUpdate() const;
|
void ensureGeometryUpdate() const;
|
||||||
|
|
||||||
|
void ensureGeometryUpdateSystemFont() const;
|
||||||
|
Vector2f findCharacterPosSystemFont(std::size_t index) const;
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
// Member data
|
// Member data
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -360,6 +368,10 @@ namespace cpp3ds
|
|||||||
mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
|
mutable VertexArray m_outlineVertices; ///< Vertex array containing the outline geometry
|
||||||
mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates)
|
mutable FloatRect m_bounds; ///< Bounding rectangle of the text (in local coordinates)
|
||||||
mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed?
|
mutable bool m_geometryNeedUpdate; ///< Does the geometry need to be recomputed?
|
||||||
|
bool m_useSystemFont; ///< Flag to use 3DS system font
|
||||||
|
#ifndef EMULATION
|
||||||
|
mutable std::vector<Uint16> m_systemGlyphTextures;
|
||||||
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
} // namespace cpp3ds
|
} // namespace cpp3ds
|
||||||
|
|||||||
@@ -231,7 +231,8 @@ public:
|
|||||||
|
|
||||||
// 10xx: cpp3ds custom codes
|
// 10xx: cpp3ds custom codes
|
||||||
InvalidResponse = 1000, ///< Response is not a valid HTTP one
|
InvalidResponse = 1000, ///< Response is not a valid HTTP one
|
||||||
ConnectionFailed = 1001 ///< Connection with server failed
|
ConnectionFailed = 1001, ///< Connection with server failed
|
||||||
|
TimedOut = 1002, ///< Connection timed out
|
||||||
};
|
};
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
@@ -319,7 +320,7 @@ public:
|
|||||||
#ifdef EMULATION
|
#ifdef EMULATION
|
||||||
void parse(const std::string& data);
|
void parse(const std::string& data);
|
||||||
#else
|
#else
|
||||||
void parse(httpcContext *context);
|
void parse(httpcContext *context, Time timeout);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
@@ -362,6 +363,10 @@ public:
|
|||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Http();
|
Http();
|
||||||
|
|
||||||
|
~Http();
|
||||||
|
|
||||||
|
void close();
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
/// \brief Construct the HTTP client with the target host
|
/// \brief Construct the HTTP client with the target host
|
||||||
///
|
///
|
||||||
@@ -413,7 +418,7 @@ public:
|
|||||||
/// \return Server's response
|
/// \return Server's response
|
||||||
///
|
///
|
||||||
////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////
|
||||||
Response sendRequest(const Request& request, Time timeout = Time::Zero, RequestCallback callback = nullptr);
|
Response sendRequest(const Request& request, Time timeout = Time::Zero, RequestCallback callback = nullptr, size_t bufferSize = 4096);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|||||||
@@ -23,9 +23,7 @@ namespace {
|
|||||||
std::unique_ptr<char[]> buf( new char[ size ] );
|
std::unique_ptr<char[]> buf( new char[ size ] );
|
||||||
snprintf( buf.get(), size, format.c_str(), args ... );
|
snprintf( buf.get(), size, format.c_str(), args ... );
|
||||||
std::string stringUtf8( buf.get(), buf.get() + size - 1 ); // We don't want the '\0' inside
|
std::string stringUtf8( buf.get(), buf.get() + size - 1 ); // We don't want the '\0' inside
|
||||||
std::wstring stringUtf32;
|
return cpp3ds::String::fromUtf8(stringUtf8.begin(), stringUtf8.end());
|
||||||
cpp3ds::Utf8::toUtf32(stringUtf8.begin(), stringUtf8.end(), std::back_inserter(stringUtf32));
|
|
||||||
return cpp3ds::String(stringUtf32);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -177,6 +177,7 @@ public :
|
|||||||
|
|
||||||
void setStackSize(size_t stacksize);
|
void setStackSize(size_t stacksize);
|
||||||
void setPriority(int priority);
|
void setPriority(int priority);
|
||||||
|
void setRelativePriority(int priority);
|
||||||
void setAffinity(int affinity);
|
void setAffinity(int affinity);
|
||||||
|
|
||||||
private :
|
private :
|
||||||
|
|||||||
+10
-7
@@ -3,16 +3,19 @@ import os, socket, sys, struct, getopt
|
|||||||
|
|
||||||
def sendfile(filename, ip):
|
def sendfile(filename, ip):
|
||||||
statinfo = os.stat(filename)
|
statinfo = os.stat(filename)
|
||||||
fbiinfo = struct.pack('!q', statinfo.st_size)
|
|
||||||
with open(filename, 'rb') as f:
|
with open(filename, 'rb') as f:
|
||||||
sock = socket.socket()
|
sock = socket.socket()
|
||||||
sock.connect((ip, 5000))
|
sock.connect((ip, 5000))
|
||||||
sock.send(fbiinfo)
|
sock.send(struct.pack('!i', 1))
|
||||||
while True:
|
if struct.unpack("!b", sock.recv(1))[0] == 1:
|
||||||
chunk = f.read(16384)
|
sock.send(struct.pack('!q', statinfo.st_size))
|
||||||
if not chunk:
|
while True:
|
||||||
break # EOF
|
chunk = f.read(1024 * 256)
|
||||||
sock.sendall(chunk)
|
if not chunk:
|
||||||
|
break # EOF
|
||||||
|
sock.sendall(chunk)
|
||||||
|
else:
|
||||||
|
print("Canceled by FBI")
|
||||||
sock.close()
|
sock.close()
|
||||||
|
|
||||||
def show_usage_exit():
|
def show_usage_exit():
|
||||||
|
|||||||
@@ -17,6 +17,8 @@ set(SRC
|
|||||||
)
|
)
|
||||||
|
|
||||||
if(ENABLE_OGG)
|
if(ENABLE_OGG)
|
||||||
|
find_package(Vorbis REQUIRED)
|
||||||
|
include_directories(${VORBIS_INCLUDE_DIRS})
|
||||||
list(APPEND SRC
|
list(APPEND SRC
|
||||||
${SRCROOT}/SoundFileReaderOgg.cpp
|
${SRCROOT}/SoundFileReaderOgg.cpp
|
||||||
${SRCROOT}/SoundFileWriterOgg.cpp)
|
${SRCROOT}/SoundFileWriterOgg.cpp)
|
||||||
|
|||||||
@@ -144,7 +144,7 @@ void Sound::setBuffer(const SoundBuffer& buffer)
|
|||||||
|
|
||||||
memset(&m_ndspWaveBuf, 0, sizeof(ndspWaveBuf));
|
memset(&m_ndspWaveBuf, 0, sizeof(ndspWaveBuf));
|
||||||
m_ndspWaveBuf.data_vaddr = buffer.getSamples();
|
m_ndspWaveBuf.data_vaddr = buffer.getSamples();
|
||||||
m_ndspWaveBuf.nsamples = buffer.getSampleCount();
|
m_ndspWaveBuf.nsamples = buffer.getSampleCount() / buffer.getChannelCount();
|
||||||
m_ndspWaveBuf.looping = m_loop; // Loop enabled
|
m_ndspWaveBuf.looping = m_loop; // Loop enabled
|
||||||
m_ndspWaveBuf.status = NDSP_WBUF_FREE;
|
m_ndspWaveBuf.status = NDSP_WBUF_FREE;
|
||||||
|
|
||||||
@@ -184,7 +184,7 @@ void Sound::setPlayingOffset(Time timeOffset)
|
|||||||
m_playOffset = timeOffset;
|
m_playOffset = timeOffset;
|
||||||
int offset = m_buffer->getSampleRate() * m_buffer->getChannelCount() * timeOffset.asSeconds();
|
int offset = m_buffer->getSampleRate() * m_buffer->getChannelCount() * timeOffset.asSeconds();
|
||||||
m_ndspWaveBuf.data_vaddr = m_buffer->getSamples() + offset;
|
m_ndspWaveBuf.data_vaddr = m_buffer->getSamples() + offset;
|
||||||
m_ndspWaveBuf.nsamples = m_buffer->getSampleCount() - offset;
|
m_ndspWaveBuf.nsamples = m_buffer->getSampleCount() / m_buffer->getChannelCount() - offset;
|
||||||
if (status == Playing)
|
if (status == Playing)
|
||||||
ndspChnWaveBufAdd(m_channel, &m_ndspWaveBuf);
|
ndspChnWaveBufAdd(m_channel, &m_ndspWaveBuf);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ SoundStream::SoundStream()
|
|||||||
, m_loop (false)
|
, m_loop (false)
|
||||||
, m_samplesProcessed(0)
|
, m_samplesProcessed(0)
|
||||||
{
|
{
|
||||||
|
m_thread.setPriority(0x19);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user