Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Jessica Hawkwell
/
nitrogen
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
2
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8fc1002e
authored
Mar 15, 2018
by
Jessica Hawkwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
halp
1 parent
ab7acabc
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
174 additions
and
70 deletions
CMakeLists.txt
nbproject/configurations.xml
src/NitroWin/CMakeLists.txt
src/NitroWin/NWMAction.h
src/libnde/CMakeLists.txt
src/NitroWin/NPosition.h → src/libnde/NPosition.cpp
src/libnde/NPosition.h
src/NitroWin/NSize.h → src/libnde/NSize.h
CMakeLists.txt
View file @
8fc1002
...
@@ -4,8 +4,32 @@ set(CMAKE_CXX_STANDARD 14)
...
@@ -4,8 +4,32 @@ set(CMAKE_CXX_STANDARD 14)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_C_STANDARD 11
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_BUILD_TYPE Debug
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY build/bin
)
set
(
CMAKE_RUNTIME_OUTPUT_DIRECTORY
./
build/bin
)
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY build/lib
)
set
(
CMAKE_ARCHIVE_OUTPUT_DIRECTORY
./
build/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY build/lib
)
set
(
CMAKE_LIBRARY_OUTPUT_DIRECTORY
./
build/lib
)
add_subdirectory
(
src/NitroWin
)
project
(
nde
)
include_directories
(
"/usr/local/include"
)
add_library
(
${
PROJECT_NAME
}
SHARED src/libnde/NPosition.cpp
)
install
(
TARGETS
${
PROJECT_NAME
}
LIBRARY DESTINATION lib/
${
PROJECT_NAME
}
)
file
(
GLOB HEADERS
"src/libnde/*.h"
)
install
(
FILES
${
HEADERS
}
DESTINATION include/
${
PROJECT_NAME
}
)
target_include_directories
(
nde PUBLIC
"src/libnde"
)
project
(
NitroWin
)
find_package
(
X11
)
include_directories
(
"/usr/local/include"
)
link_libraries
(
${
X11_LIBRARIES
}
)
add_executable
(
${
PROJECT_NAME
}
src/NitroWin/NUtils.cpp
src/NitroWin/NWMAction.cpp
src/NitroWin/NWManager.cpp
src/NitroWin/main.cpp
)
target_link_libraries
(
${
PROJECT_NAME
}
LINK_PUBLIC nde
)
nbproject/configurations.xml
View file @
8fc1002
...
@@ -15,6 +15,9 @@
...
@@ -15,6 +15,9 @@
<in>
feature_tests.cxx
</in>
<in>
feature_tests.cxx
</in>
</df>
</df>
<df
name=
"src"
>
<df
name=
"src"
>
<df
name=
"libnde"
>
<in>
NPosition.cpp
</in>
</df>
<df
name=
"NitroWin"
>
<df
name=
"NitroWin"
>
<df
name=
"CMakeFiles"
>
<df
name=
"CMakeFiles"
>
<df
name=
"3.10.2"
>
<df
name=
"3.10.2"
>
...
@@ -28,8 +31,6 @@
...
@@ -28,8 +31,6 @@
<in>
feature_tests.c
</in>
<in>
feature_tests.c
</in>
<in>
feature_tests.cxx
</in>
<in>
feature_tests.cxx
</in>
</df>
</df>
<in>
NPosition.h
</in>
<in>
NSize.h
</in>
<in>
NUtils.cpp
</in>
<in>
NUtils.cpp
</in>
<in>
NUtils.h
</in>
<in>
NUtils.h
</in>
<in>
NWMAction.cpp
</in>
<in>
NWMAction.cpp
</in>
...
@@ -117,10 +118,6 @@
...
@@ -117,10 +118,6 @@
tool=
"1"
tool=
"1"
flavor2=
"0"
>
flavor2=
"0"
>
</item>
</item>
<item
path=
"src/NitroWin/NPosition.h"
ex=
"false"
tool=
"3"
flavor2=
"0"
>
</item>
<item
path=
"src/NitroWin/NSize.h"
ex=
"false"
tool=
"3"
flavor2=
"0"
>
</item>
<item
path=
"src/NitroWin/NUtils.cpp"
ex=
"false"
tool=
"1"
flavor2=
"0"
>
<item
path=
"src/NitroWin/NUtils.cpp"
ex=
"false"
tool=
"1"
flavor2=
"0"
>
</item>
</item>
<item
path=
"src/NitroWin/NUtils.h"
ex=
"false"
tool=
"3"
flavor2=
"0"
>
<item
path=
"src/NitroWin/NUtils.h"
ex=
"false"
tool=
"3"
flavor2=
"0"
>
...
@@ -135,6 +132,8 @@
...
@@ -135,6 +132,8 @@
</item>
</item>
<item
path=
"src/NitroWin/main.cpp"
ex=
"false"
tool=
"1"
flavor2=
"0"
>
<item
path=
"src/NitroWin/main.cpp"
ex=
"false"
tool=
"1"
flavor2=
"0"
>
</item>
</item>
<item
path=
"src/libnde/NPosition.cpp"
ex=
"false"
tool=
"1"
flavor2=
"0"
>
</item>
</conf>
</conf>
</confs>
</confs>
</configurationDescriptor>
</configurationDescriptor>
src/NitroWin/CMakeLists.txt
View file @
8fc1002
...
@@ -6,5 +6,5 @@ include_directories("/usr/local/include")
...
@@ -6,5 +6,5 @@ include_directories("/usr/local/include")
link_libraries
(
${
X11_LIBRARIES
}
)
link_libraries
(
${
X11_LIBRARIES
}
)
file
(
GLOB nwin
"*.cpp"
)
add_executable
(
${
PROJECT_NAME
}
NUtils.cpp NWMAction.cpp NWManager.cpp main.cpp
)
add_executable
(
NitroWin
${
nwin
}
)
target_link_libraries
(
${
PROJECT_NAME
}
LINK_PUBLIC nde
)
src/NitroWin/NWMAction.h
View file @
8fc1002
...
@@ -38,7 +38,7 @@
...
@@ -38,7 +38,7 @@
#include <vector>
#include <vector>
#include <unordered_map>
#include <unordered_map>
#include
"NPosition.h"
#include
<NPosition.h>
#include "NSize.h"
#include "NSize.h"
class
NWMAction
{
class
NWMAction
{
...
...
src/libnde/CMakeLists.txt
0 → 100644
View file @
8fc1002
cmake_minimum_required
(
VERSION 3.10
)
project
(
nde
)
include_directories
(
"/usr/local/include"
)
add_library
(
${
PROJECT_NAME
}
SHARED PUBLIC NPosition.cpp
)
install
(
TARGETS
${
PROJECT_NAME
}
LIBRARY DESTINATION lib/
${
PROJECT_NAME
}
)
file
(
GLOB HEADERS
"*.h"
)
install
(
FILES
${
HEADERS
}
DESTINATION include/
${
PROJECT_NAME
}
)
target_include_directories
(
nde PUBLIC
${
CMAKE_CURRENT_SOURCE_DIR
}
)
src/
NitroWin/NPosition.h
→
src/
libnde/NPosition.cpp
View file @
8fc1002
/*
/*
* Copyright(c) 2018, jlhawkwell
* Copyright
(c) 2018, jlhawkwell
* All rights reserved.
* All rights reserved.
*
*
* Redistribution and use in source and binary forms, with or without
* Redistribution and use in source and binary forms, with or without
...
@@ -16,75 +16,74 @@
...
@@ -16,75 +16,74 @@
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
* CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
* POSSIBILITY OF SUCH DAMAGE.
*/
*/
#ifndef NPOSITION_H
#include "NPosition.h"
#define NPOSITION_H
#include <string>
template
<
typename
T
>
template
<
typename
T
>
class
NPosition
__attribute__
((
__visibility__
(
"default"
)))
{
NPosition
<
T
>::
NPosition
(
T
x
,
T
y
)
{
protected
:
px
=
x
;
T
px
;
py
=
y
;
T
py
;
}
public
:
NPosition
<
T
>
(
T
x
,
T
y
)
{
px
=
x
;
py
=
y
;
}
NPosition
<
T
>
(
const
NPosition
<
T
>&
other
)
{
px
=
other
.
px
;
py
=
other
.
py
;
}
NPosition
<
T
>&
operator
=
(
const
NPosition
<
T
>&
other
)
{
template
<
typename
T
>
px
=
other
.
px
;
__attribute__
((
__visibility__
(
"default"
)))
py
=
other
.
py
;
NPosition
<
T
>::
NPosition
(
const
NPosition
<
T
>&
other
)
{
return
*
this
;
px
=
other
.
px
;
}
py
=
other
.
py
;
}
NPosition
<
T
>
operator
+
(
const
NPosition
<
T
>&
other
)
{
template
<
typename
T
>
NPosition
<
T
>
rt
=
NPosition
<
T
>
(
px
+
other
.
px
,
py
+
other
.
py
);
NPosition
<
T
>&
NPosition
<
T
>::
operator
=
(
const
NPosition
<
T
>&&
other
)
{
return
rt
;
px
=
other
.
px
;
}
py
=
other
.
py
;
return
*
this
;
}
NPosition
<
T
>
operator
-
(
const
NPosition
<
T
>&
other
)
{
template
<
typename
T
>
NPosition
<
T
>
rt
=
NPosition
<
T
>
(
px
-
other
.
px
,
py
-
other
.
py
);
NPosition
<
T
>
NPosition
<
T
>::
operator
+
(
const
NPosition
<
T
>&
other
)
{
return
rt
;
NPosition
<
T
>
rt
=
NPosition
<
T
>
(
px
+
other
.
px
,
py
+
other
.
py
);
}
return
rt
;
}
bool
operator
==
(
const
NPosition
<
T
>&
other
)
const
{
template
<
typename
T
>
if
(
px
!=
other
.
getX
())
{
return
false
;
}
NPosition
<
T
>
NPosition
<
T
>::
operator
-
(
const
NPosition
<
T
>&
other
)
{
if
(
py
!=
other
.
getY
())
{
return
false
;
}
NPosition
<
T
>
rt
=
NPosition
<
T
>
(
px
-
other
.
px
,
py
-
other
.
py
);
return
true
;
return
rt
;
}
}
std
::
string
toString
()
{
template
<
typename
T
>
std
::
string
out
=
std
::
string
();
bool
NPosition
<
T
>::
operator
==
(
const
NPosition
<
T
>&
other
)
const
{
out
.
append
(
"("
);
if
(
px
!=
other
.
getX
())
{
return
false
;
}
out
.
append
(
std
::
to_string
(
px
));
if
(
py
!=
other
.
getY
())
{
return
false
;
}
out
.
append
(
", "
);
return
true
;
out
.
append
(
std
::
to_string
(
py
));
}
out
.
append
(
")"
);
return
out
;
}
T
getX
()
{
return
px
;
}
template
<
typename
T
>
T
getY
()
{
return
py
;
}
std
::
string
NPosition
<
T
>::
toString
()
{
std
::
string
out
=
std
::
string
();
out
.
append
(
"("
);
out
.
append
(
std
::
to_string
(
px
));
out
.
append
(
", "
);
out
.
append
(
std
::
to_string
(
py
));
out
.
append
(
")"
);
return
out
;
}
void
setZeroIfNegative
()
{
template
<
typename
T
>
if
(
px
<
0
)
{
px
=
0
;
}
T
NPosition
<
T
>::
getX
()
{
return
px
;
}
if
(
py
<
0
)
{
py
=
0
;}
template
<
typename
T
>
}
T
NPosition
<
T
>::
getY
()
{
return
py
;
}
};
#endif // NPOSITION_H
template
<
typename
T
>
void
NPosition
<
T
>::
setZeroIfNegative
()
{
if
(
px
<
0
)
{
px
=
0
;
}
if
(
py
<
0
)
{
py
=
0
;}
}
src/libnde/NPosition.h
0 → 100644
View file @
8fc1002
/*
* Copyright(c) 2018, jlhawkwell
* All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* * Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* * Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
* CONTRACT, STRICT LIABILITY, OR TORT(INCLUDING NEGLIGENCE OR OTHERWISE)
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
* POSSIBILITY OF SUCH DAMAGE.
*/
#ifndef NPOSITION_H
#define NPOSITION_H
#include <string>
template
<
typename
T
>
class
__attribute__
((
__visibility__
(
"default"
)))
NPosition
{
protected
:
T
px
;
T
py
;
public
:
__attribute__
((
__visibility__
(
"default"
)))
NPosition
<
T
>
(
T
x
,
T
y
);
__attribute__
((
__visibility__
(
"default"
)))
NPosition
<
T
>
(
const
NPosition
<
T
>&
other
);
__attribute__
((
__visibility__
(
"default"
)))
NPosition
<
T
>&
operator
=
(
const
NPosition
<
T
>&&
other
);
__attribute__
((
__visibility__
(
"default"
)))
NPosition
<
T
>
operator
+
(
const
NPosition
<
T
>&
other
);
__attribute__
((
__visibility__
(
"default"
)))
NPosition
<
T
>
operator
-
(
const
NPosition
<
T
>&
other
);
__attribute__
((
__visibility__
(
"default"
)))
bool
operator
==
(
const
NPosition
<
T
>&
other
)
const
;
__attribute__
((
__visibility__
(
"default"
)))
std
::
string
toString
();
__attribute__
((
__visibility__
(
"default"
)))
T
getX
();
__attribute__
((
__visibility__
(
"default"
)))
T
getY
();
__attribute__
((
__visibility__
(
"default"
)))
void
setZeroIfNegative
();
};
#endif // NPOSITION_H
src/
NitroWin
/NSize.h
→
src/
libnde
/NSize.h
View file @
8fc1002
File moved
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment