UdonLibrary
1.0.0
機械システム研究部 C++ ライブラリ
Toggle main menu visibility
読み取り中…
検索中…
一致する文字列を見つけられません
Printf.hpp
[詳解]
1
//
2
// 全プラットフォームで使用可能なPrintf
3
//
4
// Copyright (c) 2022 udonrobo
5
//
6
7
#pragma once
8
9
#include <stdlib.h>
10
#include <stdarg.h>
11
#include <stdio.h>
12
13
#include <
Udon/Utility/Platform.hpp
>
14
15
namespace
Udon
16
{
17
#if UDON_PLATFORM_OUTPUT_STREAM == UDON_PLATFORM_OUTPUT_SERIAL
18
19
# if UDON_PLATFORM_HAS_SERIAL_PRINTF
20
21
template
<
typename
... Args>
22
inline
void
Printf
(Stream& stream,
const
char
* format, Args&&... args)
23
{
24
stream.printf(format, args...);
25
}
26
27
# elif defined(ARDUINO)
28
29
template
<
typename
... Args>
30
inline
void
Printf
(Stream& stream,
const
char
* format, Args&&... args)
31
{
32
char
buf[256];
33
snprintf(buf,
sizeof
buf, format, args...);
34
stream.print(buf);
35
}
36
37
# else
38
39
40
41
# endif
42
43
template
<
typename
... Args>
44
inline
void
Printf
(
const
char
* format, Args... args)
45
{
46
Printf
(Serial, format, args...);
47
}
48
49
#elif UDON_PLATFORM_OUTPUT_STREAM == UDON_PLATFORM_OUTPUT_CONSOLE
50
51
template
<
typename
... Args>
52
inline
void
Printf
(
const
char
* format, Args... args)
53
{
54
printf(format, args...);
55
}
56
57
#endif
58
59
}
// namespace Udon
Platform.hpp
Udon
Definition
Bit.hpp:12
Udon::Printf
void Printf(const char *format, Args... args)
Definition
Printf.hpp:44