Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
O
orbclient
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
8
Issues
8
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Packages & Registries
Packages & Registries
Container Registry
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
redox-os
orbclient
Commits
b2bbae8c
Commit
b2bbae8c
authored
Sep 17, 2017
by
Jeremy Soller
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update SDL2
parent
e16319b3
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
41 additions
and
44 deletions
+41
-44
Cargo.toml
Cargo.toml
+16
-14
src/lib.rs
src/lib.rs
+5
-5
src/sys/orbital.rs
src/sys/orbital.rs
+0
-0
src/sys/sdl2.rs
src/sys/sdl2.rs
+20
-25
No files found.
Cargo.toml
View file @
b2bbae8c
[package]
name
=
"orbclient"
authors
=
[
"Jeremy Soller <jackpot51@gmail.com>"
]
description
=
"The Orbital Client Library"
repository
=
"https://github.com/redox-os/orbclient"
version
=
"0.3.8"
keywords
=
[
"orbital"
,
"redox"
,
"ui"
,
]
license-file
=
"LICENSE"
readme
=
"README.md"
keywords
=
[
"orbital"
,
"redox"
,
"ui"
]
authors
=
[
"Jeremy Soller <jackpot51@gmail.com>"
]
[lib]
name
=
"orbclient"
path
=
"src/lib.rs"
readme
=
"README.md"
repository
=
"https://github.com/redox-os/orbclient"
version
=
"0.3.9"
[features]
default
=
[]
no_std
=
[]
[target.'cfg(all(not(feature
=
"no_std"
)
,
target_os
=
"redox"
))
'.dependencies]
redox_syscall
=
"0.1"
[target.'cfg(all(not(feature
=
"no_std"
)
,
not(target_os
=
"redox"
)))
'.dependencies]
sdl
2
=
"0.29"
[lib]
name
=
"orbclient"
path
=
"src/lib.rs"
[target.'cfg(all(not(feature
=
"no_std"
)
,
not(target_os=
"redox"
)))
'.dependencies]
sdl
2
=
"0.30.0"
[target.'cfg(all(not(feature
=
"no_std"
)
,
target_os=
"redox"
))
'.dependencies]
redox_syscall
=
"0.1.31"
src/lib.rs
View file @
b2bbae8c
...
...
@@ -16,7 +16,7 @@ pub static FONT: &'static [u8] = include_bytes!("../res/unifont.font");
pub
use
color
::
Color
;
pub
use
event
::
*
;
#[cfg(not(feature=
"no_std"
))]
pub
use
imp
::{
get_display_size
,
EventIter
,
Window
};
pub
use
sys
::{
get_display_size
,
EventIter
,
Window
};
pub
use
graphicspath
::
GraphicsPath
;
pub
use
renderer
::
Renderer
;
...
...
@@ -35,9 +35,9 @@ pub enum WindowFlag {
}
#[cfg(all(not(feature=
"no_std"
),
target_os
=
"redox"
))]
#[path=
"
imp
/orbital.rs"
]
mod
imp
;
#[path=
"
sys
/orbital.rs"
]
mod
sys
;
#[cfg(all(not(feature=
"no_std"
),
not(target_os
=
"redox"
)))]
#[path=
"
imp
/sdl2.rs"
]
mod
imp
;
#[path=
"
sys
/sdl2.rs"
]
mod
sys
;
src/
imp
/orbital.rs
→
src/
sys
/orbital.rs
View file @
b2bbae8c
File moved
src/
imp
/sdl2.rs
→
src/
sys
/sdl2.rs
View file @
b2bbae8c
...
...
@@ -49,7 +49,7 @@ pub struct Window {
/// True if the window should not wait for events
async
:
bool
,
/// The inner renderer
inner
:
sdl2
::
render
::
Renderer
<
'static
>
,
inner
:
sdl2
::
render
::
WindowCanvas
,
}
impl
Renderer
for
Window
{
...
...
@@ -65,7 +65,7 @@ impl Renderer for Window {
/// Access pixel buffer
fn
data
(
&
self
)
->
&
[
Color
]
{
let
window
=
self
.inner
.window
()
.unwrap
()
;
let
window
=
self
.inner
.window
();
let
surface
=
window
.surface
(
unsafe
{
&
*
EVENT_PUMP
})
.unwrap
();
let
bytes
=
surface
.without_lock
()
.unwrap
();
unsafe
{
slice
::
from_raw_parts
(
bytes
.as_ptr
()
as
*
const
Color
,
bytes
.len
()
/
mem
::
size_of
::
<
Color
>
())
}
...
...
@@ -73,8 +73,8 @@ impl Renderer for Window {
/// Access pixel buffer mutably
fn
data_mut
(
&
mut
self
)
->
&
mut
[
Color
]
{
let
window
=
self
.inner
.window_mut
()
.unwrap
()
;
let
surface
=
window
.surface_mut
(
unsafe
{
&
*
EVENT_PUMP
})
.unwrap
();
let
window
=
self
.inner
.window_mut
();
let
mut
surface
=
window
.surface
(
unsafe
{
&
*
EVENT_PUMP
})
.unwrap
();
let
bytes
=
surface
.without_lock_mut
()
.unwrap
();
unsafe
{
slice
::
from_raw_parts_mut
(
bytes
.as_mut_ptr
()
as
*
mut
Color
,
bytes
.len
()
/
mem
::
size_of
::
<
Color
>
())
}
}
...
...
@@ -133,23 +133,22 @@ impl Window {
h
:
h
,
t
:
title
.to_string
(),
async
:
async
,
inner
:
window
.
renderer
()
.software
()
.build
()
.unwrap
(),
inner
:
window
.
into_canvas
()
.software
()
.build
()
.unwrap
(),
}),
Err
(
_
)
=>
None
}
}
pub
fn
sync_path
(
&
mut
self
)
{
if
let
Some
(
window
)
=
self
.inner
.window
()
{
let
pos
=
window
.position
();
let
size
=
window
.size
();
let
title
=
window
.title
();
self
.x
=
pos
.0
;
self
.y
=
pos
.1
;
self
.w
=
size
.0
;
self
.h
=
size
.1
;
self
.t
=
title
.to_string
();
}
let
window
=
self
.inner
.window
();
let
pos
=
window
.position
();
let
size
=
window
.size
();
let
title
=
window
.title
();
self
.x
=
pos
.0
;
self
.y
=
pos
.1
;
self
.w
=
size
.0
;
self
.h
=
size
.1
;
self
.t
=
title
.to_string
();
}
/// Get x
...
...
@@ -171,26 +170,22 @@ impl Window {
// Set position
pub
fn
set_pos
(
&
mut
self
,
x
:
i32
,
y
:
i32
)
{
if
let
Some
(
mut
window
)
=
self
.inner
.window_mut
()
{
let
_
=
window
.set_position
(
sdl2
::
video
::
WindowPos
::
Positioned
(
x
),
sdl2
::
video
::
WindowPos
::
Positioned
(
y
));
}
self
.inner
.window_mut
()
.set_position
(
sdl2
::
video
::
WindowPos
::
Positioned
(
x
),
sdl2
::
video
::
WindowPos
::
Positioned
(
y
)
);
self
.sync_path
();
}
// Set size
pub
fn
set_size
(
&
mut
self
,
width
:
u32
,
height
:
u32
)
{
if
let
Some
(
mut
window
)
=
self
.inner
.window_mut
()
{
let
_
=
window
.set_size
(
width
,
height
);
}
let
_
=
self
.inner
.window_mut
()
.set_size
(
width
,
height
);
self
.sync_path
();
}
/// Set title
pub
fn
set_title
(
&
mut
self
,
title
:
&
str
)
{
if
let
Some
(
mut
window
)
=
self
.inner
.window_mut
()
{
let
_
=
window
.set_title
(
title
);
}
let
_
=
self
.inner
.window_mut
()
.set_title
(
title
);
self
.sync_path
();
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
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 comment